1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* Copyright (C) 2001-2004 Novell, Inc. */
#ifndef __E2K_PROPERTIES_H__
#define __E2K_PROPERTIES_H__
#include <glib.h>
#include <libxml/tree.h>
typedef struct E2kProperties E2kProperties;
typedef enum {
E2K_PROP_TYPE_UNKNOWN,
E2K_PROP_TYPE_STRING,
E2K_PROP_TYPE_BINARY,
E2K_PROP_TYPE_STRING_ARRAY,
E2K_PROP_TYPE_BINARY_ARRAY,
E2K_PROP_TYPE_XML,
/* These are all stored as STRING or STRING_ARRAY */
E2K_PROP_TYPE_INT,
E2K_PROP_TYPE_INT_ARRAY,
E2K_PROP_TYPE_BOOL,
E2K_PROP_TYPE_FLOAT,
E2K_PROP_TYPE_DATE
} E2kPropType;
#define E2K_PROP_TYPE_IS_ARRAY(type) (((type) == E2K_PROP_TYPE_STRING_ARRAY) || ((type) == E2K_PROP_TYPE_BINARY_ARRAY) || ((type) == E2K_PROP_TYPE_INT_ARRAY))
E2kProperties *e2k_properties_new (void);
E2kProperties *e2k_properties_copy (E2kProperties *props);
void e2k_properties_free (E2kProperties *props);
gpointer e2k_properties_get_prop (E2kProperties *props,
const char *propname);
gboolean e2k_properties_empty (E2kProperties *props);
void e2k_properties_set_string (E2kProperties *props,
const char *propname,
char *value);
void e2k_properties_set_string_array (E2kProperties *props,
const char *propname,
GPtrArray *value);
void e2k_properties_set_binary (E2kProperties *props,
const char *propname,
GByteArray *value);
void e2k_properties_set_binary_array (E2kProperties *props,
const char *propname,
GPtrArray *value);
void e2k_properties_set_int (E2kProperties *props,
const char *propname,
int value);
void e2k_properties_set_int_array (E2kProperties *props,
const char *propname,
GPtrArray *value);
void e2k_properties_set_xml (E2kProperties *props,
const char *propname,
xmlNode *value);
void e2k_properties_set_bool (E2kProperties *props,
const char *propname,
gboolean value);
void e2k_properties_set_float (E2kProperties *props,
const char *propname,
float value);
void e2k_properties_set_date (E2kProperties *props,
const char *propname,
char *value);
void e2k_properties_set_type_as_string (E2kProperties *props,
const char *propname,
E2kPropType type,
char *value);
void e2k_properties_set_type_as_string_array (E2kProperties *props,
const char *propname,
E2kPropType type,
GPtrArray *value);
void e2k_properties_remove (E2kProperties *props,
const char *propname);
typedef void (*E2kPropertiesForeachFunc) (const char *propname,
E2kPropType type,
gpointer value,
gpointer user_data);
void e2k_properties_foreach (E2kProperties *props,
E2kPropertiesForeachFunc callback,
gpointer user_data);
void e2k_properties_foreach_removed (E2kProperties *props,
E2kPropertiesForeachFunc callback,
gpointer user_data);
typedef void(*E2kPropertiesForeachNamespaceFunc)(const char *namespace,
char abbrev,
gpointer user_data);
void e2k_properties_foreach_namespace (E2kProperties *props,
E2kPropertiesForeachNamespaceFunc callback,
gpointer user_data);
const char *e2k_prop_namespace_name (const char *prop);
char e2k_prop_namespace_abbrev (const char *prop);
const char *e2k_prop_property_name (const char *prop);
guint32 e2k_prop_proptag (const char *prop);
const char *e2k_proptag_prop (guint32 proptag);
#define E2K_PROPTAG_TYPE(proptag) (proptag & 0xFFFF)
#define E2K_PROPTAG_ID(proptag) (proptag & 0xFFFF0000)
#define E2K_PT_SHORT 0x0002
#define E2K_PT_LONG 0x0003
#define E2K_PT_ERROR 0x000a
#define E2K_PT_BOOLEAN 0x000b
#define E2K_PT_OBJECT 0x000d
#define E2K_PT_LONGLONG 0x0014
#define E2K_PT_STRING8 0x001e
#define E2K_PT_UNICODE 0x001f
#define E2K_PT_SYSTIME 0x0040
#define E2K_PT_BINARY 0x0102
#endif /* __E2K_PROPERTIES_H__ */
|