00001
00002
00003 #ifndef _GCONFMM_VALUE_H
00004 #define _GCONFMM_VALUE_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <glibmm/ustring.h>
00032 #include <gconfmm/value_listhelpers.h>
00033
00034
00035 namespace Gnome
00036 {
00037
00038 namespace Conf
00039 {
00040
00046 enum ValueType
00047 {
00048 VALUE_INVALID,
00049 VALUE_STRING,
00050 VALUE_INT,
00051 VALUE_FLOAT,
00052 VALUE_BOOL,
00053 VALUE_SCHEMA,
00054 VALUE_LIST,
00055 VALUE_PAIR
00056 };
00057
00058 }
00059
00060 }
00061
00062
00063 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00064 namespace Glib
00065 {
00066
00067 template <>
00068 class Value<Gnome::Conf::ValueType> : public Glib::Value_Enum<Gnome::Conf::ValueType>
00069 {
00070 public:
00071 static GType value_type() G_GNUC_CONST;
00072 };
00073
00074 }
00075 #endif
00076
00077
00078 namespace Gnome
00079 {
00080
00081 namespace Conf
00082 {
00083
00087 enum UnsetFlags
00088 {
00089 UNSET_INCLUDING_SCHEMA_NAMES
00090 };
00091
00092 }
00093
00094 }
00095
00096
00097 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00098 namespace Glib
00099 {
00100
00101 template <>
00102 class Value<Gnome::Conf::UnsetFlags> : public Glib::Value_Enum<Gnome::Conf::UnsetFlags>
00103 {
00104 public:
00105 static GType value_type() G_GNUC_CONST;
00106 };
00107
00108 }
00109 #endif
00110
00111
00112 namespace Gnome
00113 {
00114
00115 namespace Conf
00116 {
00117
00118
00119 typedef std::pair<Value, Value> ValuePair;
00120 typedef std::pair<ValueType, ValueType> ValueTypePair;
00121
00141 class Value
00142 {
00143 public:
00144 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00145 typedef Value CppObjectType;
00146 typedef GConfValue BaseObjectType;
00147 #endif
00148
00149
00150
00151 explicit Value(GConfValue* castitem, bool make_a_copy = false);
00152
00153 Value(const Value& src);
00154 Value& operator=(const Value& src);
00155
00156 ~Value();
00157
00158 GConfValue* gobj() { return gobject_; }
00159 const GConfValue* gobj() const { return gobject_; }
00160
00162 GConfValue* gobj_copy() const;
00163
00164 protected:
00165 GConfValue* gobject_;
00166
00167 private:
00168
00169
00170 public:
00171
00176 Value(ValueType type = VALUE_INVALID);
00177
00181 void set(gint val);
00182
00187 void set(gdouble val);
00188
00191 void set(bool val);
00192
00195 void set(const Schema& sc);
00196
00199 void set_car(const Value& car);
00200
00203 void set_cdr(const Value& cdr);
00204
00207 void set(const Glib::ustring& val);
00208
00209
00212 void set_list_type(ValueType type);
00213
00219 void set_int_list(const SListHandle_ValueInt& list);
00220
00224 void set_bool_list(const SListHandle_ValueBool& list);
00225
00229 void set_float_list(const SListHandle_ValueFloat& list);
00230
00234 void set_string_list(const SListHandle_ValueString& list);
00235
00239 void set_schema_list(const SListHandle_ValueSchema& list);
00240
00241
00245 ValueType get_type() const;
00246
00247
00253 ValueType get_list_type() const;
00254
00257 int get_int() const;
00258
00261 bool get_bool() const;
00262
00265 double get_float() const;
00266
00269 Glib::ustring get_string() const;
00270
00271
00273 Schema get_schema() const;
00274
00275
00277 Value get_car() const;
00278
00280 Value get_cdr() const;
00281
00291 SListHandle_ValueFloat get_float_list() const;
00292
00297 SListHandle_ValueInt get_int_list() const;
00298
00303 SListHandle_ValueBool get_bool_list() const;
00304
00309 SListHandle_ValueString get_string_list() const;
00310
00315 SListHandle_ValueSchema get_schema_list() const;
00316
00322 Glib::ustring to_string() const;
00323
00324
00325 };
00326
00327 }
00328 }
00329
00330
00331 namespace Glib
00332 {
00333
00342 Gnome::Conf::Value wrap(GConfValue* object, bool take_copy = false);
00343
00344 }
00345
00346
00347 #endif
00348