qofinstance-p.h

00001 /********************************************************************\
00002  * qofinstance-p.h -- private fields common to all object instances *
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 \********************************************************************/
00022 /*
00023  * Object instance holds many common fields that most
00024  * QofObjects use.
00025  * 
00026  * Copyright (C) 2003 Linas Vepstas <linas@linas.org>
00027  */
00028 
00029 #ifndef QOF_INSTANCE_P_H
00030 #define QOF_INSTANCE_P_H
00031 #include "config.h"
00032 #include "qofinstance.h"
00033 
00034 struct QofInstance_s
00035 {
00036     /* Globally unique id identifying this instance */
00037     QofEntity entity;
00038 
00039     /* The entity_table in which this instance is stored */
00040     QofBook *book;
00041 
00042     /* kvp_data is a key-value pair database for storing arbirtary
00043      * information associated with this instance.  
00044      * See src/engine/kvp_doc.txt for a list and description of the 
00045      * important keys. */
00046     KvpFrame *kvp_data;
00047 
00048     /*  Time of the last modification to this 
00049      *  instance.  Typically used to compare two versions of the
00050      *  same object, to see which is newer.  When used with the 
00051      *  SQL backend, this field is reserved for SQL use, to compare
00052      *  the version in local memory to the remote, server version.
00053      */
00054     QofTime *update_time;
00055 #ifndef QOF_DISABLE_DEPRECATED
00056     Timespec last_update;
00057 #endif
00058     /*  Keep track of nesting level of begin/end edit calls */
00059     gint editlevel;
00060 
00061     /*  In process of being destroyed */
00062     gboolean do_free;
00063 
00064     /*  dirty/clean flag. If dirty, then this instance has been modified,
00065      *  but has not yet been written out to storage (file/database)
00066      */
00067     gboolean dirty;
00068 };
00069 
00070 /* reset the dirty flag */
00071 void qof_instance_mark_clean (QofInstance *);
00072 
00073 void qof_instance_set_slots (QofInstance *, KvpFrame *);
00074 
00075 /*  Set the update time. Reserved for use by the SQL backend;
00076  *  used for comparing version in local memory to that in remote 
00077  *  server. The QofTime becomes the property of the instance.
00078  */
00079 void
00080 qof_instance_set_update_time (QofInstance * inst, QofTime * time);
00081 
00082 #endif /* QOF_INSTANCE_P_H */

Generated on Fri Sep 1 15:10:40 2006 for QOF by  doxygen 1.4.7