Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SXmlReader.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshPluginScript/SClass/SObject.h"
10#include <QtCore/SFile>
11#include <QtCore/SXmlReader>
12
13#ifndef FCT_DOC
14namespace rsh::ScriptBinding
15{
16#endif // !FCT_DOC
17
53class SXmlReader : public SObject
54{
55 //======================================================================================================================
56 // INTERNAL FUNCTION
57 //======================================================================================================================
58
59 //======================================================================================================================
60 // DOCUMENTED FUNCTION
61 //======================================================================================================================
62public:
64 {
65 NoError, // No error has occurred.
66 NotWellFormedError, // The parser internally raised an error due to the read XML not being well-formed.
67 PrematureEndOfDocumentError, // The input stream ended before a well-formed XML document was parsed.
68 UnexpectedElementError// The parser encountered an element that was different to those it expected.
69 };
70
72 {
73 NoToken, // The reader has not yet read anything.
74 Invalid, // An error has occurred, reported in error().
75 StartDocument, // The reader reports the XML version number in DocumentVersion(),
76 // and the encoding as specified in the XML document in DocumentEncoding(). If the document is declared standalone,
77 // IsStandaloneDocument() returns true; otherwise it returns false.
78 EndDocument, // The reader reports the end of the document.
79 StartElement, // The reader reports the start of an element with NamespaceUri() and Name().
80 // Empty elements are also reported as StartElement, followed directly by EndElement. Attributes are
81 // reported in Attributes().
82 EndElement, // The reader reports the end of an element with NamespaceUri() and Name().
83 Characters, // The reader reports characters in Text(). If the characters are all white-space,
84 // IsWhitespace() returns true.
85 Comment, // The reader reports a comment in Text().
88 ProcessingInstruction};
89
90public slots: // these functions (slots) will be available in QtScript
97 Boolean AtEnd() ;
100 Array Attributes() ;
111 Boolean HasError() ;
122 Boolean IsWhitespace() ;
125 Number LineNumber() ;
128 String Name() ;
131 String NamespaceUri() ;
142 String Text() ;
145 String TokenString() ;
149
152 String toString() ;
153};
154
155// @brief
156// This class allows to wrap static functions to SXmlReader easily.
157// This allow to wrap constructor more easily : the constructor will be declared with the function New(...)
158class SXmlReader
159#ifndef FCT_DOC
160 : public SObjectStatic
161#endif // FCT_DOC
162{
163 //======================================================================================================================
164 // INTERNAL FUNCTION
165 //======================================================================================================================
166
167 //======================================================================================================================
168 // DOCUMENTED FUNCTION
169 //======================================================================================================================
170public slots:
173 // TESTED
174 static SXmlReader New();
175
178 static String toString();
179};
180Q_DECLARE_METATYPE(SXmlReader::_SXmlReaderDummy);
181Q_DECLARE_METATYPE(SXmlReader);
182
183#ifndef FCT_DOC
184} // namespace rsh::ScriptBinding
185#endif // !FCT_DOC
186
187Q_DECLARE_METATYPE(SXmlReader);
188Q_DECLARE_METATYPE(SXmlReader);
The Sfile class provides an interface for reading from and writing to files.
Definition: SFile.h:20
This class is an abstract class, you can use these function in its derived classes.
Definition: SObject.h:35
Class to read xml files Sample on how to use this class.
Definition: SXmlReader.h:54
Boolean HasError()
Returns true if an error has occurred, otherwise false.
String NamespaceUri()
Returns the namespaceUri of a StartElement or EndElement.
TokenTypeEnum ReadNext()
Reads the next token and returns its type.
Boolean AtEnd()
Returns true if the reader has read until the end of the XML document, or if an Error() has occurred ...
String Name()
Returns the local name of a StartElement, EndElement, or an EntityReference.
Boolean IsWhitespace()
Returns true if the reader reports characters that only consist of white-space; otherwise returns fal...
String Text()
Returns the text of Characters, Comment, DTD, or EntityReference.
Number LineNumber()
Returns the current line number, starting with 1.
static SXmlReader New()
Default constructor to instantiate a XmlReader.
SkipCurrentElement()
Reads until the end of the current element, skipping any child nodes. This function is useful for ski...
Boolean IsStandaloneDocument()
Returns true if this document has been declared standalone in the XML declaration; otherwise returns ...
String DocumentEncoding()
If the TokenType() is StartDocument, this function returns the encoding string as specified in the XM...
TokenTypeEnum
Definition: SXmlReader.h:72
@ StartElement
Definition: SXmlReader.h:79
@ DTD
Definition: SXmlReader.h:86
@ Invalid
Definition: SXmlReader.h:74
@ EndDocument
Definition: SXmlReader.h:78
@ EndElement
Definition: SXmlReader.h:82
@ NoToken
Definition: SXmlReader.h:73
@ StartDocument
Definition: SXmlReader.h:75
@ EntityReference
Definition: SXmlReader.h:87
@ Comment
Definition: SXmlReader.h:85
@ Characters
Definition: SXmlReader.h:83
TokenTypeEnum TokenType()
Returns the type of the current token.
static String toString()
Get the type of the variable.
Array Attributes()
Returns the attributes of a StartElement.
String TokenString()
Returns the reader's current token as string.
SetFile(SFile File)
Sets the current file to device. Setting the device resets reader.
ErrorEnum Error()
Returns the type of the current error, or NoError if no error occurred.
String DocumentVersion()
If the TokenType() is StartDocument, this function returns the version string as specified in the XML...
ErrorEnum
Definition: SXmlReader.h:64
@ NoError
Definition: SXmlReader.h:65
@ NotWellFormedError
Definition: SXmlReader.h:66
@ PrematureEndOfDocumentError
Definition: SXmlReader.h:67
String toString()
Get the type of the variable.