r269@gandalf: fugalh | 2006-08-03 20:18:05 -0600
[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 <string>
26 #include <map>
27 #include <vector>
28
29 #include <sigc++/signal.h>
30
31 #include <pbd/stateful.h>
32
33 using std::vector;
34 using std::string;
35 using std::map;
36
37 namespace ARDOUR {
38
39 class AudioLibrary : public Stateful
40 {
41   public:
42         AudioLibrary ();
43         ~AudioLibrary ();
44
45         static string state_node_name;
46         
47         XMLNode& get_state (void);
48         int set_state (const XMLNode&);
49
50         void set_paths (vector<string> paths);
51         vector<string> get_paths ();
52         void scan_paths ();
53
54         void add_member (string member);
55         void remove_member (string uri);
56
57         void search_members_and (vector<string>& results, 
58                                                          const map<string,string>& fields);
59         void search_members_or (vector<string>& results, 
60                                                         const map<string,string>& fields);
61
62         void add_field (string field);
63         void get_fields (vector<string>& fields);
64         void remove_field (string field);
65         string get_field (string uri, string field);
66         void set_field (string uri, string field, string literal);
67         string get_label (string uri);
68         void set_label (string uri, string name);
69
70         void save_changes();
71
72         sigc::signal<void> fields_changed;
73         
74   private:
75         vector<string> sfdb_paths;
76
77         string field_uri (string name);
78
79         bool is_rdf_type (string uri, string type);
80         void remove_uri (string uri);
81
82         string src;
83         
84         void initialize_db();
85         void compact_vector (vector<string>& vec);
86         bool safe_file_extension (string);
87 };
88
89 extern AudioLibrary* Library;
90
91 } // ARDOUR namespace
92
93 #endif // __ardour_audio_library_h__