00001 #ifndef GCONFMM_VALUE_LISTHELPERS_H
00002 #define GCONFMM_VALUE_LISTHELPERS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 extern "C" {
00025 typedef struct _GConfValue GConfValue;
00026 }
00027
00028 namespace Gnome
00029 {
00030 namespace Conf
00031 {
00032
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034
00035 class Schema;
00036 class Value;
00037
00038 struct ValueTraits
00039 {
00040 typedef GConfValue* CType;
00041 typedef GConfValue* CTypeNonConst;
00042
00043 static CType to_c_type (CType ptr) { return ptr; }
00044 static void release_c_type (CType ptr);
00045 };
00046
00047 struct ValueSchemaTraits : public ValueTraits
00048 {
00049 typedef Schema CppType;
00050
00051 static CType to_c_type (const CppType& ptr);
00052 static CppType to_cpp_type (CType ptr);
00053 };
00054 typedef Glib::SListHandle< Schema, ValueSchemaTraits > SListHandle_ValueSchema;
00055
00056 struct ValueStringTraits : public ValueTraits
00057 {
00058 typedef Glib::ustring CppType;
00059
00060 static CType to_c_type (const CppType& ptr);
00061 static CppType to_cpp_type (CType ptr);
00062 };
00063 typedef Glib::SListHandle< Glib::ustring, ValueStringTraits > SListHandle_ValueString;
00064
00065 struct ValueIntTraits : public ValueTraits
00066 {
00067 typedef int CppType;
00068
00069 static CType to_c_type (const CppType& ptr);
00070 static CppType to_cpp_type (CType ptr);
00071 };
00072 typedef Glib::SListHandle< int, ValueIntTraits > SListHandle_ValueInt;
00073
00074 struct ValueBoolTraits : public ValueTraits
00075 {
00076 typedef bool CppType;
00077
00078 static CType to_c_type (const CppType& ptr);
00079 static CppType to_cpp_type (CType ptr);
00080 };
00081 typedef Glib::SListHandle< bool, ValueBoolTraits > SListHandle_ValueBool;
00082
00083 struct ValueFloatTraits : public ValueTraits
00084 {
00085 typedef double CppType;
00086
00087 static CType to_c_type (const CppType& ptr);
00088 static CppType to_cpp_type (CType ptr);
00089 };
00090 typedef Glib::SListHandle< double, ValueFloatTraits > SListHandle_ValueFloat;
00091
00092
00093 }
00094 }
00095
00096 namespace Glib
00097 {
00098 namespace Container_Helpers
00099 {
00100 template<class Tr,class Cont>
00101 struct ValueSourceTraits {
00102 static GSList* get_data(const Cont& cont) {
00103 return Glib::Container_Helpers::create_slist(cont.begin(), cont.end(), Tr());
00104 }
00105 };
00106
00107
00108 template<class Cont>
00109 struct SListSourceTraits<Gnome::Conf::ValueIntTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueIntTraits,Cont>{
00110 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
00111 };
00112 template<class Cont>
00113 struct SListSourceTraits<Gnome::Conf::ValueBoolTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueBoolTraits,Cont>{
00114 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
00115 };
00116 template<class Cont>
00117 struct SListSourceTraits<Gnome::Conf::ValueFloatTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueFloatTraits,Cont>{
00118 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
00119 };
00120 template<class Cont>
00121 struct SListSourceTraits<Gnome::Conf::ValueStringTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueStringTraits,Cont>{
00122 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
00123 };
00124 template<class Cont>
00125 struct SListSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont>{
00126 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
00127 };
00128
00129 #endif // DOXYGEN_SHOULD_SKIP_THIS
00130
00131 }
00132 }
00133
00134 #endif