GnuCash c935c2f+
Loading...
Searching...
No Matches
qofid.h
Go to the documentation of this file.
1/********************************************************************\
2 * qofid.h -- QOF entity type identification system *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20 * *
21\********************************************************************/
22
23#ifndef QOF_ID_H
24#define QOF_ID_H
25
76#include <string.h>
77#include "guid.h"
78
80typedef const gchar * QofIdType;
82typedef const gchar * QofIdTypeConst;
83
84typedef struct QofCollection_s QofCollection;
85
86#include "qofinstance.h"
87
88#ifdef __cplusplus
89extern "C"
90{
91#endif
92
93#define QOF_ID_NONE NULL
94#define QOF_ID_NULL "null"
95
96#define QOF_ID_BOOK "Book"
97#define QOF_ID_SESSION "Session"
98
99#define QSTRCMP g_strcmp0
100
102#define QOF_CHECK_TYPE(obj,type) (((obj) != NULL) && \
103 (0 == QSTRCMP((type),(((QofInstance *)(obj))->e_type))))
104
107#define QOF_CHECK_CAST(obj,e_type,c_type) ( \
108 QOF_CHECK_TYPE((obj),(e_type)) ? \
109 (c_type *) (obj) : \
110 (c_type *) ({ \
111 g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
112 "Error: Bad QofInstance at %s:%d", __FILE__, __LINE__); \
113 (obj); \
114 }))
115
116
130QofCollection * qof_collection_new (QofIdType type);
131
133guint qof_collection_count (const QofCollection *col);
134
136void qof_collection_destroy (QofCollection *col);
137
139QofIdType qof_collection_get_type (const QofCollection *);
140
142/*@ dependent @*/
143QofInstance * qof_collection_lookup_entity (const QofCollection *, const GncGUID *);
144
146typedef void (*QofInstanceForeachCB) (QofInstance *, gpointer user_data);
147
149void qof_collection_foreach_sorted (const QofCollection *col, QofInstanceForeachCB cb_func,
150 gpointer user_data, GCompareFunc sort_fn);
151
152void qof_collection_foreach (const QofCollection *, QofInstanceForeachCB,
153 gpointer user_data);
154
161gpointer qof_collection_get_data (const QofCollection *col);
162void qof_collection_set_data (QofCollection *col, gpointer user_data);
163
165gboolean qof_collection_is_dirty (const QofCollection *col);
166
187gboolean
188qof_collection_add_entity (QofCollection *coll, QofInstance *ent);
189
190void qof_collection_remove_entity (QofInstance *ent);
191
203gint
204qof_collection_compare (QofCollection *target, QofCollection *merge);
205
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* QOF_ID_H */
QofInstance * qof_collection_lookup_entity(const QofCollection *, const GncGUID *)
Find the entity going only from its guid.
Definition qofid.cpp:209
void(* QofInstanceForeachCB)(QofInstance *, gpointer user_data)
Callback type for qof_collection_foreach.
Definition qofid.h:146
void qof_collection_foreach_sorted(const QofCollection *col, QofInstanceForeachCB cb_func, gpointer user_data, GCompareFunc sort_fn)
Call the callback for each entity in the collection.
Definition qofid.cpp:283
const gchar * QofIdType
QofIdType declaration.
Definition qofid.h:80
guint qof_collection_count(const QofCollection *col)
return the number of entities in the collection.
Definition qofid.cpp:221
QofCollection * qof_collection_new(QofIdType type)
create a new collection of entities of type
Definition qofid.cpp:58
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
Definition qofid.h:82
void qof_collection_destroy(QofCollection *col)
destroy the collection
Definition qofid.cpp:64
gboolean qof_collection_is_dirty(const QofCollection *col)
Return value of 'dirty' flag on collection.
Definition qofid.cpp:232
gint qof_collection_compare(QofCollection *target, QofCollection *merge)
Compare two secondary collections.
Definition qofid.cpp:171
QofIdType qof_collection_get_type(const QofCollection *)
return the type that the collection stores
Definition qofid.cpp:73
gpointer qof_collection_get_data(const QofCollection *col)
Store and retrieve arbitrary object-defined data.
Definition qofid.cpp:266
gboolean qof_collection_add_entity(QofCollection *coll, QofInstance *ent)
Add an entity to a QOF_TYPE_COLLECT.
Definition qofid.cpp:109
globally unique ID User API
Object instance holds common fields that most gnucash objects use.
The type used to store guids in C.
Definition guid.h:75