merge the formfield patch from ooo-build
[ooovba.git] / xml2cmp / source / xcd / parse.hxx
blob51626ab854156741947a88b068d3c0f4593e4e25
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: parse.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef X2C_PARSE_HXX
32 #define X2C_PARSE_HXX
36 // USED SERVICES
37 // BASE CLASSES
38 // COMPONENTS
39 #include "filebuff.hxx"
40 #include "../support/sistr.hxx"
41 #include "../support/list.hxx"
42 // PARAMETERS
45 class XmlElement;
46 class ListElement;
48 class X2CParser
50 public:
51 typedef XmlElement * (*F_CREATE)(const Simstr &);
53 X2CParser(
54 XmlElement & o_rDocumentData );
55 ~X2CParser();
57 bool LoadFile(
58 const char * i_sFilename );
59 void Parse();
60 bool Parse(
61 const char * i_sFilename );
64 const char * PureText() const { return aFile.operator const char*(); }
66 void Parse_Sequence(
67 DynamicList<XmlElement> &
68 o_rElements,
69 const Simstr & i_sElementName );
70 void Parse_FreeChoice(
71 DynamicList<XmlElement> &
72 o_rElements );
73 void Parse_List(
74 ListElement & o_rListElem );
75 void Parse_Text(
76 Simstr & o_sText,
77 const Simstr & i_sElementName,
78 bool i_bReverseName );
79 void Parse_MultipleText(
80 List<Simstr> & o_rTexts,
81 const Simstr & i_sElementName,
82 bool i_bReverseName );
83 void Parse_SglAttr(
84 Simstr & o_sAttrValue,
85 const Simstr & i_sElementName,
86 const Simstr & i_sAttrName );
87 void Parse_MultipleAttr(
88 List<Simstr> & o_rAttrValues,
89 const Simstr & i_sElementName,
90 const List<Simstr> &
91 i_rAttrNames );
93 private:
94 void Parse_XmlDeclaration();
95 void Parse_Doctype();
97 void Get_Attribute(
98 Simstr & o_rAttrValue,
99 Simstr & o_rAttrName );
100 bool IsText(
101 const char * i_sComparedText );
102 bool IsBeginTag(
103 const char * i_sTagName );
104 bool IsEndTag(
105 const char * i_sTagName );
106 void Goto(
107 char i_cNext );
108 void Goto_And_Pass(
109 char i_cNext );
110 void Move(
111 int i_nForward );
112 void Pass_White();
113 void GetTextTill(
114 Simstr & o_rText,
115 char i_cEnd,
116 bool i_bReverseName = false );
117 /// @return false in case of empty tag with no attributes.
118 bool CheckAndPassBeginTag(
119 const char * i_sElementName );
120 void CheckAndPassEndTag(
121 const char * i_sElementName );
122 /// @precond IsBeginTag() == true.
123 bool IsAbsoluteEmpty() const;
126 void SyntaxError(
127 const char * i_sText );
128 void TestCurChar();
130 // DATA
131 Simstr sFileName;
132 unsigned nFileLine;
134 Buffer aFile;
135 XmlElement * pDocumentData;
137 char sWord[8192];
138 const char * text;
143 // IMPLEMENTATION
145 #endif