1 #ifndef INMOST_XML_INCLUDED
2 #define INMOST_XML_INCLUDED
8 std::string CharToHex(
char c);
10 std::string ReferenceToString(INMOST::HandleType h,
int pos);
12 #if defined(USE_AUTODIFF)
23 std::vector<std::string> Expand(
const std::string & input)
const;
24 std::vector<std::string> MakePolish(
const std::vector<std::string> & input);
25 void Print(
const std::vector<std::string> & polish)
const;
26 double Run(
const std::vector<std::string> & polish);
29 Interpreter(
const Interpreter & b);
30 Interpreter & operator = (Interpreter
const & b);
31 double Evaluate(
const std::string & str);
40 int linebreak, linechar;
41 int hadlinebreak, hadlinechar;
43 std::vector<Stream> inp;
50 ReadCommentExclamation,
56 ReadAttributeValueQuote,
67 ReadContentsMultiplier,
68 ReadContentsMultiplierSkopes,
75 Stream & get_Stream();
76 const Stream & get_Stream()
const;
77 std::istream & get_iStream();
78 const std::istream & get_iStream()
const;
85 void SkipComments(State RetState);
86 std::string StateName(State s)
const;
91 void Report(
const char * fmt, ...)
const;
92 XMLReader(std::string sourcename, std::istream & input);
93 void PushStream(std::string file);
100 std::string ReadOpenTag();
103 bool isTagFinish()
const;
105 bool ReadFinishTag(std::string TagName);
107 std::string AttributeName();
109 std::string AttributeValue();
112 bool isTagEnded()
const;
115 bool ReadOpenContents();
117 std::string GetContentsWord();
119 bool ReadCloseContents();
122 bool isContentsEnded()
const;
123 bool isFailure()
const;
126 #if defined(USE_MESH)
127 INMOST::ElementType atoes(
const char * _str);
128 INMOST::ElementType atoe(
const char * _str);
129 std::pair<INMOST::ElementType,int> atoh(
const char * _str);
130 std::pair<std::string,std::pair<INMOST::ElementType,int> > atorh(
const char * _str);
132 #if defined(USE_AUTODIFF)
135 int EvaluateExpression(std::string expression);
136 int ConvertMultiplier(std::string expression,
int SetSize);
137 void SplitValueMultiplier(std::string expression, std::string & value, std::string & multiplier);
138 bool ParseBool(std::string word);
139 void ParseCommaSeparated(std::string word, std::vector<std::string> & parsed,
char symbol =
',');
140 #if defined(USE_MESH)
141 void ParseReal(std::string word, std::vector<INMOST::Storage::real> & Vector,
int & Repeat,
int SetSize);
142 #if defined(USE_AUTODIFF)
143 void ParseVariable(std::string word, std::vector<INMOST::Storage::var> & Vector,
int & Repeat,
int SetSize);
145 void ParseInteger(std::string word, std::vector<INMOST::Storage::integer> & Vector,
int & Repeat,
int SetSize);
147 void ParseBulk(std::string word, std::string & Vector,
int & Repeat,
int SetSize);
148 #if defined(USE_MESH)
149 void ParseReference(std::string word, std::vector<std::pair<INMOST::ElementType,int> > & Vector,
int & Repeat,
int SetSize);
150 void ParseRemoteReference(std::string word, std::vector< std::pair<std::string,std::pair<INMOST::ElementType,int> > > & Vector,
int & Repeat,
int SetSize);
164 std::vector<XMLAttrib> attributes;
177 bool Stub()
const {
return finish == 2;}
191 bool CloseTag(XMLTag & tag);
197 std::vector<XMLTree> children;
198 std::string contents;
231 std::string ReadUntil(std::string stop);
232 int ReadXMLSub(XMLTree & root);
242 typedef std::vector<XMLReader::XMLTree>::iterator xml_reader_tree_iterator_t;
243 typedef std::vector<XMLReader::XMLAttrib>::iterator xml_reader_attrib_iterator_t;
void SetVerbosity(int verbosity)
2 - lot's of output 1 - output key steps, currently in ReadXML
XMLTree ReadXML()
Read entire XML file into structure, it may be more efficient to read the file incrementally,...
A class that represents a variable with multiple first order variations.
Structure for xml attribute.
Structure for xml tag with attributes.
const XMLAttrib & GetAttrib(int n) const
Retrieve attribute number n.
std::string GetName() const
Retrieve the name of the tag.
bool Failure() const
Was not able to read the tag.
bool Stub() const
Tag was read but do not have internal contents.
XMLAttrib & GetAttrib(int n)
Retrieve attribute number n.
int NumAttrib() const
Retrieve number of attributes.
bool Finalize() const
Tag was not red, finish of enclosing tag was encountered.
bool BlockData() const
This is data within ![CDATA[ wrap.
bool Process() const
Tag was read and have internal contents, can process the contents.
bool RawData() const
This is data without ![CDATA[ wrap.
Structure defining entire XML file.
const XMLTree * GetChildWithAttrib(std::string name, std::string value) const
Retrieve a child of current XML tag with attribute Returns NULL if not found.
const std::string & GetAttrib(std::string name) const
Retrieve attribute of current XML tag with name.
const std::string & GetContents() const
Retrieve contents of the tag.
int FindChild(std::string name, int offset=-1) const
Return next occurence of XML tag with the specified name.
int FindAttrib(std::string name, int offset=-1) const
Return next occurence of XML attribute with the specified name.
const XMLTree & GetChild(int n) const
Retrieve a child of current XML tag with number n.
int NumAttrib() const
Retrieve number of attributes.
const XMLAttrib & GetAttrib(int n) const
Retrieve attribute of current XML tag with number n.
std::string GetName() const
Retrieve the name of the tag.
const XMLTree * GetChild(std::string name) const
Retrieve a child of current XML tag with name Returns NULL if not found.
int NumChildren() const
Retrieve number of children.