BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Member Functions | Static Public Member Functions | Protected Member Functions
BeeeOn::SAXHelper Class Reference
Inheritance diagram for BeeeOn::SAXHelper:
BeeeOn::Loggable

Public Member Functions

virtual void processingInstruction (const Poco::XML::XMLString &target, const Poco::XML::XMLString &data)
 
virtual void skippedEntity (const Poco::XML::XMLString &name)
 
virtual void ignorableWhitespace (const Poco::XML::XMLChar c[], int start, int length) override
 
virtual void characters (const Poco::XML::XMLChar c[], int start, int length) override
 
void startDocument () override
 
void endDocument () override
 
void startElement (const Poco::XML::XMLString &uri, const Poco::XML::XMLString &localName, const Poco::XML::XMLString &qName, const Poco::XML::Attributes &attrList) override
 
void endElement (const Poco::XML::XMLString &uri, const Poco::XML::XMLString &localName, const Poco::XML::XMLString &qName) override
 
virtual void startPrefixMapping (const Poco::XML::XMLString &prefix, const Poco::XML::XMLString &uri) override
 
virtual void endPrefixMapping (const Poco::XML::XMLString &prefix) override
 
void setDocumentLocator (const Poco::XML::Locator *loc) override
 
virtual void notationDecl (const Poco::XML::XMLString &name, const Poco::XML::XMLString *publicId, const Poco::XML::XMLString *systemId) override
 
virtual void unparsedEntityDecl (const Poco::XML::XMLString &name, const Poco::XML::XMLString *publicId, const Poco::XML::XMLString &systemId, const Poco::XML::XMLString &notationName) override
 
- Public Member Functions inherited from BeeeOn::Loggable
 Loggable (const ClassInfo &info)
 
 Loggable (const std::type_info &info)
 

Static Public Member Functions

static void parse (const Poco::Path &path, SAXHelper &helper)
 
- Static Public Member Functions inherited from BeeeOn::Loggable
static Poco::Logger & forMethod (const char *name)
 
static Poco::Logger & forClass (const ClassInfo &info)
 
static Poco::Logger & forClass (const std::type_info &info)
 
template<typename T >
static Poco::Logger & forInstance (const T *i)
 
static void configureSimple (Poco::Logger &logger, const std::string &level)
 
static void logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line)
 

Protected Member Functions

virtual bool expectElement (const SAXElement &element) const
 
virtual void startElement (const SAXElement &element, const Poco::XML::Attributes &attrList)
 
virtual void endElement (const SAXElement &element)
 
virtual bool expectContent (int length) const
 
virtual void preprocessContent (const Poco::XML::XMLChar c[], int &start, int &length)
 
void trimContent (const Poco::XML::XMLChar c[], int &start, int &length)
 
void appendContent (const Poco::XML::XMLChar c[], int start, int length)
 
void appendContent (const Poco::XML::XMLString &s)
 
bool getAndTrimAttribute (const Poco::XML::Attributes &attrList, const Poco::XML::XMLString &name, Poco::XML::XMLString &value) const
 
bool getAttributeAsDouble (const Poco::XML::Attributes &attrList, const Poco::XML::XMLString &name, double &value) const
 
bool getAttributeAsInt (const Poco::XML::Attributes &attrList, const Poco::XML::XMLString &name, int &value) const
 
void error (const std::string &message) const
 
void fatal (const std::string &message) const
 
const std::string beginMessage () const
 
const Poco::XML::Locator & locator () const
 
const std::deque< SAXElement > & path () const
 
const SAXElementcurrent () const
 
const SAXElementparent () const
 
template<typename T >
bool isPathFromRoot (const T &name) const
 
template<typename T , typename... Ts>
bool isPathFromRoot (const T &name, const Ts &...ts) const
 
- Protected Member Functions inherited from BeeeOn::Loggable
void setupLogger (Poco::Logger *logger=0) const
 
Poco::Logger & logger () const
 

Member Function Documentation

void BeeeOn::SAXHelper::appendContent ( const Poco::XML::XMLChar  c[],
int  start,
int  length 
)
protected

Apend characters into the buffer of the current element. The buffer is accessible as current().content.

void BeeeOn::SAXHelper::appendContent ( const Poco::XML::XMLString &  s)
protected

Apend characters into the buffer of the current element. The buffer is accessible as current().content.

const string SAXHelper::beginMessage ( ) const
protected

Return begin of an error or failure message.

void SAXHelper::characters ( const Poco::XML::XMLChar  c[],
int  start,
int  length 
)
overridevirtual

The default implementation tests expectContent and if succeeds it calls simply appendContent. If no content is expected, it generates an error.

const SAXElement & SAXHelper::current ( ) const
protected

Current element being processed.

void SAXHelper::endDocument ( )
override

Expects the root SAXElement as the last one on the path.

void BeeeOn::SAXHelper::endElement ( const Poco::XML::XMLString &  uri,
const Poco::XML::XMLString &  localName,
const Poco::XML::XMLString &  qName 
)
override

Check whether the closing element is expected, pops the one on top of the path and calls user defined endElement().

void SAXHelper::endElement ( const SAXElement element)
protectedvirtual

Handle end-element event. This is up to the user to implement it.

void SAXHelper::error ( const std::string &  message) const
protected

Throw exception with the given error message.

bool SAXHelper::expectContent ( int  length) const
protectedvirtual

Return true when a content is expected for the current path and with the given length.

bool SAXHelper::expectElement ( const SAXElement element) const
protectedvirtual

Return true when the given element is expected. This is up to the user to implement it.

void SAXHelper::fatal ( const std::string &  message) const
protected

Throw exception with the given fatal message.

bool SAXHelper::getAndTrimAttribute ( const Poco::XML::Attributes &  attrList,
const Poco::XML::XMLString &  name,
Poco::XML::XMLString &  value 
) const
protected

Obtain trimmed attribute value by the given name. Returns false when no such attribute exists.

bool SAXHelper::getAttributeAsDouble ( const Poco::XML::Attributes &  attrList,
const Poco::XML::XMLString &  name,
double &  value 
) const
protected

Obtain attribute value as double by the given name. Returns false when no such attribute exists.

bool SAXHelper::getAttributeAsInt ( const Poco::XML::Attributes &  attrList,
const Poco::XML::XMLString &  name,
int &  value 
) const
protected

Obtain attribute value as int by the given name. Returns false when no such attribute exists.

void SAXHelper::ignorableWhitespace ( const Poco::XML::XMLChar  c[],
int  start,
int  length 
)
overridevirtual

Whitespace is ignored as default.

template<typename T >
bool BeeeOn::SAXHelper::isPathFromRoot ( const T &  name) const
inlineprotected

Test for XPath expression: /<name>

template<typename T , typename... Ts>
bool BeeeOn::SAXHelper::isPathFromRoot ( const T &  name,
const Ts &...  ts 
) const
inlineprotected

Test for XPath expression: /<name0>{/<name1>...}*

const Locator & SAXHelper::locator ( ) const
protected

Access locator.

const SAXElement & SAXHelper::parent ( ) const
protected

Access parent element.

const deque< SAXElement > & SAXHelper::path ( ) const
protected

Stack of seen elements.

void SAXHelper::preprocessContent ( const Poco::XML::XMLChar  c[],
int &  start,
int &  length 
)
protectedvirtual

Allow to preprocess data by characters() call before passing to appendContent.

void SAXHelper::startDocument ( )
override

Inserts the root SAXElement into path.

void BeeeOn::SAXHelper::startElement ( const Poco::XML::XMLString &  uri,
const Poco::XML::XMLString &  localName,
const Poco::XML::XMLString &  qName,
const Poco::XML::Attributes &  attrList 
)
override

Check whether the incoming element is expected, push it on top of the path and calls user defined startElement().

void SAXHelper::startElement ( const SAXElement element,
const Poco::XML::Attributes &  attrList 
)
protectedvirtual

Handle start-element event. This is up to the user to implement it.

void SAXHelper::trimContent ( const Poco::XML::XMLChar  c[],
int &  start,
int &  length 
)
protected

Trim whitespace of the given content.


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