The Gnome Chemistry Utils
0.14.0
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcu
macros.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
* Gnome Chemisty Utils
5
* macros.h
6
*
7
* Copyright (C) 2001-2011 Jean Bréfort <jean.brefort@normalesup.org>
8
*
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 3 of the
12
* License, or (at your option) any later version.
13
*
14
* This program 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
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22
* USA
23
*/
24
25
#ifndef GCU_MACROS_H
26
#define GCU_MACROS_H
27
28
#include <goffice/goffice.h>
29
50
#define GCU_PROP(type,member) \
51
public: \
52
void Set##member (type val) {m_##member = val;} \
53
type Get##member (void) const {return m_##member;} \
54
type &GetRef##member (void) {return m_##member;} \
55
private: \
56
type m_##member;
57
74
#define GCU_PROP_EX(type,member) \
75
public: \
76
void Set##member (type val) {m_##member = val; Changed##member ();} \
77
type Get##member (void) const {return m_##member;} \
78
private: \
79
void Changed##member (void); \
80
type m_##member;
81
96
#define GCU_POINTER_PROP(type,member) \
97
public: \
98
void Set##member (type *val) {m_##member = val;} \
99
type *Get##member (void) {return m_##member;} \
100
type const *Get##member (void) const {return m_##member;} \
101
private: \
102
type *m_##member;
103
117
#define GCU_RO_PROP(type,member) \
118
public: \
119
type Get##member (void) const {return m_##member;} \
120
private: \
121
type m_##member;
122
136
#define GCU_RO_STATIC_PROP(type,member) \
137
public: \
138
type Get##member (void) const {return m_##member;} \
139
private: \
140
static type m_##member;
141
155
#define GCU_RO_POINTER_PROP(type,member) \
156
public: \
157
type const *Get##member (void) const {return m_##member;} \
158
private: \
159
type *m_##member;
160
174
#define GCU_PROT_PROP(type,member) \
175
public: \
176
type Get##member (void) {return m_##member;} \
177
protected: \
178
type m_##member;
179
195
#define GCU_PROT_POINTER_PROP(type,member) \
196
public: \
197
type *Get##member (void) {return m_##member;} \
198
type const *Get##member (void) const {return m_##member;} \
199
protected: \
200
type *m_##member;
201
211
#define go_conf_get_float go_conf_get_double
212
#define GCU_GCONF_GET(key,type,target,defaultval) \
213
target = go_conf_get_##type (m_ConfNode, key); \
214
if (target == (type) 0) \
215
target = defaultval;
216
224
#define GCU_GCONF_GET_NO_CHECK(key,type,target,defaultval) \
225
target = go_conf_get_##type (m_ConfNode, key);
226
237
#define GCU_GCONF_GET_N_TRANSFORM(key,type,target,defaultval,func) \
238
{ \
239
type val = go_conf_get_##type (m_ConfNode, key); \
240
if (val == (type) 0) \
241
val = defaultval; \
242
target = func (val); \
243
}
244
254
#define GCU_GCONF_GET_STRING(key,target,defaultval) \
255
if (target) { \
256
g_free (target); \
257
target = NULL; \
258
} \
259
target = go_conf_get_string (m_ConfNode, key); \
260
if (target == NULL && defaultval) \
261
target = g_strdup (defaultval);
262
269
#define GCU_UPDATE_KEY(key,type,target,action) \
270
if (!strcmp (name, ROOTDIR key)) { \
271
target = go_conf_get_##type (node, ((node)? key: ROOTDIR key)); \
272
action \
273
return; \
274
}
275
282
#define GCU_UPDATE_STRING_KEY(key,target,action) \
283
if (!strcmp (name, ROOTDIR key)) { \
284
target = go_conf_get_string (node, ((node)? key: ROOTDIR key)); \
285
action \
286
return; \
287
}
288
289
#define CC2XML(x) reinterpret_cast <xmlChar const *> (x)
290
#define C2XML(x) reinterpret_cast <xmlChar *> (x)
291
#define XML2CC(x) reinterpret_cast <char const *> (x)
292
#define XML2C(x) reinterpret_cast <char *> (x)
293
294
#endif // GCU_MACROS_H
Generated on Tue Jan 1 2013 22:29:22 for The Gnome Chemistry Utils by
1.8.1.2