Mercurial > audlegacy
annotate libaudacious++/configdb.hh @ 2136:7ce26ebe8b6a trunk
[svn] - don't use deprecated function playlist_get().
author | nenolod |
---|---|
date | Fri, 15 Dec 2006 21:18:34 -0800 |
parents | 6d7381072a45 |
children |
rev | line source |
---|---|
2118
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
1 #ifndef CONFIGDB_HH |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
2 #define CONFIGDB_HH |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
3 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
4 #include <glib.h> |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
5 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
6 #include <string> |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
7 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
8 #ifdef _AUDACIOUS_CORE |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
9 # include "libaudacious/configdb.h" |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
10 #else |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
11 # include <audacious/configdb.h> |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
12 #endif |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
13 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
14 namespace Audacious |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
15 { |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
16 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
17 /* |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
18 * Usage example: |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
19 * |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
20 * { |
2119 | 21 * Audacious::ConfigDB foo; |
2118
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
22 * Audacious::ConfValue *bar; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
23 * |
2119 | 24 * bar = foo.GetValue("bar", "filter", Audacious::ConfigDB::String); |
2118
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
25 * std::string filter = bar->asString(); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
26 * delete bar; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
27 * |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
28 * foo.SetValue("bar", "filter", "none"); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
29 * |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
30 * foo.RemoveEntry("bar", "baz"); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
31 * } |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
32 */ |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
33 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
34 class ConfValue |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
35 { |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
36 public: |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
37 gchar *strval; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
38 gint intval; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
39 bool boolval; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
40 gfloat floatval; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
41 gdouble dblval; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
42 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
43 std::string asString(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
44 gint asInt(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
45 bool asBool(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
46 gfloat asFloat(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
47 gdouble asDouble(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
48 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
49 ~ConfValue(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
50 }; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
51 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
52 class ConfigDB |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
53 { |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
54 private: |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
55 ConfigDb *db; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
56 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
57 public: |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
58 enum ValueType { String, Int, Bool, Float, Double }; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
59 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
60 ConfValue *GetValue(std::string §ion, std::string &name, ConfigDB::ValueType type); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
61 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
62 void SetValue(std::string §ion, std::string &name, std::string &value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
63 void SetValue(std::string §ion, std::string &name, gint value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
64 void SetValue(std::string §ion, std::string &name, bool value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
65 void SetValue(std::string §ion, std::string &name, gfloat value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
66 void SetValue(std::string §ion, std::string &name, gdouble value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
67 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
68 void RemoveEntry(std::string §ion, std::string &value); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
69 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
70 ConfigDB(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
71 ~ConfigDB(void); |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
72 }; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
73 }; |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
74 |
36d4043b3df2
[svn] - add the starting point of some audacious C++ bindings
nenolod
parents:
diff
changeset
|
75 #endif |