ProteoWizard
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
pwiz::minimxml::SAXParser::Handler Class Reference

SAX event handler interface. More...

#include <SAXParser.hpp>

Inheritance diagram for pwiz::minimxml::SAXParser::Handler:
AnotherRootHandler FifthHandler FirstHandler NestedHandler PrintEventHandler RootHandler SecondHandler pwiz::data::peakdata::HandlerFeature pwiz::data::peakdata::HandlerPeak pwiz::data::peakdata::HandlerPeakel

Classes

class  Attributes
 
struct  Status
 Handler returns the Status struct as a means of changing the parser's behavior.
More...
 

Public Types

enum  XMLUnescapeBehavior_t { XMLUnescapeDefault , NoXMLUnescape }
 
typedef boost::iostreams::stream_offset stream_offset
 

Public Member Functions

virtual Status processingInstruction (const std::string &name, const std::string &data, stream_offset position)
 
virtual Status startElement (const std::string &name, const Attributes &attributes, stream_offset position)
 
virtual Status endElement (const std::string &name, stream_offset position)
 
virtual Status characters (const SAXParser::saxstring &text, stream_offset position)
 
 Handler ()
 
virtual ~Handler ()
 

Public Attributes

bool parseCharacters
 When false, no calls to characters() will be made.
 
bool autoUnescapeAttributes
 Setting these to false will disable the auto-unescaping feature of the parser; this is useful for handlers which deal with large amounts of data.
 
bool autoUnescapeCharacters
 
int version
 contextual version available to control handler logic which support multiple versions of a schema; the default value 0 indicates handler should ignore the version; the handler determines the meaning of any non-zero value
 

Protected Member Functions

template<typename T >
T & getAttribute (const Attributes &attributes, const char *name, T &result, XMLUnescapeBehavior_t Unescape, T defaultValue=T()) const
 
const char * getAttribute (const Attributes &attributes, const char *name, XMLUnescapeBehavior_t Unescape, const char *defaultValue=NULL) const
 
template<typename T >
T & getAttribute (const Attributes &attributes, const char *name, T &result) const
 
std::string & getAttribute (const Attributes &attributes, const char *name, std::string &result) const
 
template<typename T >
T & getAttribute (const Attributes &attributes, const std::string &name, T &result, T defaultValue=T()) const
 

Detailed Description

SAX event handler interface.

Definition at line 315 of file SAXParser.hpp.

Member Typedef Documentation

◆ stream_offset

typedef boost::iostreams::stream_offset pwiz::minimxml::SAXParser::Handler::stream_offset

Definition at line 583 of file SAXParser.hpp.

Member Enumeration Documentation

◆ XMLUnescapeBehavior_t

Enumerator
XMLUnescapeDefault 
NoXMLUnescape 

Definition at line 350 of file SAXParser.hpp.

Constructor & Destructor Documentation

◆ Handler()

pwiz::minimxml::SAXParser::Handler::Handler ( )
inline

Definition at line 599 of file SAXParser.hpp.

bool parseCharacters
When false, no calls to characters() will be made.
bool autoUnescapeAttributes
Setting these to false will disable the auto-unescaping feature of the parser; this is useful for han...
int version
contextual version available to control handler logic which support multiple versions of a schema; th...

◆ ~Handler()

virtual pwiz::minimxml::SAXParser::Handler::~Handler ( )
inlinevirtual

Definition at line 600 of file SAXParser.hpp.

600{}

Member Function Documentation

◆ processingInstruction()

virtual Status pwiz::minimxml::SAXParser::Handler::processingInstruction ( const std::string &  name,
const std::string &  data,
stream_offset  position 
)
inlinevirtual

◆ startElement()

virtual Status pwiz::minimxml::SAXParser::Handler::startElement ( const std::string &  name,
const Attributes attributes,
stream_offset  position 
)
inlinevirtual

◆ endElement()

virtual Status pwiz::minimxml::SAXParser::Handler::endElement ( const std::string &  name,
stream_offset  position 
)
inlinevirtual

Reimplemented in PrintEventHandler, FirstHandler, FifthHandler, and NestedHandler.

Definition at line 593 of file SAXParser.hpp.

594 {return Status::Ok;}

References pwiz::minimxml::SAXParser::Handler::Status::Ok.

◆ characters()

virtual Status pwiz::minimxml::SAXParser::Handler::characters ( const SAXParser::saxstring text,
stream_offset  position 
)
inlinevirtual

◆ getAttribute() [1/5]

template<typename T >
T & pwiz::minimxml::SAXParser::Handler::getAttribute ( const Attributes attributes,
const char *  name,
T &  result,
XMLUnescapeBehavior_t  Unescape,
defaultValue = T() 
) const
inlineprotected

Definition at line 605 of file SAXParser.hpp.

610 {
611 const Attributes::attribute *attr = attributes.findAttributeByName(name);
612 if (attr)
613 result = attr->valueAs<T>(Unescape);
614 else
615 result = defaultValue;
616 return result;
617 }
T defaultValue()

References defaultValue(), pwiz::minimxml::SAXParser::Handler::Attributes::findAttributeByName(), and pwiz::minimxml::SAXParser::Handler::Attributes::attribute::valueAs().

Referenced by FifthHandler::startElement().

◆ getAttribute() [2/5]

const char * pwiz::minimxml::SAXParser::Handler::getAttribute ( const Attributes attributes,
const char *  name,
XMLUnescapeBehavior_t  Unescape,
const char *  defaultValue = NULL 
) const
inlineprotected

Definition at line 619 of file SAXParser.hpp.

623 {
624 const char *val = attributes.findValueByName(name,Unescape);
625 if (!val)
626 val = defaultValue;
627 return val;
628 }

References defaultValue(), and pwiz::minimxml::SAXParser::Handler::Attributes::findValueByName().

◆ getAttribute() [3/5]

template<typename T >
T & pwiz::minimxml::SAXParser::Handler::getAttribute ( const Attributes attributes,
const char *  name,
T &  result 
) const
inlineprotected

Definition at line 633 of file SAXParser.hpp.

636 {
637 const Attributes::attribute *attr = attributes.findAttributeByName(name);
638 if (attr)
639 result = attr->valueAs<T>(XMLUnescapeDefault);
640 else
641 result = T();
642 return result;
643 }

References pwiz::minimxml::SAXParser::Handler::Attributes::findAttributeByName(), pwiz::minimxml::SAXParser::Handler::Attributes::attribute::valueAs(), and XMLUnescapeDefault.

◆ getAttribute() [4/5]

std::string & pwiz::minimxml::SAXParser::Handler::getAttribute ( const Attributes attributes,
const char *  name,
std::string &  result 
) const
inlineprotected

Definition at line 645 of file SAXParser.hpp.

648 {
649 const Attributes::attribute *attr = attributes.findAttributeByName(name);
650 if (attr)
651 result = attr->getValuePtr(XMLUnescapeDefault);
652 else
653 result = "";
654 return result;
655 }

References pwiz::minimxml::SAXParser::Handler::Attributes::findAttributeByName(), pwiz::minimxml::SAXParser::Handler::Attributes::attribute::getValuePtr(), and XMLUnescapeDefault.

◆ getAttribute() [5/5]

template<typename T >
T & pwiz::minimxml::SAXParser::Handler::getAttribute ( const Attributes attributes,
const std::string &  name,
T &  result,
defaultValue = T() 
) const
inlineprotected

Definition at line 659 of file SAXParser.hpp.

663 {
664 const Attributes::attribute *attr = attributes.findAttributeByName(name.c_str());
665 if (attr)
666 result = attr->valueAs<T>(XMLUnescapeDefault);
667 else
668 result = defaultValue;
669 return result;
670 }

References defaultValue(), pwiz::minimxml::SAXParser::Handler::Attributes::findAttributeByName(), pwiz::minimxml::SAXParser::Handler::Attributes::attribute::valueAs(), and XMLUnescapeDefault.

Member Data Documentation

◆ parseCharacters

bool pwiz::minimxml::SAXParser::Handler::parseCharacters

◆ autoUnescapeAttributes

bool pwiz::minimxml::SAXParser::Handler::autoUnescapeAttributes

Setting these to false will disable the auto-unescaping feature of the parser; this is useful for handlers which deal with large amounts of data.

Definition at line 324 of file SAXParser.hpp.

Referenced by FifthHandler::FifthHandler(), FirstHandler::FirstHandler(), RootHandler::RootHandler(), and SecondHandler::SecondHandler().

◆ autoUnescapeCharacters

bool pwiz::minimxml::SAXParser::Handler::autoUnescapeCharacters

◆ version

int pwiz::minimxml::SAXParser::Handler::version

contextual version available to control handler logic which support multiple versions of a schema; the default value 0 indicates handler should ignore the version; the handler determines the meaning of any non-zero value

Definition at line 329 of file SAXParser.hpp.


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