copasi API  0.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
CExpatTemplate< CType > Class Template Reference

#include <CExpat.h>

List of all members.

Public Member Functions

void destroy ()
 CExpatTemplate ()
 ~CExpatTemplate ()
bool create (const XML_Char *pszEncoding=NULL, const XML_Char *pszSep=NULL)
bool parse (const char *pszBuffer, int nLength=-1, bool fIsFinal=true)
bool parseBuffer (int nLength, bool fIsFinal=true)
void * getBuffer (int nLength)
void enableStartElementHandler (bool fEnable=true)
void enableEndElementHandler (bool fEnable=true)
void enableElementHandler (bool fEnable=true)
void enableCharacterDataHandler (bool fEnable=true)
void enableProcessingInstructionHandler (bool fEnable=true)
void enableCommentHandler (bool fEnable=true)
void enableStartCdataSectionHandler (bool fEnable=true)
void enableEndCdataSectionHandler (bool fEnable=true)
void enableCdataSectionHandler (bool fEnable=true)
void enableDefaultHandler (bool fEnable=true, bool fExpand=true)
void enableExternalEntityRefHandler (bool fEnable=true)
void enableUnknownEncodingHandler (bool fEnable=true)
void enableStartNamespaceDeclHandler (bool fEnable=true)
void enableEndNamespaceDeclHandler (bool fEnable=true)
void enableNamespaceDeclHandler (bool fEnable=true)
void enableXmlDeclHandler (bool fEnable=true)
void enableStartDoctypeDeclHandler (bool fEnable=true)
void enableEndDoctypeDeclHandler (bool fEnable=true)
void enableDoctypeDeclHandler (bool fEnable=true)
enum XML_Error getErrorCode ()
const XML_LChar * getErrorString ()
long getCurrentByteIndex ()
int getCurrentLineNumber () const
int getCurrentColumnNumber ()
int getCurrentByteCount ()
const char * getInputContext (int *pnOffset, int *pnSize)
void onStartElement (const XML_Char *pszName, const XML_Char **papszAttrs)
void onEndElement (const XML_Char *pszName)
void onCharacterData (const XML_Char *pszData, int nLength)
void onProcessingInstruction (const XML_Char *pszTarget, const XML_Char *pszData)
void onComment (const XML_Char *pszData)
void onStartCdataSection ()
void onEndCdataSection ()
void onDefault (const XML_Char *pszData, int nLength)
bool onExternalEntityRef (const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID)
bool onUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo)
void onStartNamespaceDecl (const XML_Char *pszPrefix, const XML_Char *pszURI)
void onEndNamespaceDecl (const XML_Char *pszPrefix)
void onXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding, bool fStandalone)
void onStartDoctypeDecl (const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, bool fHasInternalSubset)
void onEndDoctypeDecl ()
const char * getAttributeValue (const std::string &name, const char **attributes, const bool &required=true) const
const char * getAttributeValue (const std::string &name, const char **attributes, const char *def) const

Static Public Member Functions

static const XML_LChar * getErrorString (enum XML_Error nError)
static const XML_LChar * getExpatVersion ()
static void getExpatVersion (int &nMajor, int &nMinor, int &nMicro)
static bool toBool (const char *attribute)

Protected Member Functions

void onPostCreate ()

Static Protected Member Functions

static void startElementHandler (void *pUserData, const XML_Char *pszName, const XML_Char **papszAttrs)
static void endElementHandler (void *pUserData, const XML_Char *pszName)
static void characterDataHandler (void *pUserData, const XML_Char *pszData, int nLength)
static void processingInstructionHandler (void *pUserData, const XML_Char *pszTarget, const XML_Char *pszData)
static void commentHandler (void *pUserData, const XML_Char *pszData)
static void startCdataSectionHandler (void *pUserData)
static void endCdataSectionHandler (void *pUserData)
static void defaultHandler (void *pUserData, const XML_Char *pszData, int nLength)
static int externalEntityRefHandler (void *pUserData, const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID)
static int unknownEncodingHandler (void *pUserData, const XML_Char *pszName, XML_Encoding *pInfo)
static void startNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix, const XML_Char *pszURI)
static void endNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix)
static void xmlDeclHandler (void *pUserData, const XML_Char *pszVersion, const XML_Char *pszEncoding, int nStandalone)
static void startDoctypeDeclHandler (void *pUserData, const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, int nHasInternalSubset)
static void endDoctypeDeclHandler (void *pUserData)

Protected Attributes

XML_Parser mParser

Detailed Description

template<class CType>
class CExpatTemplate< CType >

This file describes the C++ interface to the expat library used by COPASI.

Created for Copasi by Stefan Hoops 2003 Copyright Stefan Hoops CExpatTemplate class. The class CExpatTemplate is a demplate defining a C++ interface to the expat library.

Created for Copasi by Stefan Hoops 2003


Constructor & Destructor Documentation

template<class CType>
CExpatTemplate< CType >::CExpatTemplate ( ) [inline]

Default constructor

template<class CType>
CExpatTemplate< CType >::~CExpatTemplate ( ) [inline]

Destructor


Member Function Documentation

template<class CType>
static void CExpatTemplate< CType >::characterDataHandler ( void *  pUserData,
const XML_Char *  pszData,
int  nLength 
) [inline, static, protected]

Character data handler wrapper

Parameters:
void*pUserData
constXML_Char *pszData
intnLength
template<class CType>
static void CExpatTemplate< CType >::commentHandler ( void *  pUserData,
const XML_Char *  pszData 
) [inline, static, protected]

Comment handler wrapper

Parameters:
void*pUserData
constXML_Char *pszData
template<class CType>
bool CExpatTemplate< CType >::create ( const XML_Char *  pszEncoding = NULL,
const XML_Char *  pszSep = NULL 
) [inline]

Create a parser

Parameters:
constXML_Char *pszEncoding (Default = NULL)
constXML_Char *pszSep (Default = NULL)
template<class CType>
static void CExpatTemplate< CType >::defaultHandler ( void *  pUserData,
const XML_Char *  pszData,
int  nLength 
) [inline, static, protected]

Default wrapper

Parameters:
void*pUserData
constXML_Char *pszData
intnLength
template<class CType>
void CExpatTemplate< CType >::destroy ( ) [inline]

Destroy the parser

template<class CType>
void CExpatTemplate< CType >::enableCdataSectionHandler ( bool  fEnable = true) [inline]

Enable/Disable the CDATA section handlers

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableCharacterDataHandler ( bool  fEnable = true) [inline]

Enable/Disable the character data handler

Parameters:
boolfEnable (Default: true)

Reimplemented in CCopasiXMLParser.

template<class CType>
void CExpatTemplate< CType >::enableCommentHandler ( bool  fEnable = true) [inline]

Enable/Disable the comment handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableDefaultHandler ( bool  fEnable = true,
bool  fExpand = true 
) [inline]

Enable/Disable default handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableDoctypeDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable the DOCTYPE declaration handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableElementHandler ( bool  fEnable = true) [inline]

Enable/Disable the element handlers

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableEndCdataSectionHandler ( bool  fEnable = true) [inline]

Enable/Disable the end CDATA section handlers

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableEndDoctypeDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable the end DOCTYPE declaration handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableEndElementHandler ( bool  fEnable = true) [inline]

Enable/Disable end element handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableEndNamespaceDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable end namespace handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableExternalEntityRefHandler ( bool  fEnable = true) [inline]

Enable/Disable external entity ref handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableNamespaceDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable namespace handlers

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableProcessingInstructionHandler ( bool  fEnable = true) [inline]

Enable/Disable the processing instruction handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableStartCdataSectionHandler ( bool  fEnable = true) [inline]

Enable/Disable the start CDATA section handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableStartDoctypeDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable the start DOCTYPE declaration handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableStartElementHandler ( bool  fEnable = true) [inline]

Enable/Disable the start element handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableStartNamespaceDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable start namespace handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableUnknownEncodingHandler ( bool  fEnable = true) [inline]

Enable/Disable unknown encoding handler

Parameters:
boolfEnable (Default: true)
template<class CType>
void CExpatTemplate< CType >::enableXmlDeclHandler ( bool  fEnable = true) [inline]

Enable/Disable the XML declaration handler

Parameters:
boolfEnable (Default: true)
template<class CType>
static void CExpatTemplate< CType >::endCdataSectionHandler ( void *  pUserData) [inline, static, protected]

End CDATA section wrapper

Parameters:
void*pUserData
template<class CType>
static void CExpatTemplate< CType >::endDoctypeDeclHandler ( void *  pUserData) [inline, static, protected]

End Doctype declaration wrapper

Parameters:
void*pUserData
template<class CType>
static void CExpatTemplate< CType >::endElementHandler ( void *  pUserData,
const XML_Char *  pszName 
) [inline, static, protected]

End element handler wrapper

Parameters:
void*pUserData
constXML_Char *pszName
template<class CType>
static void CExpatTemplate< CType >::endNamespaceDeclHandler ( void *  pUserData,
const XML_Char *  pszPrefix 
) [inline, static, protected]

End namespace decl wrapper

Parameters:
void*pUserData
constXML_Char *pszPrefix
template<class CType>
static int CExpatTemplate< CType >::externalEntityRefHandler ( void *  pUserData,
const XML_Char *  pszContext,
const XML_Char *  pszBase,
const XML_Char *  pszSystemID,
const XML_Char *  pszPublicID 
) [inline, static, protected]

External entity ref wrapper

Parameters:
void*pUserData
constXML_Char *pszContext
constXML_Char *pszBase
constXML_Char *pszSystemID
constXML_Char *pszPublicID
template<class CType>
const char* CExpatTemplate< CType >::getAttributeValue ( const std::string &  name,
const char **  attributes,
const bool &  required = true 
) const [inline]

Retreive the attribute value for the given name out of the list of attributes. If required is true and the attribute is not found an exception is thrown. If required is false and the attribute is not found NULL is returned.

Parameters:
conststd::string & name
constchar ** attributes
constbool & required (default: true)
Returns:
const char * value
template<class CType>
const char* CExpatTemplate< CType >::getAttributeValue ( const std::string &  name,
const char **  attributes,
const char *  def 
) const [inline]

Retreive the attribute value for the given name out of the list of attributes. If the attribute is not found default is returned.

Parameters:
conststd::string & name
constchar ** attributes
constchar * default
Returns:
const char * value
template<class CType>
void* CExpatTemplate< CType >::getBuffer ( int  nLength) [inline]

Get the internal buffer

template<class CType>
int CExpatTemplate< CType >::getCurrentByteCount ( ) [inline]

Get the current byte count

Returns:
in byteCount
template<class CType>
long CExpatTemplate< CType >::getCurrentByteIndex ( ) [inline]

Get the current byte index

Returns:
long byteIndex
template<class CType>
int CExpatTemplate< CType >::getCurrentColumnNumber ( ) [inline]

Get the current column number

Returns:
in cloumnNumber
template<class CType>
int CExpatTemplate< CType >::getCurrentLineNumber ( ) const [inline]

Get the current line number

Returns:
ing lineNumber
template<class CType>
enum XML_Error CExpatTemplate< CType >::getErrorCode ( ) [inline]

Get last error

Returns:
enum XML_Error
template<class CType>
const XML_LChar* CExpatTemplate< CType >::getErrorString ( ) [inline]

Get last error string

Returns:
const XML_LChar * errorString
template<class CType>
static const XML_LChar* CExpatTemplate< CType >::getErrorString ( enum XML_Error  nError) [inline, static]

Get error string

Parameters:
enumXML_Error nError
Returns:
const XML_LChar * errorString
template<class CType>
static const XML_LChar* CExpatTemplate< CType >::getExpatVersion ( ) [inline, static]

Return the version string

Returns:
const XML_LChar * version
template<class CType>
static void CExpatTemplate< CType >::getExpatVersion ( int &  nMajor,
int &  nMinor,
int &  nMicro 
) [inline, static]

Get the version information

Parameters:
intnMajor
intnMinor
intnMicro
template<class CType>
const char* CExpatTemplate< CType >::getInputContext ( int *  pnOffset,
int *  pnSize 
) [inline]

Get the input context char * inputContext

template<class CType>
void CExpatTemplate< CType >::onCharacterData ( const XML_Char *  pszData,
int  nLength 
) [inline]

Character data handler

Parameters:
constXML_Char *pszData
intnLength

Reimplemented in CCopasiXMLParser, and CExpat.

template<class CType>
void CExpatTemplate< CType >::onComment ( const XML_Char *  pszData) [inline]

Comment handler

Parameters:
constXML_Char *pszData

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onDefault ( const XML_Char *  pszData,
int  nLength 
) [inline]

Default handler

Parameters:
constXML_Char *pszData
intnLength

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onEndCdataSection ( ) [inline]

End CDATA section handler

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onEndDoctypeDecl ( ) [inline]

End DOCTYPE declaration handler

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onEndElement ( const XML_Char *  pszName) [inline]

End element handler

Parameters:
constXML_Char *pszName

Reimplemented in CCopasiXMLParser, and CExpat.

template<class CType>
void CExpatTemplate< CType >::onEndNamespaceDecl ( const XML_Char *  pszPrefix) [inline]

End namespace declaration handler

Parameters:
constXML_Char *pszPrefix

Reimplemented in CExpat.

template<class CType>
bool CExpatTemplate< CType >::onExternalEntityRef ( const XML_Char *  pszContext,
const XML_Char *  pszBase,
const XML_Char *  pszSystemID,
const XML_Char *  pszPublicID 
) [inline]

External entity ref handler

Parameters:
constXML_Char *pszContext
constXML_Char *pszBase
constXML_Char *pszSystemID
constXML_Char *pszPublicID

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onPostCreate ( ) [inline, protected]

Handle any post creation

template<class CType>
void CExpatTemplate< CType >::onProcessingInstruction ( const XML_Char *  pszTarget,
const XML_Char *  pszData 
) [inline]

Processing instruction handler

Parameters:
constXML_Char *pszTarget
constXML_Char *pszData

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onStartCdataSection ( ) [inline]

Start CDATA section handler

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onStartDoctypeDecl ( const XML_Char *  pszDoctypeName,
const XML_Char *  pszSysID,
const XML_Char *  pszPubID,
bool  fHasInternalSubset 
) [inline]

Start DOCTYPE declaration handler

Parameters:
constXML_Char *pszDoctypeName
constXML_Char *pszSysID
constXML_Char *pszPubID
boolfHasInternalSubset

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onStartElement ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
) [inline]

Start element handler

Parameters:
constXML_Char *pszName
constXML_Char **papszAttrs

Reimplemented in CCopasiXMLParser, and CExpat.

template<class CType>
void CExpatTemplate< CType >::onStartNamespaceDecl ( const XML_Char *  pszPrefix,
const XML_Char *  pszURI 
) [inline]

Start namespace declaration handler

Parameters:
constXML_Char *pszPrefix
constXML_Char *pszURI

Reimplemented in CExpat.

template<class CType>
bool CExpatTemplate< CType >::onUnknownEncoding ( const XML_Char *  pszName,
XML_Encoding *  pInfo 
) [inline]

Unknown encoding handler

Parameters:
constXML_Char *pszName
XML_Encoding*pInfo

Reimplemented in CExpat.

template<class CType>
void CExpatTemplate< CType >::onXmlDecl ( const XML_Char *  pszVersion,
const XML_Char *  pszEncoding,
bool  fStandalone 
) [inline]

XML declaration handler

Parameters:
constXML_Char *pszVersion
constXML_Char *pszEncoding
boolfStandalone

Reimplemented in CExpat.

template<class CType>
bool CExpatTemplate< CType >::parse ( const char *  pszBuffer,
int  nLength = -1,
bool  fIsFinal = true 
) [inline]

Parse a block of character data

Parameters:
constchar *pszBuffer
intnLength (Default: -1 (zero terminated))
boolfIsFinal (Default: true)
Returns:
bool Success
template<class CType>
bool CExpatTemplate< CType >::parseBuffer ( int  nLength,
bool  fIsFinal = true 
) [inline]

Parse internal buffer

Parameters:
intnLength
boolfIsFinal (Default: true)
Returns:
bool Success
template<class CType>
static void CExpatTemplate< CType >::processingInstructionHandler ( void *  pUserData,
const XML_Char *  pszTarget,
const XML_Char *  pszData 
) [inline, static, protected]

Processing instruction handler wrapper

Parameters:
void*pUserData
constXML_Char *pszTarget
constXML_Char *pszData
template<class CType>
static void CExpatTemplate< CType >::startCdataSectionHandler ( void *  pUserData) [inline, static, protected]

Start CDATA section wrapper

Parameters:
void*pUserData
template<class CType>
static void CExpatTemplate< CType >::startDoctypeDeclHandler ( void *  pUserData,
const XML_Char *  pszDoctypeName,
const XML_Char *  pszSysID,
const XML_Char *  pszPubID,
int  nHasInternalSubset 
) [inline, static, protected]

Start Doctype declaration wrapper

Parameters:
void*pUserData
constXML_Char *pszDoctypeName
constXML_Char *pszSysID
constXML_Char *pszPubID
intnHasInternalSubset
template<class CType>
static void CExpatTemplate< CType >::startElementHandler ( void *  pUserData,
const XML_Char *  pszName,
const XML_Char **  papszAttrs 
) [inline, static, protected]

Start element handler wrapper

Parameters:
void*pUserData
constXML_Char *pszName
constXML_Char **papszAttrs
template<class CType>
static void CExpatTemplate< CType >::startNamespaceDeclHandler ( void *  pUserData,
const XML_Char *  pszPrefix,
const XML_Char *  pszURI 
) [inline, static, protected]

Start namespace decl wrapper

Parameters:
void*pUserData
constXML_Char *pszPrefix
constXML_Char *pszURI
template<class CType>
static bool CExpatTemplate< CType >::toBool ( const char *  attribute) [inline, static]

Convert an attribute of type xs:boolean to bool. If attribute is NULL false is returned.

Parameters:
constchar * attribute
Returns:
bool
template<class CType>
static int CExpatTemplate< CType >::unknownEncodingHandler ( void *  pUserData,
const XML_Char *  pszName,
XML_Encoding *  pInfo 
) [inline, static, protected]

Unknown encoding wrapper

Parameters:
void*pUserData
constXML_Char *pszName
XML_Encoding*pInfo
template<class CType>
static void CExpatTemplate< CType >::xmlDeclHandler ( void *  pUserData,
const XML_Char *  pszVersion,
const XML_Char *  pszEncoding,
int  nStandalone 
) [inline, static, protected]

XML declaration wrapper

Parameters:
void*pUserData
constXML_Char *pszVersion
constXML_Char *pszEncoding
intnStandalone

Member Data Documentation

template<class CType>
XML_Parser CExpatTemplate< CType >::mParser [protected]

The expat parser


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines