LibreOffice Module xmlreader (master) 1
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xmlreader::XmlReader Class Reference

#include <xmlreader.hxx>

Collaboration diagram for xmlreader::XmlReader:
[legend]

Classes

struct  AttributeData
 
struct  ElementData
 
struct  NamespaceData
 

Public Types

enum  {
  NAMESPACE_NONE = -2 ,
  NAMESPACE_UNKNOWN = -1 ,
  NAMESPACE_XML = 0
}
 
enum class  Text {
  NONE ,
  Raw ,
  Normalized
}
 
enum class  Result {
  Begin ,
  End ,
  Text ,
  Done
}
 

Public Member Functions

 XmlReader (OUString fileUrl)
 
 ~XmlReader ()
 
int registerNamespaceIri (Span const &iri)
 
Result nextItem (Text reportText, Span *data, int *nsId)
 
bool nextAttribute (int *nsId, Span *localName)
 
Span getAttributeValue (bool fullyNormalize)
 
int getNamespaceId (Span const &prefix) const
 
const OUString & getUrl () const
 

Private Types

enum class  State {
  Content ,
  StartTag ,
  EndTag ,
  EmptyElementTag ,
  Done
}
 
typedef std::vector< SpanNamespaceIris
 
typedef std::vector< NamespaceDataNamespaceList
 
typedef std::stack< ElementDataElementStack
 
typedef std::vector< AttributeDataAttributes
 

Private Member Functions

 XmlReader (const XmlReader &)=delete
 
XmlReaderoperator= (const XmlReader &)=delete
 
SAL_DLLPRIVATE char read ()
 
SAL_DLLPRIVATE char peek () const
 
SAL_DLLPRIVATE void normalizeLineEnds (Span const &text)
 
SAL_DLLPRIVATE void skipSpace ()
 
SAL_DLLPRIVATE bool skipComment ()
 
SAL_DLLPRIVATE void skipProcessingInstruction ()
 
SAL_DLLPRIVATE void skipDocumentTypeDeclaration ()
 
SAL_DLLPRIVATE Span scanCdataSection ()
 
SAL_DLLPRIVATE bool scanName (char const **nameColon)
 
SAL_DLLPRIVATE int scanNamespaceIri (char const *begin, char const *end)
 
SAL_DLLPRIVATE char const * handleReference (char const *position, char const *end)
 
SAL_DLLPRIVATE Span handleAttributeValue (char const *begin, char const *end, bool fullyNormalize)
 
SAL_DLLPRIVATE Result handleStartTag (int *nsId, Span *localName)
 
SAL_DLLPRIVATE Result handleEndTag ()
 
SAL_DLLPRIVATE void handleElementEnd ()
 
SAL_DLLPRIVATE Result handleSkippedText (Span *data, int *nsId)
 
SAL_DLLPRIVATE Result handleRawText (Span *text)
 
SAL_DLLPRIVATE Result handleNormalizedText (Span *text)
 

Static Private Member Functions

static SAL_DLLPRIVATE int toNamespaceId (NamespaceIris::size_type pos)
 

Private Attributes

OUString const fileUrl_
 
oslFileHandle fileHandle_
 
sal_uInt64 fileSize_
 
void * fileAddress_
 
NamespaceIris namespaceIris_
 
NamespaceList namespaces_
 
ElementStack elements_
 
char const * pos_
 
char const * end_
 
State state_
 
Attributes attributes_
 
Attributes::iterator currentAttribute_
 
bool firstAttribute_
 
Pad pad_
 

Detailed Description

Definition at line 36 of file xmlreader.hxx.

Member Typedef Documentation

◆ Attributes

typedef std::vector< AttributeData > xmlreader::XmlReader::Attributes
private

Definition at line 123 of file xmlreader.hxx.

◆ ElementStack

typedef std::stack< ElementData > xmlreader::XmlReader::ElementStack
private

Definition at line 104 of file xmlreader.hxx.

◆ NamespaceIris

typedef std::vector< Span > xmlreader::XmlReader::NamespaceIris
private

Definition at line 69 of file xmlreader.hxx.

◆ NamespaceList

typedef std::vector< NamespaceData > xmlreader::XmlReader::NamespaceList
private

Definition at line 88 of file xmlreader.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NAMESPACE_NONE 
NAMESPACE_UNKNOWN 
NAMESPACE_XML 

Definition at line 42 of file xmlreader.hxx.

◆ Result

enum class xmlreader::XmlReader::Result
strong
Enumerator
Begin 
End 
Text 
Done 

Definition at line 46 of file xmlreader.hxx.

◆ State

enum class xmlreader::XmlReader::State
strongprivate
Enumerator
Content 
StartTag 
EndTag 
EmptyElementTag 
Done 

Definition at line 125 of file xmlreader.hxx.

◆ Text

enum class xmlreader::XmlReader::Text
strong
Enumerator
NONE 
Raw 
Normalized 

Definition at line 44 of file xmlreader.hxx.

Constructor & Destructor Documentation

◆ XmlReader() [1/2]

xmlreader::XmlReader::XmlReader ( OUString  fileUrl)
explicit

◆ ~XmlReader()

xmlreader::XmlReader::~XmlReader ( )

Definition at line 96 of file xmlreader.cxx.

References fileAddress_, fileHandle_, fileSize_, fileUrl_, and SAL_WARN.

◆ XmlReader() [2/2]

xmlreader::XmlReader::XmlReader ( const XmlReader )
privatedelete

Member Function Documentation

◆ getAttributeValue()

Span xmlreader::XmlReader::getAttributeValue ( bool  fullyNormalize)

Definition at line 179 of file xmlreader.cxx.

References currentAttribute_, and handleAttributeValue().

◆ getNamespaceId()

int xmlreader::XmlReader::getNamespaceId ( Span const &  prefix) const

Definition at line 185 of file xmlreader.cxx.

References i, NAMESPACE_UNKNOWN, namespaces_, and prefix.

Referenced by handleStartTag(), and nextAttribute().

◆ getUrl()

const OUString & xmlreader::XmlReader::getUrl ( ) const
inline

Definition at line 63 of file xmlreader.hxx.

◆ handleAttributeValue()

Span xmlreader::XmlReader::handleAttributeValue ( char const *  begin,
char const *  end,
bool  fullyNormalize 
)
private

◆ handleElementEnd()

void xmlreader::XmlReader::handleElementEnd ( )
private

Definition at line 708 of file xmlreader.cxx.

References Content, Done, elements_, end, namespaces_, and state_.

Referenced by handleEndTag(), and nextItem().

◆ handleEndTag()

XmlReader::Result xmlreader::XmlReader::handleEndTag ( )
private

Definition at line 685 of file xmlreader.cxx.

References elements_, End, fileUrl_, handleElementEnd(), peek(), pos_, scanName(), and skipSpace().

Referenced by handleSkippedText(), and nextItem().

◆ handleNormalizedText()

XmlReader::Result xmlreader::XmlReader::handleNormalizedText ( Span text)
private

◆ handleRawText()

XmlReader::Result xmlreader::XmlReader::handleRawText ( Span text)
private

◆ handleReference()

char const * xmlreader::XmlReader::handleReference ( char const *  position,
char const *  end 
)
private

◆ handleSkippedText()

XmlReader::Result xmlreader::XmlReader::handleSkippedText ( Span data,
int nsId 
)
private

◆ handleStartTag()

XmlReader::Result xmlreader::XmlReader::handleStartTag ( int nsId,
Span localName 
)
private

◆ nextAttribute()

bool xmlreader::XmlReader::nextAttribute ( int nsId,
Span localName 
)

◆ nextItem()

XmlReader::Result xmlreader::XmlReader::nextItem ( Text  reportText,
Span data,
int nsId 
)

◆ normalizeLineEnds()

void xmlreader::XmlReader::normalizeLineEnds ( Span const &  text)
private

Definition at line 196 of file xmlreader.cxx.

References xmlreader::Pad::add(), i, n, p, pad_, and text().

Referenced by handleNormalizedText(), and handleRawText().

◆ operator=()

XmlReader & xmlreader::XmlReader::operator= ( const XmlReader )
privatedelete

◆ peek()

SAL_DLLPRIVATE char xmlreader::XmlReader::peek ( ) const
inlineprivate

◆ read()

SAL_DLLPRIVATE char xmlreader::XmlReader::read ( )
inlineprivate

Definition at line 127 of file xmlreader.hxx.

Referenced by handleStartTag(), skipComment(), and skipDocumentTypeDeclaration().

◆ registerNamespaceIri()

int xmlreader::XmlReader::registerNamespaceIri ( Span const &  iri)

Definition at line 113 of file xmlreader.cxx.

References namespaceIris_, namespaces_, and toNamespaceId().

◆ scanCdataSection()

Span xmlreader::XmlReader::scanCdataSection ( )
private

Definition at line 327 of file xmlreader.cxx.

References begin, end_, fileUrl_, i, and pos_.

Referenced by handleNormalizedText(), handleRawText(), and handleSkippedText().

◆ scanName()

bool xmlreader::XmlReader::scanName ( char const **  nameColon)
private

Definition at line 347 of file xmlreader.cxx.

References begin, peek(), and pos_.

Referenced by handleEndTag(), and handleStartTag().

◆ scanNamespaceIri()

int xmlreader::XmlReader::scanNamespaceIri ( char const *  begin,
char const *  end 
)
private

Definition at line 369 of file xmlreader.cxx.

References begin, end, handleAttributeValue(), i, NAMESPACE_UNKNOWN, namespaceIris_, and toNamespaceId().

Referenced by handleStartTag().

◆ skipComment()

bool xmlreader::XmlReader::skipComment ( )
private

◆ skipDocumentTypeDeclaration()

void xmlreader::XmlReader::skipDocumentTypeDeclaration ( )
private

◆ skipProcessingInstruction()

void xmlreader::XmlReader::skipProcessingInstruction ( )
private

Definition at line 243 of file xmlreader.cxx.

References end_, fileUrl_, i, and pos_.

Referenced by handleNormalizedText(), handleRawText(), handleSkippedText(), and skipDocumentTypeDeclaration().

◆ skipSpace()

void xmlreader::XmlReader::skipSpace ( )
private

Definition at line 214 of file xmlreader.cxx.

References peek(), and pos_.

Referenced by handleEndTag(), handleStartTag(), and skipDocumentTypeDeclaration().

◆ toNamespaceId()

int xmlreader::XmlReader::toNamespaceId ( NamespaceIris::size_type  pos)
staticprivate

Definition at line 935 of file xmlreader.cxx.

References pos.

Referenced by registerNamespaceIri(), and scanNamespaceIri().

Member Data Documentation

◆ attributes_

Attributes xmlreader::XmlReader::attributes_
private

Definition at line 178 of file xmlreader.hxx.

Referenced by handleStartTag(), and nextAttribute().

◆ currentAttribute_

Attributes::iterator xmlreader::XmlReader::currentAttribute_
private

Definition at line 179 of file xmlreader.hxx.

Referenced by getAttributeValue(), and nextAttribute().

◆ elements_

ElementStack xmlreader::XmlReader::elements_
private

Definition at line 174 of file xmlreader.hxx.

Referenced by handleElementEnd(), handleEndTag(), and handleStartTag().

◆ end_

char const* xmlreader::XmlReader::end_
private

◆ fileAddress_

void* xmlreader::XmlReader::fileAddress_
private

Definition at line 171 of file xmlreader.hxx.

Referenced by XmlReader(), and ~XmlReader().

◆ fileHandle_

oslFileHandle xmlreader::XmlReader::fileHandle_
private

Definition at line 169 of file xmlreader.hxx.

Referenced by XmlReader(), and ~XmlReader().

◆ fileSize_

sal_uInt64 xmlreader::XmlReader::fileSize_
private

Definition at line 170 of file xmlreader.hxx.

Referenced by XmlReader(), and ~XmlReader().

◆ fileUrl_

OUString const xmlreader::XmlReader::fileUrl_
private

◆ firstAttribute_

bool xmlreader::XmlReader::firstAttribute_
private

Definition at line 180 of file xmlreader.hxx.

Referenced by handleStartTag(), nextAttribute(), and XmlReader().

◆ namespaceIris_

NamespaceIris xmlreader::XmlReader::namespaceIris_
private

Definition at line 172 of file xmlreader.hxx.

Referenced by registerNamespaceIri(), scanNamespaceIri(), and XmlReader().

◆ namespaces_

NamespaceList xmlreader::XmlReader::namespaces_
private

◆ pad_

Pad xmlreader::XmlReader::pad_
private

◆ pos_

char const* xmlreader::XmlReader::pos_
private

◆ state_

State xmlreader::XmlReader::state_
private

The documentation for this class was generated from the following files: