|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * gncJob.h -- the Core Job Interface * 00003 * * 00004 * This program is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU General Public License as * 00006 * published by the Free Software Foundation; either version 2 of * 00007 * the License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License* 00015 * along with this program; if not, contact: * 00016 * * 00017 * Free Software Foundation Voice: +1-617-542-5942 * 00018 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00019 * Boston, MA 02110-1301, USA gnu@gnu.org * 00020 * * 00021 \********************************************************************/ 00031 #ifndef GNC_JOB_H_ 00032 #define GNC_JOB_H_ 00033 00034 typedef struct _gncJob GncJob; 00035 typedef struct _gncJobClass GncJobClass; 00036 00037 #include "gncAddress.h" 00038 #include "gncOwner.h" 00039 00040 #define GNC_ID_JOB "gncJob" 00041 00042 /* --- type macros --- */ 00043 #define GNC_TYPE_JOB (gnc_job_get_type ()) 00044 #define GNC_JOB(o) \ 00045 (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_JOB, GncJob)) 00046 #define GNC_JOB_CLASS(k) \ 00047 (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_JOB, GncJobClass)) 00048 #define GNC_IS_JOB(o) \ 00049 (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_JOB)) 00050 #define GNC_IS_JOB_CLASS(k) \ 00051 (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_JOB)) 00052 #define GNC_JOB_GET_CLASS(o) \ 00053 (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_JOB, GncJobClass)) 00054 GType gnc_job_get_type(void); 00055 00056 /* Create/Destroy Functions */ 00057 00058 GncJob *gncJobCreate (QofBook *book); 00059 void gncJobDestroy (GncJob *job); 00060 00065 void gncJobSetID (GncJob *job, const char *id); 00066 void gncJobSetName (GncJob *job, const char *jobname); 00067 void gncJobSetReference (GncJob *job, const char *owner_reference); 00068 void gncJobSetOwner (GncJob *job, GncOwner *owner); 00069 void gncJobSetActive (GncJob *job, gboolean active); 00070 00072 void gncJobBeginEdit (GncJob *job); 00073 void gncJobCommitEdit (GncJob *job); 00074 00079 const char * gncJobGetID (const GncJob *job); 00080 const char * gncJobGetName (const GncJob *job); 00081 const char * gncJobGetReference (const GncJob *job); 00082 GncOwner * gncJobGetOwner (GncJob *job); 00083 gboolean gncJobGetActive (const GncJob *job); 00084 00093 static inline GncJob * gncJobLookup (const QofBook *book, const GncGUID *guid) 00094 { 00095 QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_JOB, GncJob); 00096 } 00097 00098 /* Other functions */ 00099 00100 int gncJobCompare (const GncJob *a, const GncJob *b); 00101 gboolean gncJobEqual(const GncJob *a, const GncJob *b); 00102 00103 #define JOB_ID "id" 00104 #define JOB_NAME "name" 00105 #define JOB_REFERENCE "reference" 00106 #define JOB_OWNER "owner" 00107 #define Q_JOB_OWNER "owner_collection" 00108 #define JOB_ACTIVE "active" 00109 00111 #define gncJobGetBook(x) qof_instance_get_book(QOF_INSTANCE(x)) 00112 #define gncJobGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x)) 00113 #define gncJobRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())) 00114 #define gncJobLookupDirect(G,B) gncJobLookup((B),&(G)) 00115 00116 #endif /* GNC_JOB_H_ */ 00117
1.7.4