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