Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

value_listhelpers.h

Go to the documentation of this file.
00001 #ifndef GCONFMM_VALUE_LISTHELPERS_H 00002 #define GCONFMM_VALUE_LISTHELPERS_H 00003 // -*- Mode: C++; c-basic-offset: 4 -*- 00004 00005 /* value_listhelpers.ccg 00006 * 00007 * Copyright (C) 2000-2002 GConfmm Development Team 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Library General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public 00020 * License along with this library; if not, write to the Free 00021 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 } /* namespace Conf */ 00094 } /* namespace Gnome */ 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 template<> template<class Cont> 00108 struct SListSourceTraits<Gnome::Conf::ValueIntTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueIntTraits,Cont>{ 00109 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; 00110 }; 00111 template<> template<class Cont> 00112 struct SListSourceTraits<Gnome::Conf::ValueBoolTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueBoolTraits,Cont>{ 00113 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; 00114 }; 00115 template<> template<class Cont> 00116 struct SListSourceTraits<Gnome::Conf::ValueFloatTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueFloatTraits,Cont>{ 00117 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; 00118 }; 00119 template<> template<class Cont> 00120 struct SListSourceTraits<Gnome::Conf::ValueStringTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueStringTraits,Cont>{ 00121 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; 00122 }; 00123 template<> template<class Cont> 00124 struct SListSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont>{ 00125 static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; 00126 }; 00127 00128 #endif // DOXYGEN_SHOULD_SKIP_THIS 00129 00130 } 00131 } 00132 00133 #endif

Generated on Tue Jun 8 02:43:44 2004 for gconfmm by doxygen 1.3.7