gconfmm  2.28.0
value_listhelpers.h
Go to the documentation of this file.
1 #ifndef GCONFMM_VALUE_LISTHELPERS_H
2 #define GCONFMM_VALUE_LISTHELPERS_H
3 // -*- Mode: C++; c-basic-offset: 4 -*-
4 
5 /* value_listhelpers.ccg
6  *
7  * Copyright (C) 2000-2002 GConfmm Development Team
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free
21  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23 
24 extern "C" {
25  typedef struct _GConfValue GConfValue;
26 }
27 
28 namespace Gnome
29 {
30 namespace Conf
31 {
32 
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 
35 class Schema;
36 class Value;
37 
38 struct ValueTraits
39 {
40  typedef GConfValue* CType;
41  typedef GConfValue* CTypeNonConst;
42 
43  static CType to_c_type (CType ptr) { return ptr; }
44  static void release_c_type (CType ptr);
45 };
46 
47 struct ValueSchemaTraits : public ValueTraits
48 {
49  typedef Schema CppType;
50 
51  static CType to_c_type (const CppType& ptr);
52  static CppType to_cpp_type (CType ptr);
53 };
54 typedef Glib::SListHandle< Schema, ValueSchemaTraits > SListHandle_ValueSchema;
55 
56 struct ValueStringTraits : public ValueTraits
57 {
58  typedef Glib::ustring CppType;
59 
60  static CType to_c_type (const CppType& ptr);
61  static CppType to_cpp_type (CType ptr);
62 };
63 typedef Glib::SListHandle< Glib::ustring, ValueStringTraits > SListHandle_ValueString;
64 
65 struct ValueIntTraits : public ValueTraits
66 {
67  typedef int CppType;
68 
69  static CType to_c_type (const CppType& ptr);
70  static CppType to_cpp_type (CType ptr);
71 };
72 typedef Glib::SListHandle< int, ValueIntTraits > SListHandle_ValueInt;
73 
74 struct ValueBoolTraits : public ValueTraits
75 {
76  typedef bool CppType;
77 
78  static CType to_c_type (const CppType& ptr);
79  static CppType to_cpp_type (CType ptr);
80 };
81 typedef Glib::SListHandle< bool, ValueBoolTraits > SListHandle_ValueBool;
82 
83 struct ValueFloatTraits : public ValueTraits
84 {
85  typedef double CppType;
86 
87  static CType to_c_type (const CppType& ptr);
88  static CppType to_cpp_type (CType ptr);
89 };
90 typedef Glib::SListHandle< double, ValueFloatTraits > SListHandle_ValueFloat;
91 
92 
93 } /* namespace Conf */
94 } /* namespace Gnome */
95 
96 namespace Glib
97 {
98 namespace Container_Helpers
99 {
100 template<class Tr,class Cont>
101 struct ValueSourceTraits {
102  static GSList* get_data(const Cont& cont) {
103  return Glib::Container_Helpers::create_slist(cont.begin(), cont.end(), Tr());
104  }
105 };
106 
107 //partial template specializations:
108 template<class Cont>
109 struct SListSourceTraits<Gnome::Conf::ValueIntTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueIntTraits,Cont>{
110  static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
111 };
112 template<class Cont>
113 struct SListSourceTraits<Gnome::Conf::ValueBoolTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueBoolTraits,Cont>{
114  static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
115 };
116 template<class Cont>
117 struct SListSourceTraits<Gnome::Conf::ValueFloatTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueFloatTraits,Cont>{
118  static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
119 };
120 template<class Cont>
121 struct SListSourceTraits<Gnome::Conf::ValueStringTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueStringTraits,Cont>{
122  static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
123 };
124 template<class Cont>
125 struct SListSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont> : ValueSourceTraits<Gnome::Conf::ValueSchemaTraits,Cont>{
126  static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
127 };
128 
129 #endif // DOXYGEN_SHOULD_SKIP_THIS
130 
131 }
132 }
133 
134 #endif
Definition: client.h:910
Definition: callback.h:33
struct _GConfValue GConfValue
Definition: value_listhelpers.h:25