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 pwiz::data::peakdata::HandlerFeature pwiz::data::peakdata::HandlerPeak pwiz::data::peakdata::HandlerPeakel RootHandler SecondHandler

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. More...
 
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. More...
 
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 More...
 

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

Constructor & Destructor Documentation

§ Handler()

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

Definition at line 599 of file SAXParser.hpp.

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

§ ~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

Reimplemented in PrintEventHandler.

Definition at line 585 of file SAXParser.hpp.

§ 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

§ 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.

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

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  }

§ 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.

References pwiz::minimxml::SAXParser::Handler::Attributes::findValueByName().

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

§ 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.

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

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  }

§ 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.

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

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  }

§ 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.

References pwiz::minimxml::decode_xml_id(), pwiz::minimxml::decode_xml_id_copy(), pwiz::minimxml::SAXParser::Handler::Attributes::findAttributeByName(), pwiz::minimxml::SAXParser::parse(), PWIZ_API_DECL, pwiz::minimxml::SAXParser::Handler::Attributes::attribute::valueAs(), pwiz::minimxml::xml_root_element(), and pwiz::minimxml::xml_root_element_from_file().

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  }

Member Data Documentation

§ parseCharacters

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

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

Definition at line 320 of file SAXParser.hpp.

§ 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.

§ autoUnescapeCharacters

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

Definition at line 324 of file SAXParser.hpp.

§ 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: