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 * gnucash objects 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 00032 #include "qofinstance.h" 00033 00034 /* 00035 * UNDER CONSTRUCTION! 00036 * This is mostly scaffolding for now, 00037 * eventually, it may hold more fields, such as refrence counting... 00038 * 00039 */ 00040 struct QofInstance_s 00041 { 00042 /* Globally unique id identifying this instance */ 00043 QofEntity entity; 00044 00045 /* The entity_table in which this instance is stored */ 00046 QofBook * book; 00047 00048 /* kvp_data is a key-value pair database for storing arbirtary 00049 * information associated with this instance. 00050 * See src/engine/kvp_doc.txt for a list and description of the 00051 * important keys. */ 00052 KvpFrame *kvp_data; 00053 00054 /* Timestamp used to track the last modification to this 00055 * instance. Typically used to compare two versions of the 00056 * same object, to see which is newer. When used with the 00057 * SQL backend, this field is reserved for SQL use, to compare 00058 * the version in local memory to the remote, server version. 00059 */ 00060 Timespec last_update; 00061 00062 /* Keep track of nesting level of begin/end edit calls */ 00063 int editlevel; 00064 00065 /* In process of being destroyed */ 00066 gboolean do_free; 00067 00068 /* dirty/clean flag. If dirty, then this instance has been modified, 00069 * but has not yet been written out to storage (file/database) 00070 */ 00071 gboolean dirty; 00072 }; 00073 00074 /* reset the dirty flag */ 00075 void qof_instance_mark_clean (QofInstance *); 00076 00077 void qof_instance_set_slots (QofInstance *, KvpFrame *); 00078 00079 /* Set the last_update time. Reserved for use by the SQL backend; 00080 * used for comparing version in local memory to that in remote 00081 * server. 00082 */ 00083 void qof_instance_set_last_update (QofInstance *inst, Timespec ts); 00084 00085 #endif /* QOF_INSTANCE_P_H */