Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# markup.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2003 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  This program is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00023
    00024 #ifndef INTI_G_MARKUP_H
    00025 #define INTI_G_MARKUP_H
    00026
    00027 #ifndef INTI_OBJECT_H
    00028 #include <inti/object.h>
    00029 #endif
    00030
    00031 #ifndef INTI_UTF_STRING_H
    00032 #include <inti/utf-string.h>
    00033 #endif
    00034
    00035 #ifndef __G_MARKUP_H__
    00036 #include <glib/gmarkup.h>
    00037 #endif
    00038
    00039 #ifndef _CPP_MAP
    00040 #include <map>
    00041 #endif
    00042
    00043 namespace Inti {
    00044
    00045 namespace G {
    00046
    00047 class Error;
    00048 class MarkupParseContext;
    00049 class MarkupParserClass;
    00050
    00062
    00063 class MarkupParser
    00064 {
    00065         friend class MarkupParserClass;
    00066
    00067         MarkupParser(const MarkupParser&);
    00068         MarkupParser& operator=(const MarkupParser&);
    00069
    00070 protected:
    00073
    00074         MarkupParser();
    00076
    00080
    00081         virtual void on_start_element(MarkupParseContext& context, const String& element_name,
    00082                                       const std::map<const char*, const char*>& attributes, G::Error& error);
    00102
    00103         virtual void on_end_element(MarkupParseContext& context, const String& element_name, G::Error& error);
    00110
    00111         virtual void on_text(MarkupParseContext& context, const String text, G::Error& error);
    00118
    00119         virtual void on_passthrough(MarkupParseContext& context, const String& passthrough_text, G::Error& error);
    00129
    00130         virtual void on_error(MarkupParseContext& context, G::Error& error);
    00136
    00138
    00139 public:
    00142
    00143         virtual ~MarkupParser();
    00145
    00147 };
    00148
    00176
    00177 class MarkupParseContext : public ReferencedObject
    00178 {
    00179         MarkupParseContext(const MarkupParseContext&);
    00180         MarkupParseContext& operator=(const MarkupParseContext&);
    00181
    00182         GMarkupParseContext *context_;
    00183         bool can_free_;
    00184
    00185 public:
    00188
    00189         MarkupParseContext(MarkupParser& parser);
    00200
    00201         MarkupParseContext(GMarkupParseContext *context, bool can_free);
    00205
    00206         virtual ~MarkupParseContext();
    00208
    00212
    00213         GMarkupParseContext* g_markup_parse_context() const { return context_; }
    00215
    00216         operator GMarkupParseContext* () const;
    00218
    00219         String get_element() const;
    00222
    00223         void get_position(int *line_number, int *char_number) const;
    00231
    00235
    00236         bool parse(const char *text, int length, G::Error *error);
    00249
    00250         bool parse(const String& text, G::Error *error);
    00257
    00258         bool end_parse(G::Error *error);
    00265
    00267
    00268         static String escape_text(const char *text, int length);
    00277
    00278         static String escape_text(const String& text);
    00286 };
    00287
    00288 } // namespace G
    00289
    00290 } // namespace Inti
    00291
    00292 #endif // INTI_G_MARKUP_H
    00293

Main Page - Footer