2003-10-13 09:25:02 -05:00
|
|
|
/********************************************************************\
|
|
|
|
* gncJob.h -- the Core Job Interface *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License*
|
|
|
|
* along with this program; if not, contact: *
|
|
|
|
* *
|
|
|
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
|
|
|
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02111-1307, USA gnu@gnu.org *
|
|
|
|
* *
|
|
|
|
\********************************************************************/
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/*
|
2002-01-22 09:51:14 -06:00
|
|
|
* Copyright (C) 2001, 2002 Derek Atkins
|
2001-11-16 19:17:06 -06:00
|
|
|
* Author: Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GNC_JOB_H_
|
|
|
|
#define GNC_JOB_H_
|
|
|
|
|
|
|
|
typedef struct _gncJob GncJob;
|
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#include "qofid.h"
|
|
|
|
#include "qofinstance.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
#include "gncAddress.h"
|
2002-01-22 09:51:14 -06:00
|
|
|
#include "gncOwner.h"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
#define GNC_ID_JOB "gncJob"
|
|
|
|
#define GNC_IS_JOB(obj) (QOF_CHECK_TYPE((obj), GNC_ID_JOB))
|
|
|
|
#define GNC_JOB(obj) (QOF_CHECK_CAST((obj), GNC_ID_JOB, GncJob))
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
/* Create/Destroy Functions */
|
|
|
|
|
2003-06-26 22:05:25 -05:00
|
|
|
GncJob *gncJobCreate (QofBook *book);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncJobDestroy (GncJob *job);
|
|
|
|
|
|
|
|
/* Set Functions */
|
|
|
|
|
|
|
|
void gncJobSetID (GncJob *job, const char *id);
|
2002-01-22 11:16:02 -06:00
|
|
|
void gncJobSetName (GncJob *job, const char *jobname);
|
|
|
|
void gncJobSetReference (GncJob *job, const char *owner_reference);
|
2002-01-22 09:51:14 -06:00
|
|
|
void gncJobSetOwner (GncJob *job, GncOwner *owner);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncJobSetActive (GncJob *job, gboolean active);
|
|
|
|
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncJobBeginEdit (GncJob *job);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncJobCommitEdit (GncJob *job);
|
|
|
|
|
|
|
|
/* Get Functions */
|
|
|
|
|
|
|
|
const char * gncJobGetID (GncJob *job);
|
|
|
|
const char * gncJobGetName (GncJob *job);
|
2002-01-22 11:16:02 -06:00
|
|
|
const char * gncJobGetReference (GncJob *job);
|
2002-01-22 09:51:14 -06:00
|
|
|
GncOwner * gncJobGetOwner (GncJob *job);
|
2001-11-16 19:17:06 -06:00
|
|
|
gboolean gncJobGetActive (GncJob *job);
|
|
|
|
gboolean gncJobIsDirty (GncJob *job);
|
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
/** Return a pointer to the instance gncJob that is identified
|
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
|
|
|
* instance can't be found.
|
|
|
|
* Equivalent function prototype is
|
|
|
|
* GncJob * gncJobLookup (QofBook *book, const GUID *guid);
|
|
|
|
*/
|
|
|
|
#define gncJobLookup(book,guid) \
|
|
|
|
QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_JOB, GncJob)
|
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
/* Other functions */
|
|
|
|
|
2002-02-04 12:54:06 -06:00
|
|
|
int gncJobCompare (const GncJob *a, const GncJob *b);
|
|
|
|
|
|
|
|
#define JOB_ID "id"
|
|
|
|
#define JOB_NAME "name"
|
|
|
|
#define JOB_REFERENCE "reference"
|
|
|
|
#define JOB_OWNER "owner"
|
2002-05-09 16:35:24 -05:00
|
|
|
#define JOB_ACTIVE "active"
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-13 09:25:02 -05:00
|
|
|
/** deprecated functions */
|
|
|
|
#define gncJobGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
|
|
|
|
#define gncJobGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
|
2003-10-16 23:32:04 -05:00
|
|
|
#define gncJobRetGUID(x) (*(qof_instance_get_guid(QOF_INSTANCE(x))))
|
|
|
|
#define gncJobLookupDirect(G,B) gncJobLookup((B),&(G))
|
2003-10-13 09:25:02 -05:00
|
|
|
|
2001-11-16 19:17:06 -06:00
|
|
|
#endif /* GNC_JOB_H_ */
|