ProteoWizard
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions
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 pwiz::data::peakdata::HandlerFeature pwiz::data::peakdata::HandlerPeak pwiz::data::peakdata::HandlerPeakel RootHandler SecondHandler

List of all members.

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

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

Definition at line 583 of file SAXParser.hpp.


Member Enumeration Documentation

Enumerator:
XMLUnescapeDefault 
NoXMLUnescape 

Definition at line 350 of file SAXParser.hpp.


Constructor & Destructor Documentation

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

Definition at line 599 of file SAXParser.hpp.

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

Definition at line 600 of file SAXParser.hpp.

{}

Member Function Documentation

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

Reimplemented in PrintEventHandler.

Definition at line 585 of file SAXParser.hpp.

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

{return Status::Ok;}
virtual Status pwiz::minimxml::SAXParser::Handler::startElement ( const std::string &  name,
const Attributes attributes,
stream_offset  position 
)
inlinevirtual
virtual Status pwiz::minimxml::SAXParser::Handler::endElement ( const std::string &  name,
stream_offset  position 
)
inlinevirtual

Reimplemented in NestedHandler, FifthHandler, FirstHandler, and PrintEventHandler.

Definition at line 593 of file SAXParser.hpp.

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

{return Status::Ok;}
virtual Status pwiz::minimxml::SAXParser::Handler::characters ( const SAXParser::saxstring text,
stream_offset  position 
)
inlinevirtual
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.

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

{
const Attributes::attribute *attr = attributes.findAttributeByName(name);
if (attr)
result = attr->valueAs<T>(Unescape);
else
result = defaultValue;
return result;
}
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.

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

{
const char *val = attributes.findValueByName(name,Unescape);
if (!val)
val = defaultValue;
return val;
}
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.

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

{
const Attributes::attribute *attr = attributes.findAttributeByName(name);
if (attr)
result = attr->valueAs<T>(XMLUnescapeDefault);
else
result = T();
return result;
}
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.

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

{
const Attributes::attribute *attr = attributes.findAttributeByName(name);
if (attr)
result = attr->getValuePtr(XMLUnescapeDefault);
else
result = "";
return result;
}
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.

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

{
const Attributes::attribute *attr = attributes.findAttributeByName(name.c_str());
if (attr)
result = attr->valueAs<T>(XMLUnescapeDefault);
else
result = defaultValue;
return result;
}

Member Data Documentation

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

When false, no calls to characters() will be made.

Definition at line 320 of file SAXParser.hpp.

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.

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

Definition at line 324 of file SAXParser.hpp.

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: