COPASI API  4.16.103
Public Member Functions | Private Types | Private Attributes | List of all members
CCopasiXMLParser::CharacterDataElement Class Reference
Inheritance diagram for CCopasiXMLParser::CharacterDataElement:
Inheritance graph
[legend]
Collaboration diagram for CCopasiXMLParser::CharacterDataElement:
Collaboration graph
[legend]

Public Member Functions

 CharacterDataElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *pszName)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~CharacterDataElement ()
 
- Public Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
 CXMLElementHandler (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *C_UNUSED(pszName))
 
virtual void reset ()
 
virtual void start (const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
 
virtual ~CXMLElementHandler ()
 

Private Types

enum  Element { CharacterData = 0 }
 

Private Attributes

std::string mCurrentElementName
 

Additional Inherited Members

- Protected Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
void addFix (const std::string &key, CCopasiObject *pObject)
 
void deleteCurrentHandler ()
 
- Protected Attributes inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
SCopasiXMLParserCommonmCommon
 
C_INT32 mCurrentElement
 
C_INT32 mLastKnownElement
 
CCopasiXMLParsermParser
 
CXMLElementHandlermpCurrentHandler
 

Detailed Description

Definition at line 444 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Text

Enumerator
CharacterData 

Definition at line 451 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

CCopasiXMLParser::CharacterDataElement::CharacterDataElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)
CCopasiXMLParser::CharacterDataElement::~CharacterDataElement ( )
virtual

Destructor

Definition at line 1269 of file CCopasiXMLParser.cpp.

1270 {}

Member Function Documentation

void CCopasiXMLParser::CharacterDataElement::end ( const XML_Char *  pszName)
virtual

End element handler

Parameters
constXML_Char *pszName

Definition at line 1295 of file CCopasiXMLParser.cpp.

References SCopasiXMLParserCommon::CharacterData, CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, START_ELEMENT, and UNKNOWN_ELEMENT.

1296 {
1297  switch (mCurrentElement)
1298  {
1299  case CharacterData:
1300 
1301  if (strcmp(pszName, mCurrentElementName.c_str()))
1303  pszName, mCurrentElementName.c_str(), mParser.getCurrentLineNumber());
1304 
1307  mCommon.CharacterData = mParser.getCharacterData("\x0a\x0d\t", "");
1308  {
1309  std::string::size_type Start = mCommon.CharacterData.find_first_not_of(" ");
1310 
1311  if (Start == std::string::npos)
1312  mCommon.CharacterData = "";
1313  else
1314  {
1315  std::string::size_type End = mCommon.CharacterData.find_last_not_of(" ");
1316 
1317  if (End == std::string::npos)
1318  mCommon.CharacterData = mCommon.CharacterData.substr(Start);
1319  else
1320  mCommon.CharacterData = mCommon.CharacterData.substr(Start, End - Start + 1);
1321  }
1322  }
1323  /* Tell the parent element we are done. */
1324  mParser.onEndElement(pszName);
1325  break;
1326 
1327  case UNKNOWN_ELEMENT:
1329  break;
1330 
1331  default:
1333  pszName, "???", mParser.getCurrentLineNumber());
1334  break;
1335  }
1336 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
std::string getCharacterData(const std::string &toBeStripped="", const std::string &join=" ")
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::CharacterDataElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 1272 of file CCopasiXMLParser.cpp.

References CExpatTemplate< CExpat >::mParser, and UNKNOWN_ELEMENT.

1274 {
1275  mCurrentElement++; /* We should always be on the next element */
1276 
1277  switch (mCurrentElement)
1278  {
1279  case CharacterData:
1280  mCurrentElementName = pszName;
1282  break;
1283 
1284  default:
1288  mParser.onStartElement(pszName, papszAttrs);
1289  break;
1290  }
1291 
1292  return;
1293 }
UnknownElement mUnknownElement
void enableCharacterDataHandler(bool fEnable=true)
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)

Member Data Documentation

std::string CCopasiXMLParser::CharacterDataElement::mCurrentElementName
private

Definition at line 484 of file CCopasiXMLParser.h.


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