macros.h File Reference
#include <gconf/gconf-client.h>
Go to the source code of this file.
|
Defines |
#define | GCU_PROP(type, member) |
#define | GCU_POINTER_PROP(type, member) |
#define | GCU_RO_PROP(type, member) |
#define | GCU_RO_POINTER_PROP(type, member) |
#define | GCU_PROT_PROP(type, member) |
#define | GCU_PROT_POINTER_PROP(type, member) |
#define | GCU_GCONF_GET(key, type, target, defaultval) |
#define | GCU_GCONF_GET_NO_CHECK(key, type, target, defaultval) |
#define | GCU_GCONF_GET_N_TRANSFORM(key, type, target, defaultval, func) |
#define | GCU_GCONF_GET_STRING(key, target, defaultval) |
#define | GCU_UPDATE_KEY(key, type, target, action) |
#define | GCU_UPDATE_STRING_KEY(key, target, action) |
Detailed Description
Definition in file macros.h.
Define Documentation
#define GCU_GCONF_GET |
( |
key, |
|
|
type, |
|
|
target, |
|
|
defaultval |
|
) |
|
Value:
target = gconf_client_get_##type (m_ConfClient, ROOTDIR key, &error); \
if (error) { \
target = defaultval; \
g_message ("GConf failed: %s", error->message); \
g_error_free (error); \
error = NULL; \
} \
if (target == (type) 0) \
target = defaultval;
This macro gets the numerical value of type
type associated to
key, and copies it to
target. If an error occurs or if the value is 0,
defaultval is used instead.
If the GOConf mechanism is available in goffice (>= 0.7.0), calling class must have a GOConfNode called m_ConfNode or, for older GOffice versions, a GConfClient member called m_ConfClient, and the code must provide a GError *error initially set to NULL (GConf version only). The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 180 of file macros.h.
#define GCU_GCONF_GET_N_TRANSFORM |
( |
key, |
|
|
type, |
|
|
target, |
|
|
defaultval, |
|
|
func |
|
) |
|
Value:
{ \
type val = gconf_client_get_##type (m_ConfClient, ROOTDIR key, &error); \
if (error) { \
val = defaultval; \
g_message ("GConf failed: %s", error->message); \
g_error_free (error); \
error = NULL; \
} \
if (val == (type) 0) \
val = defaultval; \
target = func (val); \
}
This macro gets the numerical value of type
type associated to
key. If an error occurs or if the value is 0,
defaultval is used instead.
The resuting value (which might be the default value) is then passed to
func and the result is copied to
target.
If the GOConf mechanism is available in goffice (>= 0.7.0), calling class must have a GOConfNode called m_ConfNode or, for older GOffice versions, a GConfClient member called m_ConfClient, and the code must provide a GError *error initially set to NULL (GConf version only). The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 234 of file macros.h.
#define GCU_GCONF_GET_NO_CHECK |
( |
key, |
|
|
type, |
|
|
target, |
|
|
defaultval |
|
) |
|
Value:
target = gconf_client_get_##type (m_ConfClient, ROOTDIR key, &error); \
if (error) { \
target = defaultval; \
g_message ("GConf failed: %s", error->message); \
g_error_free (error); \
error = NULL; \
}
This macro gets the numerical value of type
type associated to
key, and copies it to
target. If an error occurs,
defaultval is used instead.
If the GOConf mechanism is available in goffice (>= 0.7.0), calling class must have a GOConfNode called m_ConfNode or, for older GOffice versions, a GConfClient member called m_ConfClient, and the code must provide a GError *error initially set to NULL (GConf version only). The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 204 of file macros.h.
#define GCU_GCONF_GET_STRING |
( |
key, |
|
|
target, |
|
|
defaultval |
|
) |
|
Value:
if (target) { \
g_free (target); \
target = NULL; \
} \
target = gconf_client_get_string (m_ConfClient, ROOTDIR key, &error); \
if (error) { \
if (defaultval) \
target = g_strdup (defaultval); \
g_message ("GConf failed: %s", error->message); \
g_error_free (error); \
error = NULL; \
} else if (target == NULL && defaultval) \
target = g_strdup (defaultval);
This macro gets the string value associated to
key, and copies it to
target. If an error occurs,
defaultval is used instead.
If
target is not NULL when entering the macro, it is deallocated using g_free and set to NULL before calling gconf_client_get_string.
Calling class must have a GConfClient member called m_ConfClient, and the code must provide a GError *error initially set to NULL. The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 268 of file macros.h.
#define GCU_POINTER_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
void Set##member (type *val) {m_##member = val;} \
type *Get##member (void) {return m_##member;} \
type const *Get##member (void) const {return m_##member;} \
private: \
type *m_##member;
Defines a private pointer member with appropriate get/set methods. GCU_POINTER_PROP((Type,Foo) expands to one private member:
and three public methods:
void SetFoo(Type *val);
Type *GetFoo();
Type const *GetFoo() const;
Definition at line 76 of file macros.h.
#define GCU_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
void Set##member (type val) {m_##member = val;} \
type Get##member (void) const {return m_##member;} \
type &GetRef##member (void) {return m_##member;} \
private: \
type m_##member;
Defines a private member with appropriate get/set methods. GCU_PROP((Type,Foo) expands to one private member:
and three public methods:
void SetFoo(Type val);
Type GetFoo();
Type& GetRefFoo();
The last one allows code as:
Definition at line 54 of file macros.h.
#define GCU_PROT_POINTER_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
type *Get##member (void) {return m_##member;} \
type const *Get##member (void) const {return m_##member;} \
protected: \
type *m_##member;
Defines a private pointer member with an appropriate get method. The member can be modified the class it belongs too or a friend class or a derived class. The data referenced by the pointer can be modified if the class instance is not const. GCU_PROT_POINTER_PROP((Type,Foo) expands to one private member:
and two public methods:
Type *GetFoo();
Type const *GetFoo() const;
Definition at line 156 of file macros.h.
#define GCU_PROT_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
type Get##member (void) {return m_##member;} \
protected: \
type m_##member;
Defines a protected member with an appropriate get method. The member can be modified the class it belongs too or a friend class or a derived class.
GCU_PROT_PROP(Type,Foo) expands to one protected member:
and one public method:
Definition at line 135 of file macros.h.
#define GCU_RO_POINTER_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
type const *Get##member (void) const {return m_##member;} \
private: \
type *m_##member;
Defines a private pointer member an with appropriate get method. RO stands for Read Only. The member can't be modified from outside the class it belongs too or a friend class. GCU_RO_POINTER_PROP((Type,Foo) expands to one private member:
and one public methods:
Type const *GetFoo() const;
Definition at line 116 of file macros.h.
#define GCU_RO_PROP |
( |
type, |
|
|
member |
|
) |
|
Value:
public: \
type Get##member (void) const {return m_##member;} \
private: \
type m_##member;
Defines a private member with an appropriate get method. RO stands for Read Only. The member can't be modified from outside the class it belongs too or a friend class.
GCU_RO_PROP(Type,Foo) expands to one private member:
and one public method:
Definition at line 97 of file macros.h.
#define GCU_UPDATE_KEY |
( |
key, |
|
|
type, |
|
|
target, |
|
|
action |
|
) |
|
Value:
if (!strcmp (gconf_entry_get_key (entry), ROOTDIR key)) { \
target = gconf_value_get_##type (gconf_entry_get_value (entry)); \
action \
return; \
}
This macro updates a value of type
type associated to
key, and copies it to
target.
action is called after setting the target? It also needs either a GOConfNode* called node or a GConfEntry alled entry, depending on the GOffice library version. The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 299 of file macros.h.
#define GCU_UPDATE_STRING_KEY |
( |
key, |
|
|
target, |
|
|
action |
|
) |
|
Value:
if (!strcmp (gconf_entry_get_key (entry), ROOTDIR key)) { \
target = g_strdup (gconf_value_get_string (gconf_entry_get_value (entry))); \
action \
return; \
}
This macro updates a string value associated to
key, and copies it to
target.
action is called after setting the target? It also needs either a GOConfNode* called node or a GConfEntry alled entry, depending on the GOffice library version. The real key is obtained by appending the value of ROOTDIR to
key.
Definition at line 322 of file macros.h.