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 *
|
2005-11-16 23:35:02 -06:00
|
|
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
|
|
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
2003-10-13 09:25:02 -05:00
|
|
|
* *
|
|
|
|
\********************************************************************/
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @addtogroup Business
|
|
|
|
@{ */
|
|
|
|
/** @addtogroup Job
|
|
|
|
@{ */
|
|
|
|
/** @file gncJob.h
|
|
|
|
@brief Job Interface
|
|
|
|
@author Copyright (C) 2001, 2002 Derek Atkins <warlord@MIT.EDU>
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
#ifndef GNC_JOB_H_
|
|
|
|
#define GNC_JOB_H_
|
|
|
|
|
|
|
|
typedef struct _gncJob GncJob;
|
2007-04-04 21:44:08 -05:00
|
|
|
typedef struct _gncJobClass GncJobClass;
|
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"
|
2007-04-04 21:44:08 -05:00
|
|
|
|
|
|
|
/* --- type macros --- */
|
|
|
|
#define GNC_TYPE_JOB (gnc_job_get_type ())
|
|
|
|
#define GNC_JOB(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_JOB, GncJob))
|
|
|
|
#define GNC_JOB_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_JOB, GncJobClass))
|
|
|
|
#define GNC_IS_JOB(o) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_JOB))
|
|
|
|
#define GNC_IS_JOB_CLASS(k) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_JOB))
|
|
|
|
#define GNC_JOB_GET_CLASS(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_JOB, GncJobClass))
|
|
|
|
GType gnc_job_get_type(void);
|
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);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** \name Set Functions
|
|
|
|
@{
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** @} */
|
2002-11-03 14:21:42 -06:00
|
|
|
void gncJobBeginEdit (GncJob *job);
|
2001-11-16 19:17:06 -06:00
|
|
|
void gncJobCommitEdit (GncJob *job);
|
|
|
|
|
2005-11-01 21:32:36 -06:00
|
|
|
/** \name Get Functions
|
|
|
|
@{
|
|
|
|
*/
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2008-08-01 11:02:07 -05:00
|
|
|
const char * gncJobGetID (const GncJob *job);
|
|
|
|
const char * gncJobGetName (const GncJob *job);
|
|
|
|
const char * gncJobGetReference (const GncJob *job);
|
2002-01-22 09:51:14 -06:00
|
|
|
GncOwner * gncJobGetOwner (GncJob *job);
|
2005-11-01 21:32:36 -06:00
|
|
|
|
|
|
|
/** @} */
|
2008-08-01 11:02:07 -05:00
|
|
|
gboolean gncJobGetActive (const GncJob *job);
|
2001-11-16 19:17:06 -06:00
|
|
|
|
2003-10-19 00:13:59 -05:00
|
|
|
/** Return a pointer to the instance gncJob that is identified
|
2004-10-16 10:51:26 -05:00
|
|
|
* by the guid, and is residing in the book. Returns NULL if the
|
2003-10-19 00:13:59 -05:00
|
|
|
* instance can't be found.
|
|
|
|
* Equivalent function prototype is
|
|
|
|
* GncJob * gncJobLookup (QofBook *book, const GUID *guid);
|
|
|
|
*/
|
2010-03-06 05:01:37 -06:00
|
|
|
static inline GncJob * gncJobLookup (const QofBook *book, const GUID *guid)
|
|
|
|
{
|
|
|
|
QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_JOB, GncJob);
|
|
|
|
}
|
2003-10-19 00:13:59 -05:00
|
|
|
|
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"
|
2005-11-01 21:32:36 -06:00
|
|
|
#define Q_JOB_OWNER "owner_collection"
|
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))
|
2004-01-06 19:54:37 -06:00
|
|
|
#define gncJobRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
|
2003-10-16 23:32:04 -05:00
|
|
|
#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_ */
|
2004-05-07 00:11:49 -05:00
|
|
|
/** @} */
|
|
|
|
/** @} */
|