3aab3993b96d20981d7d88cb0a6a3d625312e9df
[ardour.git] / libs / ardour / ardour / audio_library.h
1 /*
2     Copyright (C) 2003 Paul Davis
3     Author: Taybin Rutkin
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19     $Id$
20 */
21
22 #ifndef __ardour_audio_library_h__
23 #define __ardour_audio_library_h__
24
25 #include <list>
26 #include <string>
27 #include <map>
28
29 #include <sigc++/signal.h>
30
31 using std::list;
32 using std::string;
33 using std::map;
34
35 namespace ARDOUR {
36
37 class AudioLibrary 
38 {
39   public:
40         AudioLibrary ();
41         ~AudioLibrary ();
42   
43         // add_group returns the URI of the created group
44         string add_group (string group, string parent_uri = "");
45         void remove_group (string uri);
46         void get_groups (list<string>& groups, string parent_uri = "");
47
48         // add_member returns the URI of the created group
49         string add_member (string member, string parent_uri = "");
50         void remove_member (string uri);
51         void get_members (list<string>& members, string parent_uri = "");
52         string get_member_filename (string uri);
53
54         void search_members_and (list<string>& results, 
55                                                          const map<string,string>& fields);
56         void search_members_or (list<string>& results, 
57                                                         const map<string,string>& fields);
58
59         void add_field (string field);
60         void get_fields (list<string>& fields);
61         void remove_field (string field);
62         string get_field (string uri, string field);
63         void set_field (string uri, string field, string literal);
64
65         string get_label (string uri);
66         void set_label (string uri, string label);
67
68         sigc::signal<void, string, string> added_group; // group, parent
69         sigc::signal<void, string, string> added_member;// member, parent
70         sigc::signal<void, string> removed_group;
71         sigc::signal<void, string> removed_member;
72         sigc::signal<void> fields_changed;
73         
74   private:
75         void save_changes ();
76         string field_uri (string name);
77
78         bool is_rdf_type (string uri, string type);
79         void remove_uri (string uri);
80
81         string  src;
82         
83         void initialize_db();
84 };
85
86 extern AudioLibrary* Library;
87
88 } // ARDOUR namespace
89
90 #endif // __ardour_audio_library_h__