📄 internal.h
字号:
/* librecord2 - Record Object manipulation and storage library 2 * * Authors: YE Nan <nan.ye@orange-ftgroup.com> * * This software and associated documentation files (the "Software") * are copyright (C) 2005 LiPS Linux Phone Standards Forum [FranceTelecom] * All Rights Reserved. * * A copyright license is hereby granted for redistribution and use of * the Software in source and binary forms, with or without modification, * provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this copyright license and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this copyright license and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of LiPS nor the names of its Members may be used * to endorse or promote products derived from the Software without * specific prior written permission. * * A patent license for any Necessary Claims owned by Members of LiPS Forum * to make, have made, use, import, offer to sell, lease and sell or otherwise * distribute any implementation compliant with the any specification adopted * by the LiPS Forumcan be obtained from the respective Members on reasonable * and non-discriminatory terms and conditions and under reciprocity, as * regulated in more detail in the Internal Policy of the LiPS Forum. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, ITS MEMBERS AND CONTRIBUTORS * "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER, * ITS MEMBERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */#ifndef __RECORD_INTERNAL_H#define __RECORD_INTERNAL_H#include <glib.h>#include <sqlite3.h>#include <field-desc.h>#include <template.h>#include <database.h>#ifdef __cplusplusextern "C" {#endif /* __cplusplus */typedef enum { TRANS_INNER, TRANS_OUTER, TRANS_NONE,} TransactionStatus;typedef enum { DB_FIELDS_INTEGER = 0, DB_FIELDS_REAL, DB_FIELDS_TEXT, DB_FIELDS_BLOB, DB_FIELDS_NTYPES, DB_FIELDS_INVALID} DBFieldType;#define DB_FIELDS_TYPES_SET(types, type) (types |= (1 << (type)))struct _RecordDB { sqlite3 *database; /**< SQLite3 db handler */ gchar *db_fname; /**< DB name */ TransactionStatus db_trans_status; /**< DB transcation status: TRANS_INNER, TRANS_OUTER, TRANS_NONE */ GHashTable *elements; /**< Hash map of elements in current database */};struct _RecordDBElement { RecordDB *db; /**< RecordDB handler */ gchar *db_elm_name; /**< Element name */ const FieldTemplate *db_elm_template; /**< Element template */ guint8 db_elm_field_types; /**< Filed type mask for current element */ guint32 db_elm_id_ftid; /**< Element "ID" field identifier */ DBFieldType db_elm_id_type; /**< Element "ID" field type */};struct _RecordDBRelation { RecordDB *db; gchar *db_rel_table_name; guint32 db_rel_pri_ftid1; guint32 db_rel_pri_ftid2; DBFieldType db_rel_pri_type1; DBFieldType db_rel_pri_type2;};/*! @struct Record @brief Record structure This structure is the record structure. */struct _Record { GHashTable *fields; /**< Record fields */ GHashTable *fids_map; /**< Record fids map */ const FieldTemplate *template; /**< Record template */ gboolean extended; /**< Record extension flag */};/*! @struct FieldTemplate @brief FieldTemplate structure This structure is the field template structure. */struct _FieldTemplate { GHashTable * fdescs; /**< Template descriptors */};/*! @struct Field @brief Field structure This structure is the field structure. */struct _Field { guint32 fid; /**< Field identifier */ gchar *label; /**< Field label */ gchar *desc; /**< Field desciption */ gpointer data; /**< Field value/size data */ FieldDescriptor *fdesc; /**< Field descriptor */};struct _Iterator { guint index; /**< Iterator current pointer */ GPtrArray *array; /**< Iterator elements */ void (*element_free) (gpointer element); /**< Iterator elements free fucntion */};gboolean record_db_inner_trans_begin (RecordDB *db, RecordDBTransType type);gboolean record_db_inner_trans_commit (RecordDB *db);#ifdef __cplusplus}#endif /* __cplusplus */#endif /* __RECORD_INTERNAL_H *//*vi:ts=2:nowrap:ai:expandtab*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -