gconfmm  2.28.0
changeset.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GCONFMM_CHANGESET_H
4 #define _GCONFMM_CHANGESET_H
5 
6 
7 #include <glibmm.h>
8 
9 // -*- Mode: C++; c-basic-offset: 4 -*-
10 /* $Id: changeset.hg,v 1.4 2006/06/05 17:54:23 murrayc Exp $ */
11 
12 /* changeset.hg
13  *
14  * Copyright (C) 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 <glibmm/ustring.h>
32 #include <gconfmm/value.h>
33 #include <gconfmm/setinterface.h>
34 #include <sigc++/slot.h>
35 
36 
37 extern "C" {
38  typedef struct _GConfChangeSet GConfChangeSet;
39 }
40 
41 namespace Gnome
42 {
43 namespace Conf
44 {
45 
46 
57 class ChangeSet : public SetInterface
58 {
59  public:
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61  typedef ChangeSet CppObjectType;
62  typedef GConfChangeSet BaseObjectType;
63 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
64 
65 private:
66 
67 
68 public:
69  ChangeSet();
70  explicit ChangeSet(GConfChangeSet* castitem, bool make_a_copy = false);
71 
72  ChangeSet(const ChangeSet& src);
73  ChangeSet& operator=(const ChangeSet& src);
74  virtual ~ChangeSet();
75 
76  GConfChangeSet* gobj() { return gobject_; }
77  const GConfChangeSet* gobj() const { return gobject_; }
78  GConfChangeSet* gobj_copy() const;
79 
80 protected:
82 
83 public:
87  void clear();
88 
91  unsigned int size() const;
92 
96  void remove(const Glib::ustring& key);
97 
101  Value* exists(const Glib::ustring& key) const;
102 
103 
107  void unset(const Glib::ustring& key);
108 
109  //Hand-code these, because we need to ignore the Glib::Error argument when using --enable-api-exceptions=no:
110  //We must match the virtual method signatures in SetInterface, even though these implementations of that
111  //interface do not actually throw exceptions.
112  //_WRAP_METHOD(void set(const Glib::ustring& key, bool what), gconf_change_set_set_bool)
113  //_WRAP_METHOD(void set(const Glib::ustring& key, int what), gconf_change_set_set_int)
114  //_WRAP_METHOD(void set(const Glib::ustring& key, double what), gconf_change_set_set_float)
115  //_WRAP_METHOD(void set(const Glib::ustring& key, const Glib::ustring& what), gconf_change_set_set_string)
116  //_WRAP_METHOD(void set(const Glib::ustring& key, const Schema& val), gconf_change_set_set_schema)
117  //_WRAP_METHOD(void set(const Glib::ustring& key, const Value& what), gconf_change_set_set)
118 
119 
120  #ifdef GLIBMM_EXCEPTIONS_ENABLED
121  virtual void set(const Glib::ustring& key, const Value& value);
122  virtual void set(const Glib::ustring& key, bool what);
123  virtual void set(const Glib::ustring& key, int what);
124  virtual void set(const Glib::ustring& key, double what);
125  virtual void set(const Glib::ustring& key, const Glib::ustring& what);
126  virtual void set(const Glib::ustring& key, const Schema& what);
127  #else
128  virtual void set(const Glib::ustring& key, const Value& value, std::auto_ptr<Glib::Error>& error);
129  virtual void set(const Glib::ustring& key, bool what, std::auto_ptr<Glib::Error>& error);
130  virtual void set(const Glib::ustring& key, int what, std::auto_ptr<Glib::Error>& error);
131  virtual void set(const Glib::ustring& key, double what, std::auto_ptr<Glib::Error>& error);
132  virtual void set(const Glib::ustring& key, const Glib::ustring& what, std::auto_ptr<Glib::Error>& error);
133  virtual void set(const Glib::ustring& key, const Schema& what, std::auto_ptr<Glib::Error>& error);
134  #endif //GLIBMM_EXCEPTIONS_ENABLED
135 
136 
137  typedef sigc::slot<void, const Glib::ustring&, const Value&> ForeachSlot;
142  void for_each(const ForeachSlot& slot);
143 
144 private:
145  static GConfChangeSet* do_ref(GConfChangeSet*);
146 
147 
148 };
149 
150 
151 } // namespace Conf
152 } // namespace Gnome
153 
154 
155 #endif /* _GCONFMM_CHANGESET_H */
156 
Definition: schema.h:47
Definition: callback.h:33
GConfChangeSet * gobject_
Definition: changeset.h:81
struct _GConfChangeSet GConfChangeSet
Definition: changeset.h:38
Value * exists(const Glib::ustring &key) const
Check whether the given key will be modified by a commit operation.
sigc::slot< void, const Glib::ustring &, const Value & > ForeachSlot
Definition: changeset.h:137
void clear()
Clear all entries.
virtual void set(const Glib::ustring &key, const Value &value)
unsigned int size() const
Returns the number of keys in the changeset.
GConfChangeSet * gobj()
Definition: changeset.h:76
Wrapper for primitive types.
Definition: value.h:141
A ChangeSet is a set of changes to the GConf database that can be commited and reversed easily...
Definition: changeset.h:57
GConfChangeSet * gobj_copy() const
void for_each(const ForeachSlot &slot)
Iterate over the keys marked in this ChangeSet.
ChangeSet & operator=(const ChangeSet &src)
Common Interface for key-value settable objects.
Definition: setinterface.h:47
const GConfChangeSet * gobj() const
Definition: changeset.h:77
void unset(const Glib::ustring &key)
Unset the given key.