1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GCONFMM_ENTRY_H
4 #define _GCONFMM_ENTRY_H
5 
6 
7 #include <glibmm.h>
8 
9 // -*- Mode: C++; c-basic-offset: 4  -*-
10 /* $Id: entry.hg,v 1.4 2002/12/10 23:26:01 murrayc Exp $ */
11 
12 /* entry.hg
13  *
14  * Copyright (C) 2000-2002 GConfmm Development Team
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2.1 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library; if not, write to the Free
28  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29  */
30 
31 #include <gconfmm/value.h>
32 #include <gconfmm/schema.h>
33 
34 
35 extern "C" {
36   typedef struct _GConfEntry GConfEntry;
37 }
38 
39 namespace Gnome
40 {
41 
42 namespace Conf
43 {
44 
45 /** An Entry stores an entry from a GConf "directory", including a
46  * key-value pair, the name of the Schema applicable to this entry,
47  * whether the value is a default value, and whether GConf can write
48  * a new value at this key. The key should be an absolute key, not a relative key.
49  */
50 class Entry
51 {
52   public:
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54   typedef Entry CppObjectType;
55   typedef GConfEntry BaseObjectType;
56 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
57 
58   Entry();
59 
60   // Use make_a_copy=true when getting it directly from a struct.
61   explicit Entry(GConfEntry* castitem, bool make_a_copy = false);
62 
63   Entry(const Entry& src);
64   Entry& operator=(const Entry& src);
65 
66   ~Entry();
67 
gobj()68   GConfEntry*       gobj()       { return gobject_; }
gobj()69   const GConfEntry* gobj() const { return gobject_; }
70 
71   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
72   GConfEntry* gobj_copy() const;
73 
74 protected:
75   GConfEntry* gobject_;
76 
77 private:
78 
79 
80 public:
81   /** Construct an Entry with the given @p key and @p value */
82   Entry(const Glib::ustring& key, const Value& value);
83 
84 
85   /** Set the Value of the entry.
86    */
87   void set_value(const Value& val);
88 
89 
90   /** Set the Schema name of the entry.
91    */
92   void set_schema_name(const Glib::ustring& val);
93 
94 
95   /** Set whether the value has orginated from the default given in the Schema
96    */
97   void set_is_default(bool is_default =  true);
98 
99 
100   /** Set whether the given configuration key iw writeable.
101    */
102   void set_is_writable(bool is_writable =  true);
103 
104   /** Retrieve the value of the entry.
105    * @return a copy the entry's value. */
106   Value get_value() const;
107 
108 
109   /** Retrieve the Schema name associated with the given entry
110    */
111   Glib::ustring get_schema_name() const;
112 
113   /* Retrieve the configuration key this entry points to */
114 
115   Glib::ustring get_key() const;
116 
117   /* Retrieve wether this Entry contains the default value, as defined in the Schema. */
118 
119   bool get_is_default() const;
120 
121   /* Get the writeable status of the configuration key of this entry. */
122 
123   bool get_is_writable() const;
124 
125 private:
126   static GConfEntry* entry_copy(const GConfEntry*);
127 
128 
129 };
130 
131 } /* namespace Conf */
132 } /* namespace Gnome */
133 
134 
135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
136 namespace Glib
137 {
138 namespace Container_Helpers
139 {
140 
141 template<>
142 struct TypeTraits<Gnome::Conf::Entry>
143 {
144     typedef Gnome::Conf::Entry CppType;
145     typedef const GConfEntry* CType;
146     typedef GConfEntry* CTypeNonConst;
147 
148     static CType   to_c_type      (const CppType& item) { return item.gobj(); }
149     static CType   to_c_type      (const CType&   item) { return item; }
150     static CppType to_cpp_type    (const CType&   item) { return Gnome::Conf::Entry(const_cast<CTypeNonConst>(item)); }
151     static void    release_c_type (const CType&)        {}
152 };
153 
154 } // Namespace Container_Helpers
155 } // namespace Glib
156 #endif // DOXYGEN_SHOULD_SKIP_THIS
157 
158 
159 namespace Glib
160 {
161 
162   /** A Glib::wrap() method for this object.
163    *
164    * @param object The C instance.
165    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
166    * @result A C++ instance that wraps this C instance.
167    *
168    * @relates Gnome::Conf::Entry
169    */
170 Gnome::Conf::Entry wrap(GConfEntry* object, bool take_copy = false);
171 
172 } // namespace Glib
173 
174 
175 #endif /* _GCONFMM_ENTRY_H */
176 
177