pilot-qof 0.2.3
Data Structures | Files | Defines | Functions | Variables
Addresses and Contacts
Query Object Framework

Data Structures

struct  QofAddress
 Example of QOF wrapping an existing object. More...

Files

file  qof-address.c
 

QOF address definitions for pilot-link.


file  qof-address.h
 

QOF address definitions for pilot-link.


Defines

#define QOF_ADDRESS_DESC   "Pilot-link QOF address"
#define ADDRESS_VERSION   address_v1
#define PQ_MOD_ADDRESS   "pilotqof-address"
#define PILOT_LINK_QOF_ADDRESS   "pilot_address"
#define ADDR_LAST_NAME   "entryLastname"
#define ADDR_FIRST_NAME   "entryFirstname"
#define ADDR_COMPANY   "entryCompany"
#define ADDR_PHONE_ONE   "entryPhone1"
#define ADDR_PHONE_TWO   "entryPhone2"
#define ADDR_PHONE_THREE   "entryPhone3"
#define ADDR_PHONE_FOUR   "entryPhone4"
#define ADDR_PHONE_FIVE   "entryPhone5"
#define ADDR_ADDRESS   "entryAddress"
#define ADDR_CITY   "entryCity"
#define ADDR_STATE   "entryState"
#define ADDR_ZIP   "entryZip"
#define ADDR_COUNTRY   "entryCountry"
#define ADDR_TITLE   "entryTitle"
#define ADDR_CUSTOM_ONE   "entryCustom1"
#define ADDR_CUSTOM_TWO   "entryCustom2"
#define ADDR_CUSTOM_THREE   "entryCustom3"
#define ADDR_CUSTOM_FOUR   "entryCustom4"
#define ADDR_NOTE   "entryNote"
#define ADDR_CATEGORY   "category"

Functions

static QofAddressaddress_create (QofBook *book)
 create a new address
Address_t * address_get_pilot (QofInstance *inst)
static gchar * addr_getLastname (QofAddress *a)
static gchar * addr_getFirstname (QofAddress *a)
static gchar * addr_getCompany (QofAddress *a)
static gchar * addr_getPhoneOne (QofAddress *a)
static gchar * addr_getPhoneTwo (QofAddress *a)
static gchar * addr_getPhoneThree (QofAddress *a)
static gchar * addr_getPhoneFour (QofAddress *a)
static gchar * addr_getPhoneFive (QofAddress *a)
static gchar * addr_getCity (QofAddress *a)
static gchar * addr_getState (QofAddress *a)
static gchar * addr_getZip (QofAddress *a)
static gchar * addr_getCountry (QofAddress *a)
static gchar * addr_getTitle (QofAddress *a)
static gchar * addr_getAddress (QofAddress *a)
static gchar * addr_getCustomOne (QofAddress *a)
static gchar * addr_getCustomTwo (QofAddress *a)
static gchar * addr_getCustomThree (QofAddress *a)
static gchar * addr_getCustomFour (QofAddress *a)
static gchar * addr_getNote (QofAddress *a)
static gchar * addr_getCategory (QofAddress *a)
static void addr_setLastname (QofAddress *a, gchar *h)
static void addr_setFirstname (QofAddress *a, gchar *h)
static void addr_setCompany (QofAddress *a, gchar *h)
static void addr_setPhoneOne (QofAddress *a, gchar *h)
static void addr_setPhoneTwo (QofAddress *a, gchar *h)
static void addr_setPhoneThree (QofAddress *a, gchar *h)
static void addr_setPhoneFour (QofAddress *a, gchar *h)
static void addr_setPhoneFive (QofAddress *a, gchar *h)
static void addr_setAddress (QofAddress *a, gchar *h)
static void addr_setCity (QofAddress *a, gchar *h)
static void addr_setState (QofAddress *a, gchar *h)
static void addr_setZip (QofAddress *a, gchar *h)
static void addr_setCountry (QofAddress *a, gchar *h)
static void addr_setTitle (QofAddress *a, gchar *h)
static void addr_setCustomOne (QofAddress *a, gchar *h)
static void addr_setCustomTwo (QofAddress *a, gchar *h)
static void addr_setCustomThree (QofAddress *a, gchar *h)
static void addr_setCustomFour (QofAddress *a, gchar *h)
static void addr_setNote (QofAddress *a, gchar *h)
static void addr_setCategory (QofAddress *a, gchar *h)
static const gchar * addressPrintable (gpointer instance)
gboolean AddressRegister (void)
 Extended for pilot-link.

Variables

static G_GNUC_UNUSED QofLogModule log_module = "pilotqof-objects"
static QofObject address_object_def

Detailed Description

Addresses is probably the easiest QOF object to understand - all the entries are simple strings. QOF does provide a cache that could be used here but until pilot-qof has an interactive shell, creating and then populating the cache is considered not worthwhile.


Define Documentation

#define ADDR_LAST_NAME   "entryLastname"

Hack alert: Because these are strings (for QOF), the macros CANNOT be used directly in the enum!

Definition at line 46 of file qof-address.h.

Referenced by AddressRegister().


Function Documentation

static QofAddress* address_create ( QofBook *  book) [static]

create a new address

Hack alert: This routine specifically sets a blank value in entry[18] - using g_new0() externally is not the same.

Definition at line 61 of file qof-address.c.

{
    Address_t *qa;
    QofAddress *obj;
    QofCollection *coll;
    GList *all;

    obj = g_new0 (QofAddress, 1);
    qof_instance_init (&obj->inst, PILOT_LINK_QOF_ADDRESS, book);
    coll = qof_book_get_collection (book, PILOT_LINK_QOF_ADDRESS);
    all = qof_collection_get_data (coll);
    all = g_list_prepend (all, obj);
    qof_collection_set_data (coll, all);
    qa = &obj->wrap;
    qa->entry[18] = strdup ("");
    return obj;
}
gboolean AddressRegister ( void  )

Extended for pilot-link.

Uses the standard QOF registration but adds a pilot_pack registration that tells QOF how to deal with the pilot-link objects contained within the QOF objects.

Definition at line 542 of file qof-address.c.

References ADDR_LAST_NAME.

Referenced by pilot_qof_init().

{
    static QofParam params[] = {
        {ADDR_LAST_NAME, QOF_TYPE_STRING, (QofAccessFunc) addr_getLastname,
                (QofSetterFunc) addr_setLastname},
        {ADDR_FIRST_NAME, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getFirstname,
                (QofSetterFunc) addr_setFirstname},
        {ADDR_COMPANY, QOF_TYPE_STRING, (QofAccessFunc) addr_getCompany,
                (QofSetterFunc) addr_setCompany},
        {ADDR_PHONE_ONE, QOF_TYPE_STRING, (QofAccessFunc) addr_getPhoneOne,
                (QofSetterFunc) addr_setPhoneOne},
        {ADDR_PHONE_TWO, QOF_TYPE_STRING, (QofAccessFunc) addr_getPhoneTwo,
                (QofSetterFunc) addr_setPhoneTwo},
        {ADDR_PHONE_THREE, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getPhoneThree,
                (QofSetterFunc) addr_setPhoneThree},
        {ADDR_PHONE_FOUR, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getPhoneFour,
                (QofSetterFunc) addr_setPhoneFour},
        {ADDR_PHONE_FIVE, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getPhoneFive,
                (QofSetterFunc) addr_setPhoneFive},
        {ADDR_ADDRESS, QOF_TYPE_STRING, (QofAccessFunc) addr_getAddress,
                (QofSetterFunc) addr_setAddress},
        {ADDR_CITY, QOF_TYPE_STRING, (QofAccessFunc) addr_getCity,
                (QofSetterFunc) addr_setCity},
        {ADDR_STATE, QOF_TYPE_STRING, (QofAccessFunc) addr_getState,
                (QofSetterFunc) addr_setState},
        {ADDR_ZIP, QOF_TYPE_STRING, (QofAccessFunc) addr_getZip,
                (QofSetterFunc) addr_setZip},
        {ADDR_COUNTRY, QOF_TYPE_STRING, (QofAccessFunc) addr_getCountry,
                (QofSetterFunc) addr_setCountry},
        {ADDR_TITLE, QOF_TYPE_STRING, (QofAccessFunc) addr_getTitle,
                (QofSetterFunc) addr_setTitle},
        {ADDR_CUSTOM_ONE, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getCustomOne,
                (QofSetterFunc) addr_setCustomOne},
        {ADDR_CUSTOM_TWO, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getCustomTwo,
                (QofSetterFunc) addr_setCustomTwo},
        {ADDR_CUSTOM_THREE, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getCustomThree,
                (QofSetterFunc) addr_setCustomThree},
        {ADDR_CUSTOM_FOUR, QOF_TYPE_STRING,
                (QofAccessFunc) addr_getCustomFour,
                (QofSetterFunc) addr_setCustomFour},
        {ADDR_NOTE, QOF_TYPE_STRING, (QofAccessFunc) addr_getNote,
                (QofSetterFunc) addr_setNote},
        {ADDR_CATEGORY, QOF_TYPE_STRING, (QofAccessFunc) addr_getCategory,
                (QofSetterFunc) addr_setCategory},
        {QOF_PARAM_BOOK, QOF_ID_BOOK,
                (QofAccessFunc) qof_instance_get_book, NULL},
        {QOF_PARAM_GUID, QOF_TYPE_GUID,
                (QofAccessFunc) qof_instance_get_guid, NULL},
        {NULL},
    };

    qof_class_register (PILOT_LINK_QOF_ADDRESS, NULL, params);

//  pilot_qof_pack_register (&address_pack_def);

    return qof_object_register (&address_object_def);
}

Variable Documentation

QofObject address_object_def [static]
Initial value:
 {
  interface_version:QOF_OBJECT_VERSION,
  e_type: "pilot_address" ,
  type_label: "Pilot-link QOF address" ,
  create:(gpointer) address_create,
  book_begin:NULL,
  book_end:NULL,
  is_dirty:qof_collection_is_dirty,
  mark_clean:qof_collection_mark_clean,
  foreach:qof_collection_foreach,
  printable:addressPrintable,
  version_cmp:(gint (*)(gpointer, gpointer)) qof_instance_version_cmp,
}

Definition at line 527 of file qof-address.c.