GnuCash  5.6-150-g038405b370+
gncJob.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gncJob.h -- the Core Job Interface *
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 \********************************************************************/
31 #ifndef GNC_JOB_H_
32 #define GNC_JOB_H_
33 
34 typedef struct _gncJob GncJob;
35 typedef struct _gncJobClass GncJobClass;
36 
37 #include "gncAddress.h"
38 #include "gncOwner.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #define GNC_ID_JOB "gncJob"
45 
46 /* --- type macros --- */
47 #define GNC_TYPE_JOB (gnc_job_get_type ())
48 #define GNC_JOB(o) \
49  (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_JOB, GncJob))
50 #define GNC_JOB_CLASS(k) \
51  (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_JOB, GncJobClass))
52 #define GNC_IS_JOB(o) \
53  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_JOB))
54 #define GNC_IS_JOB_CLASS(k) \
55  (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_JOB))
56 #define GNC_JOB_GET_CLASS(o) \
57  (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_JOB, GncJobClass))
58 GType gnc_job_get_type(void);
59 
60 /* Create/Destroy Functions */
61 
62 GncJob *gncJobCreate (QofBook *book);
63 void gncJobDestroy (GncJob *job);
64 void gncJobFreeList (GList *jobs);
65 
70 void gncJobSetID (GncJob *job, const char *id);
71 void gncJobSetName (GncJob *job, const char *jobname);
72 void gncJobSetReference (GncJob *job, const char *owner_reference);
73 void gncJobSetRate (GncJob *job, gnc_numeric rate);
74 void gncJobSetOwner (GncJob *job, GncOwner *owner);
75 void gncJobSetActive (GncJob *job, gboolean active);
76 
78 void gncJobBeginEdit (GncJob *job);
79 void gncJobCommitEdit (GncJob *job);
80 
85 const char * gncJobGetID (const GncJob *job);
86 const char * gncJobGetName (const GncJob *job);
87 const char * gncJobGetReference (const GncJob *job);
88 gnc_numeric gncJobGetRate (const GncJob *job);
89 GncOwner * gncJobGetOwner (GncJob *job);
90 gboolean gncJobGetActive (const GncJob *job);
91 
98 static inline GncJob * gncJobLookup (const QofBook *book, const GncGUID *guid)
99 {
100  QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_JOB, GncJob);
101 }
102 
103 /* Other functions */
104 
105 int gncJobCompare (const GncJob *a, const GncJob *b);
106 gboolean gncJobEqual(const GncJob *a, const GncJob *b);
107 
108 #define JOB_ID "id"
109 #define JOB_NAME "name"
110 #define JOB_REFERENCE "reference"
111 #define JOB_RATE "rate"
112 #define JOB_OWNER "owner"
113 #define Q_JOB_OWNER "owner_collection"
114 #define JOB_ACTIVE "active"
115 
117 #define gncJobGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
118 #define gncJobGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
119 #define gncJobRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
120 #define gncJobLookupDirect(G,B) gncJobLookup((B),&(G))
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* GNC_JOB_H_ */
127 
Business Interface: Object OWNERs.
#define QOF_BOOK_RETURN_ENTITY(book, guid, e_type, c_type)
Encapsulates all the information about a dataset manipulated by QOF.
Definition: qofbook.h:186
Definition: gncJob.c:41
an Address object
The type used to store guids in C.
Definition: guid.h:75