00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __G_MARKUP_H__
00022 #define __G_MARKUP_H__
00023
00024 #include <gerror.h>
00025
00026 #ifdef __cplusplus
00027 extern "C"
00028 {
00029 #endif
00030
00031 typedef enum
00032 {
00033 G_MARKUP_ERROR_BAD_UTF8,
00034 G_MARKUP_ERROR_EMPTY,
00035 G_MARKUP_ERROR_PARSE,
00036
00037
00038
00039 G_MARKUP_ERROR_UNKNOWN_ELEMENT,
00040 G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
00041 G_MARKUP_ERROR_INVALID_CONTENT
00042 } GMarkupError;
00043
00044 #define G_MARKUP_ERROR g_markup_error_quark ()
00045
00046 GQuark g_markup_error_quark ();
00047
00048 typedef enum
00049 {
00050
00051 G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0
00052
00053 } GMarkupParseFlags;
00054
00055 typedef struct _GMarkupParseContext GMarkupParseContext;
00056 typedef struct _GMarkupParser GMarkupParser;
00057
00058 struct _GMarkupParser
00059 {
00060
00061 void (*start_element) (GMarkupParseContext *context,
00062 const gchar *element_name,
00063 const gchar **attribute_names,
00064 const gchar **attribute_values,
00065 gpointer user_data,
00066 GError **error);
00067
00068
00069 void (*end_element) (GMarkupParseContext *context,
00070 const gchar *element_name,
00071 gpointer user_data,
00072 GError **error);
00073
00074
00075
00076 void (*text) (GMarkupParseContext *context,
00077 const gchar *text,
00078 gint text_len,
00079 gpointer user_data,
00080 GError **error);
00081
00082
00083
00084
00085
00086
00087 void (*passthrough) (GMarkupParseContext *context,
00088 const gchar *passthrough_text,
00089 gint text_len,
00090 gpointer user_data,
00091 GError **error);
00092
00093
00094
00095
00096 void (*error) (GMarkupParseContext *context,
00097 GError *error,
00098 gpointer user_data);
00099 };
00100
00101 GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser,
00102 GMarkupParseFlags flags,
00103 gpointer user_data,
00104 GDestroyNotify user_data_dnotify);
00105 void g_markup_parse_context_free (GMarkupParseContext *context);
00106 gboolean g_markup_parse_context_parse (GMarkupParseContext *context,
00107 const gchar *text,
00108 gint text_len,
00109 GError **error);
00110
00111 gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context,
00112 GError **error);
00113
00114
00115 void g_markup_parse_context_get_position (GMarkupParseContext *context,
00116 gint *line_number,
00117 gint *char_number);
00118
00119
00120 gchar* g_markup_escape_text (const gchar *text,
00121 gint length);
00122
00123
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127
00128 #endif
00129