📄 record.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_RECORD_H#define __RECORD_RECORD_H#include <glib.h>#include <field.h>#include <field-desc.h>#include <template.h>#include <iterator.h>#ifdef __cplusplusextern "C" {#endif /* __cplusplus */#define FID_GENERATE_SEED 1000#define FID_GET_FTID(fid) (fid / FID_GENERATE_SEED)#define FID_GET_INDEX(fid) (fid % FID_GENERATE_SEED)#define FID_GENERATE(ftid, i) ((ftid * FID_GENERATE_SEED) + i)#define FID_DEFAULT 0x1#define FID_EXTEND 0x2#define FID_ALL (FID_DEFAULT | FID_EXTEND)#define PRIMARY_ID_INVALID 0typedef struct _Record Record;typedef void (*RecordFieldFunc) (guint32 *fid, Field *field, gpointer user_data);Record * record_new (const FieldTemplate *template);void record_free (Record *record);guint32 record_add_field (Record *record, guint32 ftid);gboolean record_remove_field (Record *record, guint32 fid);gboolean record_add_know_field (Record *record, guint32 fid); gboolean record_set_field_default (Record *record, guint32 ftid, gconstpointer value, FieldSize size);gboolean record_set_field (Record *record, guint32 fid, gconstpointer value, FieldSize size);gboolean record_set_label_default (Record *record, guint32 ftid, const gchar *label);gboolean record_set_label (Record *record, guint32 fid, const gchar *label);gboolean record_set_desc_default (Record *record, guint32 ftid, const gchar *description);gboolean record_set_desc (Record *record, guint32 fid, const gchar *description); gconstpointer record_get_field_default (const Record *record, guint32 ftid, FieldSize *size);gconstpointer record_get_field (const Record *record, guint32 fid, FieldSize *size);const gchar * record_get_label_default (Record *record, guint32 ftid);const gchar * record_get_label (Record *record, guint32 fid);const gchar * record_get_desc_default (Record *record, guint32 ftid);const gchar * record_get_desc (Record *record, guint32 fid);void record_clear_field (Record *record, guint32 fid);void record_foreach_field (const Record *record, RecordFieldFunc func, gpointer user_data);guint32 record_get_default_fid (Record *record, guint32 ftid);guint32 record_set_default_fid (Record *record, guint32 ftid, guint32 fid);Iterator * record_get_fids (Record *record, guint32 ftid, guint32 flag);Iterator * record_get_ftids (const Record *record);guint32 record_get_ftid (const Record *record, guint32 fid); const FieldTemplate * record_get_template (const Record *record);gboolean record_is_empty (const Record *record);gboolean record_is_extended (const Record *record);gboolean record_is_default_changed (const Record *record, guint32 ftid);gboolean record_is_default_field (Record *record, guint32 fid);void record_print (const Record *record);#ifdef __cplusplus}#endif /* __cplusplus */#endif /* __RECORD_RECORD_H *//*vi:ts=2:nowrap:ai:expandtab*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -