gncOwner.h

Go to the documentation of this file.
00001 /********************************************************************\
00002  * gncOwner.h -- Business Interface:  Object OWNERs                 *
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 \********************************************************************/
00033 #ifndef GNC_OWNER_H_
00034 #define GNC_OWNER_H_
00035 
00036 typedef struct _gncOwner GncOwner;
00037 
00038 #define GNC_ID_OWNER   "gncOwner"
00039 
00040 #include "qof.h"
00041 #include "gncCustomer.h"
00042 #include "gncJob.h"
00043 #include "gncVendor.h"
00044 #include "gncEmployee.h"
00045 #include "gnc-lot.h" 
00046 
00047 typedef enum { 
00048         GNC_OWNER_NONE , 
00049         GNC_OWNER_UNDEFINED , 
00050         GNC_OWNER_CUSTOMER , 
00051         GNC_OWNER_JOB , 
00052         GNC_OWNER_VENDOR , 
00053         GNC_OWNER_EMPLOYEE , 
00054 }GncOwnerType;
00055 
00064 QofIdType qofOwnerGetType(const GncOwner *owner);
00066 QofInstance* qofOwnerGetOwner (const GncOwner *owner);
00068 void qofOwnerSetEntity (GncOwner *owner, QofInstance *ent);
00069 
00070 gboolean
00071 gncOwnerRegister(void);
00072 
00075 #ifndef SWIG
00076 
00078 struct _gncOwner {
00079   GncOwnerType     type;      
00080   union {
00081     gpointer       undefined;
00082     GncCustomer *  customer;
00083     GncJob *       job;
00084     GncVendor *    vendor;
00085     GncEmployee *  employee;
00086   } owner;                   
00087   gpointer         qof_temp; 
00088 };
00089 
00090 #endif /* SWIG */
00091 
00095 void gncOwnerInitUndefined (GncOwner *owner, gpointer obj);
00096 void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer);
00097 void gncOwnerInitJob (GncOwner *owner, GncJob *job);
00098 void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor);
00099 void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee);
00104 GncOwnerType gncOwnerGetType (const GncOwner *owner);
00105 gpointer gncOwnerGetUndefined (const GncOwner *owner);
00106 GncCustomer * gncOwnerGetCustomer (const GncOwner *owner);
00107 GncJob * gncOwnerGetJob (const GncOwner *owner);
00108 GncVendor * gncOwnerGetVendor (const GncOwner *owner);
00109 GncEmployee * gncOwnerGetEmployee (const GncOwner *owner);
00111 void gncOwnerCopy (const GncOwner *src, GncOwner *dest);
00112 gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b);
00113 int gncOwnerCompare (const GncOwner *a, const GncOwner *b);
00114 
00115 const char * gncOwnerGetName (const GncOwner *owner);
00116 gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
00117 
00119 const GUID * gncOwnerGetGUID (const GncOwner *owner);
00120 GUID gncOwnerRetGUID (GncOwner *owner);
00121 
00122 gboolean gncOwnerIsValid (const GncOwner *owner);
00123 
00128 GncOwner * gncOwnerGetEndOwner (GncOwner *owner);
00129 const GUID * gncOwnerGetEndGUID (GncOwner *owner);
00130 
00132 void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot);
00133 
00137 gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner);
00138 
00139 gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GUID *guid);
00140 
00142 KvpFrame* gncOwnerGetSlots(GncOwner* owner);
00143 
00144 #define OWNER_TYPE        "type"
00145 #define OWNER_TYPE_STRING "type-string"  
00146 #define OWNER_CUSTOMER    "customer"
00147 #define OWNER_JOB         "job"
00148 #define OWNER_VENDOR      "vendor"
00149 #define OWNER_EMPLOYEE    "employee"
00150 #define OWNER_PARENT      "parent"
00151 #define OWNER_PARENTG     "parent-guid"
00152 #define OWNER_NAME        "name"
00153 
00154 #define OWNER_FROM_LOT    "owner-from-lot"
00155 
00161 GncOwner * gncOwnerCreate (void);
00162 void gncOwnerDestroy (GncOwner *owner);
00163 
00164 #endif /* GNC_OWNER_H_ */
00165 

Generated on Fri Oct 10 05:06:30 2008 for GnuCash by  doxygen 1.5.2