COPASI API
4.40.278
|
#include <CXMLParser.h>
Public Member Functions | |
CXMLParser (CVersion &version) | |
void | enableCharacterDataHandler (bool fEnable=true) |
std::string | getCharacterData (const std::string &toBeStripped="", const std::string &join=" ") |
const CCopasiParameterGroup * | getCurrentGroup () const |
CXMLHandler * | getHandler (const CXMLHandler::Type &type) |
CListOfLayouts * | getLayoutList () const |
CModel * | getModel () const |
COutputDefinitionVector * | getPlotList () const |
CReportDefinitionVector * | getReportList () const |
CDataVectorN< CCopasiTask > * | getTaskList () const |
CUnitDefinitionDB * | getUnitDefinitionImportList () const |
virtual void | onCharacterData (const XML_Char *pszData, int nLength) |
virtual void | onEndElement (const XML_Char *pszName) |
virtual void | onSkippedEntityHandler (const XML_Char *entityName, int is_parameter_entity) |
virtual void | onStartElement (const XML_Char *pszName, const XML_Char **papszAttrs) |
void | popElementHandler () |
void | pushElementHandler (CXMLHandler *pElementHandler) |
void | setCharacterEncoding (const CCopasiXMLInterface::EncodingType &encoding) |
void | setDatamodel (CDataModel *pDataModel) |
void | setFunctionList (CDataVectorN< CFunction > *pFunctionList) |
void | setGUI (SCopasiXMLGUI *pGUI) |
void | setLayoutList (CListOfLayouts *pLayoutList) |
~CXMLParser () | |
Public Member Functions inherited from CExpat | |
CExpat () | |
virtual void | onComment (const XML_Char *pszData) |
virtual void | onDefault (const XML_Char *pszData, int nLength) |
virtual void | onEndCdataSection () |
virtual void | onEndDoctypeDecl () |
virtual void | onEndNamespaceDecl (const XML_Char *pszPrefix) |
virtual bool | onExternalEntityRef (const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID) |
virtual void | onProcessingInstruction (const XML_Char *pszTarget, const XML_Char *pszData) |
virtual void | onStartCdataSection () |
virtual void | onStartDoctypeDecl (const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, bool fHasInternalSubset) |
virtual void | onStartNamespaceDecl (const XML_Char *pszPrefix, const XML_Char *pszURI) |
virtual bool | onUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo) |
virtual void | onXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding, bool fStandalone) |
virtual | ~CExpat () |
Public Member Functions inherited from CExpatTemplate< CExpat > | |
CExpatTemplate () | |
bool | create (const XML_Char *pszEncoding=NULL, const XML_Char *pszSep=NULL) |
void | destroy () |
void | enableCdataSectionHandler (bool fEnable=true) |
void | enableCharacterDataHandler (bool fEnable=true) |
void | enableCommentHandler (bool fEnable=true) |
void | enableDefaultHandler (bool fEnable=true, bool fExpand=true) |
void | enableDoctypeDeclHandler (bool fEnable=true) |
void | enableElementHandler (bool fEnable=true) |
void | enableEndCdataSectionHandler (bool fEnable=true) |
void | enableEndDoctypeDeclHandler (bool fEnable=true) |
void | enableEndElementHandler (bool fEnable=true) |
void | enableEndNamespaceDeclHandler (bool fEnable=true) |
void | enableExternalEntityRefHandler (bool fEnable=true) |
void | enableNamespaceDeclHandler (bool fEnable=true) |
void | enableProcessingInstructionHandler (bool fEnable=true) |
void | enableSkippedEntityHandler (bool fEnable=true) |
void | enableStartCdataSectionHandler (bool fEnable=true) |
void | enableStartDoctypeDeclHandler (bool fEnable=true) |
void | enableStartElementHandler (bool fEnable=true) |
void | enableStartNamespaceDeclHandler (bool fEnable=true) |
void | enableUnknownEncodingHandler (bool fEnable=true) |
void | enableXmlDeclHandler (bool fEnable=true) |
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 |
void * | getBuffer (int nLength) |
int | getCurrentByteCount () |
long | getCurrentByteIndex () |
int | getCurrentColumnNumber () |
int | getCurrentLineNumber () const |
enum XML_Error | getErrorCode () |
const XML_LChar * | getErrorString () |
const char * | getInputContext (int *pnOffset, int *pnSize) |
void | onCharacterData (const XML_Char *pszData, int nLength) |
void | onComment (const XML_Char *pszData) |
void | onDefault (const XML_Char *pszData, int nLength) |
void | onEndCdataSection () |
void | onEndDoctypeDecl () |
void | onEndElement (const XML_Char *pszName) |
void | onEndNamespaceDecl (const XML_Char *pszPrefix) |
bool | onExternalEntityRef (const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID) |
void | onProcessingInstruction (const XML_Char *pszTarget, const XML_Char *pszData) |
void | onSkippedEntityHandler (const XML_Char *, int) |
void | onStartCdataSection () |
void | onStartDoctypeDecl (const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, bool fHasInternalSubset) |
void | onStartElement (const XML_Char *pszName, const XML_Char **papszAttrs) |
void | onStartNamespaceDecl (const XML_Char *pszPrefix, const XML_Char *pszURI) |
bool | onUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo) |
void | onXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding, bool fStandalone) |
bool | parse (const char *pszBuffer, int nLength=-1, bool fIsFinal=true) |
bool | parseBuffer (int nLength, bool fIsFinal=true) |
~CExpatTemplate () | |
Private Member Functions | |
CXMLParser () | |
Private Attributes | |
std::string | mCharacterData |
CCopasiXMLInterface::EncodingType | mCharacterDataEncoding |
CXMLParserData | mData |
std::stack< CXMLHandler * > | mElementHandlerStack |
CXMLHandlerFactory * | mpFactory |
Additional Inherited Members | |
Static Public Member Functions inherited from CExpatTemplate< CExpat > | |
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 inherited from CExpatTemplate< CExpat > | |
void | onPostCreate () |
Static Protected Member Functions inherited from CExpatTemplate< CExpat > | |
static void | characterDataHandler (void *pUserData, const XML_Char *pszData, int nLength) |
static void | commentHandler (void *pUserData, const XML_Char *pszData) |
static void | defaultHandler (void *pUserData, const XML_Char *pszData, int nLength) |
static void | endCdataSectionHandler (void *pUserData) |
static void | endDoctypeDeclHandler (void *pUserData) |
static void | endElementHandler (void *pUserData, const XML_Char *pszName) |
static void | endNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix) |
static int | externalEntityRefHandler (XML_Parser pUserData, const XML_Char *pszContext, const XML_Char *pszBase, const XML_Char *pszSystemID, const XML_Char *pszPublicID) |
static void | processingInstructionHandler (void *pUserData, const XML_Char *pszTarget, const XML_Char *pszData) |
static void | skippedEntityHandler (void *pUserData, const XML_Char *entityName, int is_parameter_entity) |
static void | startCdataSectionHandler (void *pUserData) |
static void | startDoctypeDeclHandler (void *pUserData, const XML_Char *pszDoctypeName, const XML_Char *pszSysID, const XML_Char *pszPubID, int nHasInternalSubset) |
static void | startElementHandler (void *pUserData, const XML_Char *pszName, const XML_Char **papszAttrs) |
static void | startNamespaceDeclHandler (void *pUserData, const XML_Char *pszPrefix, const XML_Char *pszURI) |
static int | unknownEncodingHandler (void *pUserData, const XML_Char *pszName, XML_Encoding *pInfo) |
static void | xmlDeclHandler (void *pUserData, const XML_Char *pszVersion, const XML_Char *pszEncoding, int nStandalone) |
Protected Attributes inherited from CExpatTemplate< CExpat > | |
XML_Parser | mParser |
CXMLParser class. This class is the parses a COPASI XML file.
Created for COPASI by Stefan Hoops 2003 Copyright Stefan Hoops
|
private |
Constructor
CXMLParser::CXMLParser | ( | CVersion & | version | ) |
Public constructor
CVersion | & version |
CXMLParser class. This class parses a COPASI XML file.
Created for COPASI by Stefan Hoops 2003 Copyright Stefan Hoops
References CXMLHandler::COPASI, CExpatTemplate< CExpat >::create(), CExpatTemplate< CExpat >::enableElementHandler(), CXMLHandlerFactory::getHandler(), mData, mElementHandlerStack, mpFactory, and CXMLParserData::pVersion.
CXMLParser::~CXMLParser | ( | ) |
Destructor
References mData, mpFactory, pdelete, CXMLParserData::pLineSegment, and CXMLParserData::pUnitDefinitionImportList.
void CXMLParser::enableCharacterDataHandler | ( | bool | fEnable = true | ) |
Enable/Disable the character data handler
bool | fEnable (Default: true) |
References CExpatTemplate< CExpat >::enableCharacterDataHandler(), and mCharacterData.
Referenced by getCharacterData(), CommentHandler::processEnd(), MiriamAnnotationHandler::processEnd(), UnsupportedAnnotationHandler::processEnd(), CharacterDataHandler::processStart(), CommentHandler::processStart(), MiriamAnnotationHandler::processStart(), and UnsupportedAnnotationHandler::processStart().
std::string CXMLParser::getCharacterData | ( | const std::string & | toBeStripped = "" , |
const std::string & | join = " " |
||
) |
Retrieve the data. Any sequence of toBeStripped characters is replaced by a single join character. The default is no stripping.
const | std::string & toBeStripped (default: "") |
const | std::string & join (default: " ") |
References enableCharacterDataHandler(), and mCharacterData.
Referenced by CharacterDataHandler::processEnd(), CommentHandler::processEnd(), MiriamAnnotationHandler::processEnd(), UnsupportedAnnotationHandler::processEnd(), CommentHandler::processStart(), MiriamAnnotationHandler::processStart(), and UnsupportedAnnotationHandler::processStart().
const CCopasiParameterGroup * CXMLParser::getCurrentGroup | ( | ) | const |
Retrieve a pointer to the current group if available
References mData, and CXMLParserData::pCurrentParameter.
Referenced by CConfigurationFile::CXML::load().
CXMLHandler * CXMLParser::getHandler | ( | const CXMLHandler::Type & | type | ) |
References CXMLHandlerFactory::getHandler(), and mpFactory.
Referenced by CXMLHandler::getHandler().
CListOfLayouts * CXMLParser::getLayoutList | ( | ) | const |
Retrieve the list of loaded layouts
References mData, and CXMLParserData::pLayoutList.
Referenced by CCopasiXML::load().
CModel * CXMLParser::getModel | ( | ) | const |
Retrieve the loaded model functions
References mData, and CXMLParserData::pModel.
Referenced by CCopasiXML::load().
COutputDefinitionVector * CXMLParser::getPlotList | ( | ) | const |
Retrieve the list of loaded functions
References mData, and CXMLParserData::pPlotList.
Referenced by CCopasiXML::load().
CReportDefinitionVector * CXMLParser::getReportList | ( | ) | const |
Retrieve the list of loaded reports
References mData, and CXMLParserData::pReportList.
Referenced by CCopasiXML::load().
CDataVectorN< CCopasiTask > * CXMLParser::getTaskList | ( | ) | const |
Retrieve the list of loaded functions
References mData, and CXMLParserData::pTaskList.
Referenced by CCopasiXML::load().
CUnitDefinitionDB * CXMLParser::getUnitDefinitionImportList | ( | ) | const |
Retrieve Unit Definitions to be added to the Root Container's global list.
References mData, and CXMLParserData::pUnitDefinitionImportList.
Referenced by CCopasiXML::load().
|
virtual |
Character data handler
const | XML_Char *pszData |
int | nLength |
Reimplemented from CExpat.
References CCopasiXMLInterface::encode(), mCharacterData, and mCharacterDataEncoding.
|
virtual |
End element handler
const | XML_Char *pszName |
Reimplemented from CExpat.
References CExpatTemplate< CExpat >::getCurrentLineNumber(), and mElementHandlerStack.
Referenced by CharacterDataHandler::end(), CommentHandler::end(), CXMLHandler::end(), MiriamAnnotationHandler::end(), UNKNOWNHandler::end(), and UnsupportedAnnotationHandler::end().
|
virtual |
Skipped entity handler This is called in two situations: 1) An entity reference is encountered for which no declaration has been read and this is not an error. 2) An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called. Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values
const | XML_Char *entityName |
int | is_parameter_entity |
Reimplemented from CExpat.
References mCharacterData.
|
virtual |
Start element handler
const | XML_Char *pszName |
const | XML_Char **papszAttrs |
Reimplemented from CExpat.
References CExpatTemplate< CExpat >::getCurrentLineNumber(), and mElementHandlerStack.
Referenced by CXMLHandler::start().
void CXMLParser::popElementHandler | ( | ) |
Pop the element handler form the stack.
References mElementHandlerStack.
Referenced by CharacterDataHandler::end(), CommentHandler::end(), CXMLHandler::end(), MiriamAnnotationHandler::end(), UNKNOWNHandler::end(), and UnsupportedAnnotationHandler::end().
void CXMLParser::pushElementHandler | ( | CXMLHandler * | pElementHandler | ) |
Push the element handler on the stack.
CXMLHandler | * pElementHandler |
References mElementHandlerStack.
Referenced by CXMLHandler::start().
void CXMLParser::setCharacterEncoding | ( | const CCopasiXMLInterface::EncodingType & | encoding | ) |
References mCharacterDataEncoding.
Referenced by CommentHandler::processEnd(), and CommentHandler::processStart().
void CXMLParser::setDatamodel | ( | CDataModel * | pDataModel | ) |
Set the datamodel.
CDataModel* | pDataModel |
References mData, and CXMLParserData::pDataModel.
Referenced by CCopasiXML::load().
void CXMLParser::setFunctionList | ( | CDataVectorN< CFunction > * | pFunctionList | ) |
Set the list of loaded functions
CDataVectorN< | CFunction > * pFunctionList |
References mData, and CXMLParserData::pFunctionList.
Referenced by CCopasiXML::load().
void CXMLParser::setGUI | ( | SCopasiXMLGUI * | pGUI | ) |
Set the GUI information to be saved
SCopasiXMLGUI | * pGUI |
References mData, and CXMLParserData::pGUI.
Referenced by CCopasiXML::load().
void CXMLParser::setLayoutList | ( | CListOfLayouts * | pLayoutList | ) |
Set the list of loaded layouts
CListOfLayouts | * pLayoutList |
References mData, and CXMLParserData::pLayoutList.
Referenced by CCopasiXML::load().
|
private |
The character data.
Referenced by enableCharacterDataHandler(), getCharacterData(), onCharacterData(), and onSkippedEntityHandler().
|
private |
The character data.
Referenced by onCharacterData(), and setCharacterEncoding().
|
private |
Attributes accessible through the whole parser.
Referenced by CXMLParser(), getCurrentGroup(), getLayoutList(), getModel(), getPlotList(), getReportList(), getTaskList(), getUnitDefinitionImportList(), setDatamodel(), setFunctionList(), setGUI(), setLayoutList(), and ~CXMLParser().
|
private |
The element handler stack
Referenced by CXMLParser(), onEndElement(), onStartElement(), popElementHandler(), and pushElementHandler().
|
private |
The handler factory managing all needed handlers
Referenced by CXMLParser(), getHandler(), and ~CXMLParser().