~vcs-imports/gconfmm/main

« back to all changes in this revision

Viewing changes to gconf/src/entry.hg

  • Committer: murrayc
  • Date: 2007-01-09 15:43:50 UTC
  • Revision ID: vcs-imports@canonical.com-20070109154350-lczyek6p0f2bqgva
moving

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; c-basic-offset: 4  -*-
 
2
/* $Id: entry.hg,v 1.4 2002/12/10 23:26:01 murrayc Exp $ */
 
3
 
 
4
/* entry.hg
 
5
 * 
 
6
 * Copyright (C) 2000-2002 GConfmm Development Team
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Library General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Library General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Library General Public
 
19
 * License along with this library; if not, write to the Free
 
20
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
 */
 
22
 
 
23
#include <gconfmm/value.h>
 
24
#include <gconfmm/schema.h>
 
25
 
 
26
_DEFS(gconfmm,gconf)
 
27
 
 
28
extern "C" {
 
29
  typedef struct _GConfEntry GConfEntry;
 
30
}
 
31
 
 
32
namespace Gnome
 
33
{
 
34
 
 
35
namespace Conf
 
36
{
 
37
 
 
38
/** An Entry stores an entry from a GConf "directory", including a 
 
39
 * key-value pair, the name of the Schema applicable to this entry, 
 
40
 * whether the value is a default value, and whether GConf can write 
 
41
 * a new value at this key. The key should be an absolute key, not a relative key.
 
42
 */
 
43
class Entry
 
44
{
 
45
  _CLASS_OPAQUE_COPYABLE(Entry,GConfEntry,NONE,entry_copy,gconf_entry_free)
 
46
  _IGNORE(gconf_entry_free, gconf_entry_new, gconf_entry_new_nocopy)
 
47
  _IGNORE(gconf_entry_equal, gconf_entry_set_value_nocopy)
 
48
  _IGNORE(gconf_entry_steal_value)
 
49
 
 
50
public:
 
51
  /** Construct an Entry with the given @p key and @p value */
 
52
  Entry(const Glib::ustring& key, const Value& value);
 
53
 
 
54
  /** Set the Value of the entry. */
 
55
  _WRAP_METHOD(void set_value(const Value& val), gconf_entry_set_value)
 
56
 
 
57
  /** Set the Schema name of the entry. */
 
58
  _WRAP_METHOD(void set_schema_name(const Glib::ustring& val), gconf_entry_set_schema_name)
 
59
 
 
60
  /** Set whether the value has orginated from the default given in the Schema */
 
61
  _WRAP_METHOD(void set_is_default(bool is_default = true), gconf_entry_set_is_default)
 
62
 
 
63
  /** Set whether the given configuration key iw writeable. */
 
64
  _WRAP_METHOD(void set_is_writable(bool is_writable = true), gconf_entry_set_is_writable)
 
65
 
 
66
  /** Retrieve the value of the entry.
 
67
   * @return a copy the entry's value. */
 
68
  Value get_value() const;
 
69
  _IGNORE(gconf_entry_get_value)
 
70
 
 
71
  /** Retrieve the Schema name associated with the given entry */
 
72
  _WRAP_METHOD(Glib::ustring get_schema_name() const, gconf_entry_get_schema_name)
 
73
 
 
74
  /* Retrieve the configuration key this entry points to */
 
75
  _WRAP_METHOD(Glib::ustring get_key() const, gconf_entry_get_key)
 
76
 
 
77
  /* Retrieve wether this Entry contains the default value, as defined in the Schema. */
 
78
  _WRAP_METHOD(bool get_is_default() const, gconf_entry_get_is_default)
 
79
 
 
80
  /* Get the writeable status of the configuration key of this entry. */
 
81
  _WRAP_METHOD(bool get_is_writable() const, gconf_entry_get_is_writable)
 
82
 
 
83
private:
 
84
  static GConfEntry* entry_copy(const GConfEntry*);
 
85
};
 
86
 
 
87
} /* namespace Conf */
 
88
} /* namespace Gnome */
 
89
 
 
90
 
 
91
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
92
namespace Glib
 
93
{
 
94
namespace Container_Helpers
 
95
{
 
96
 
 
97
template<>
 
98
struct TypeTraits<Gnome::Conf::Entry> 
 
99
{
 
100
    typedef Gnome::Conf::Entry CppType;
 
101
    typedef const GConfEntry* CType;
 
102
    typedef GConfEntry* CTypeNonConst;
 
103
    
 
104
    static CType   to_c_type      (const CppType& item) { return item.gobj(); }
 
105
    static CType   to_c_type      (const CType&   item) { return item; }
 
106
    static CppType to_cpp_type    (const CType&   item) { return Gnome::Conf::Entry(const_cast<CTypeNonConst>(item)); }
 
107
    static void    release_c_type (const CType&)        {}
 
108
};
 
109
 
 
110
} // Namespace Container_Helpers
 
111
} // namespace Glib
 
112
#endif // DOXYGEN_SHOULD_SKIP_THIS