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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 ModelParameterGroupElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~ModelParameterGroupElement ()
 
- 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 { ModelParameterGroup = 0, Content }
 

Private Attributes

ModelParameterElementmpModelParameterElement
 
ModelParameterGroupElementmpModelParameterGroupElement
 

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 54 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
ModelParameterGroup 
Content 

Definition at line 62 of file CCopasiXMLParser.h.

88 {

Constructor & Destructor Documentation

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

Destructor

Definition at line 368 of file ListOfModelParameterSets.cpp.

References pdelete.

369 {
372 }
#define pdelete(p)
Definition: copasi.h:215
ModelParameterGroupElement * mpModelParameterGroupElement

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 450 of file ListOfModelParameterSets.cpp.

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

451 {
452  switch (mCurrentElement)
453  {
454  case ModelParameterGroup:
455 
456  if (strcmp(pszName, "ModelParameterGroup"))
458  pszName, "ModelParameterGroup", mParser.getCurrentLineNumber());
459 
462 
465 
466  /* Tell the parent element we are done. */
467  mParser.onEndElement(pszName);
468  break;
469 
470  case Content:
471 
472  if (strcmp(pszName, "ModelParameterGroup") &&
473  strcmp(pszName, "ModelParameter"))
474  {
476  pszName, "ModelParameterGroup or ModelParameter", mParser.getCurrentLineNumber());
477  }
478 
479  if (mCommon.pCurrentModelParameter != NULL)
480  {
483  }
484 
485  // Content may be repeated therefore we set to the previous element which is ModelParameterGroup.
487  break;
488 
489  case UNKNOWN_ELEMENT:
491  break;
492 
493  default:
495  pszName, "???", mParser.getCurrentLineNumber());
496  break;
497  }
498 
499  return;
500 }
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
#define START_ELEMENT
std::stack< CModelParameterGroup * > ModelParameterGroupStack
int getCurrentLineNumber() const
Definition: CExpat.h:470
CModelParameter * pCurrentModelParameter
void CCopasiXMLParser::ModelParameterGroupElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 374 of file ListOfModelParameterSets.cpp.

References CCopasiMessage::EXCEPTION, CModelParameter::Group, CCopasiXMLParser::mCommon, MCXML, SCopasiXMLParserCommon::ModelParameterGroupStack, CExpatTemplate< CExpat >::mParser, CModelParameter::setCN(), toEnum(), CModelParameter::TypeNames, and UNKNOWN_ELEMENT.

376 {
377  const char * CN;
378  const char * pType;
380 
381  mpCurrentHandler = NULL;
383 
384  while (mpCurrentHandler == NULL)
385  {
386  mCurrentElement++; /* We should always be on the next element */
387 
388  switch (mCurrentElement)
389  {
390  case ModelParameterGroup:
391 
392  if (strcmp(pszName, "ModelParameterGroup"))
394  pszName, "ModelParameterGroup", mParser.getCurrentLineNumber());
395 
397 
398  // Element specific code.
399  CN = mParser.getAttributeValue("cn", papszAttrs);
400  pType = mParser.getAttributeValue("type", papszAttrs);
402 
403  {
404  CModelParameterGroup * pModelParameterGroup = new CModelParameterGroup(mCommon.ModelParameterGroupStack.top(), Type);
405  pModelParameterGroup->setCN(std::string(CN));
406  mCommon.ModelParameterGroupStack.push(pModelParameterGroup);
407  }
408  return;
409 
410  case Content:
411 
412  if (!strcmp(pszName, "ModelParameterGroup"))
413  {
414  /* If we do not have an etc element handler we create one. */
417 
419  }
420  else if (!strcmp(pszName, "ModelParameter"))
421  {
422  /* If we do not have an etc element handler we create one. */
425 
427  }
428 
429  break;
430 
431  default:
434  break;
435  }
436  }
437 
439 
441  {
442  mLastKnownElement = mCurrentElement;
443  }
444 
445  mParser.onStartElement(pszName, papszAttrs);
446 
447  return;
448 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
static const char * TypeNames[]
ModelParameterGroupElement * mpModelParameterGroupElement
ModelParameterGroupElement(CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
Definition: utility.h:107
std::stack< CModelParameterGroup * > ModelParameterGroupStack
virtual void setCN(const CCopasiObjectName &cn)
int getCurrentLineNumber() const
Definition: CExpat.h:470

Member Data Documentation

ModelParameterElement* CCopasiXMLParser::ModelParameterGroupElement::mpModelParameterElement
private

A pointer to the ModelParameterElement handler

Definition at line 104 of file CCopasiXMLParser.h.

ModelParameterGroupElement* CCopasiXMLParser::ModelParameterGroupElement::mpModelParameterGroupElement
private

A pointer to the ModelParameterGroup Element handler

Definition at line 99 of file CCopasiXMLParser.h.


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