aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llxml/llxmlparser.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llxml/llxmlparser.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llxml/llxmlparser.h')
-rw-r--r--linden/indra/llxml/llxmlparser.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/linden/indra/llxml/llxmlparser.h b/linden/indra/llxml/llxmlparser.h
new file mode 100644
index 0000000..27c137a
--- /dev/null
+++ b/linden/indra/llxml/llxmlparser.h
@@ -0,0 +1,128 @@
1/**
2 * @file llxmlparser.h
3 * @brief LLXmlParser class definition
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLXMLPARSER_H
29#define LL_LLXMLPARSER_H
30
31#define XML_STATIC
32#include "expat/expat.h"
33
34class LLXmlParser
35{
36public:
37 LLXmlParser();
38 virtual ~LLXmlParser();
39
40 // Parses entire file
41 BOOL parseFile(const std::string &path);
42
43 // Parses some input. Returns 0 if a fatal error is detected.
44 // The last call must have isFinal true;
45 // len may be zero for this call (or any other).
46 S32 parse( const char* buf, int len, int isFinal );
47
48 const char* getErrorString();
49
50 S32 getCurrentLineNumber();
51
52 S32 getCurrentColumnNumber();
53
54 S32 getDepth() { return mDepth; }
55
56protected:
57 // atts is array of name/value pairs, terminated by 0;
58 // names and values are 0 terminated.
59 virtual void startElement(const char *name, const char **atts) {}
60
61 virtual void endElement(const char *name) {}
62
63 // s is not 0 terminated.
64 virtual void characterData(const char *s, int len) {}
65
66 // target and data are 0 terminated
67 virtual void processingInstruction(const char *target, const char *data) {}
68
69 // data is 0 terminated
70 virtual void comment(const char *data) {}
71
72 virtual void startCdataSection() {}
73
74 virtual void endCdataSection() {}
75
76 // This is called for any characters in the XML document for
77 // which there is no applicable handler. This includes both
78 // characters that are part of markup which is of a kind that is
79 // not reported (comments, markup declarations), or characters
80 // that are part of a construct which could be reported but
81 // for which no handler has been supplied. The characters are passed
82 // exactly as they were in the XML document except that
83 // they will be encoded in UTF-8. Line boundaries are not normalized.
84 // Note that a byte order mark character is not passed to the default handler.
85 // There are no guarantees about how characters are divided between calls
86 // to the default handler: for example, a comment might be split between
87 // multiple calls.
88 virtual void defaultData(const char *s, int len) {}
89
90 // This is called for a declaration of an unparsed (NDATA)
91 // entity. The base argument is whatever was set by XML_SetBase.
92 // The entityName, systemId and notationName arguments will never be null.
93 // The other arguments may be.
94 virtual void unparsedEntityDecl(
95 const char *entityName,
96 const char *base,
97 const char *systemId,
98 const char *publicId,
99 const char *notationName) {}
100
101public:
102 ///////////////////////////////////////////////////////////////////////////////
103 // Pseudo-private methods. These are only used by internal callbacks.
104
105 static void startElementHandler(void *userData, const XML_Char *name, const XML_Char **atts);
106 static void endElementHandler(void *userData, const XML_Char *name);
107 static void characterDataHandler(void *userData, const XML_Char *s, int len);
108 static void processingInstructionHandler(void *userData, const XML_Char *target, const XML_Char *data);
109 static void commentHandler(void *userData, const XML_Char *data);
110 static void startCdataSectionHandler(void *userData);
111 static void endCdataSectionHandler(void *userData);
112 static void defaultDataHandler( void *userData, const XML_Char *s, int len);
113 static void unparsedEntityDeclHandler(
114 void *userData,
115 const XML_Char *entityName,
116 const XML_Char *base,
117 const XML_Char *systemId,
118 const XML_Char *publicId,
119 const XML_Char *notationName);
120
121
122protected:
123 XML_Parser mParser;
124 int mDepth;
125 char mAuxErrorString[1024];
126};
127
128#endif // LL_LLXMLPARSER_H