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

Public Member Functions

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

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Destructor

Definition at line 13117 of file CCopasiXMLParser.cpp.

References pdelete.

13118 {
13120 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 13206 of file CCopasiXMLParser.cpp.

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

13207 {
13208  switch (mCurrentElement)
13209  {
13210  case LineEnding:
13211 
13212  if (strcmp(pszName, "LineEnding"))
13214  pszName, "LineEnding", mParser.getCurrentLineNumber());
13215 
13217  mCommon.pLineEnding = NULL;
13218 
13219  //reset handler
13221  //call parent handler
13222  mParser.onEndElement(pszName);
13223  break;
13224 
13225  case BoundingBox:
13226 
13227  if (strcmp(pszName, "BoundingBox"))
13229  pszName, "BoundingBox", mParser.getCurrentLineNumber());
13230 
13232  break;
13233 
13234  case Group:
13235 
13236  if (strcmp(pszName, "Group"))
13238  pszName, "Group", mParser.getCurrentLineNumber());
13239 
13240  //tell the handler where to continue
13243  break;
13244 
13245  case UNKNOWN_ELEMENT:
13246  mCurrentElement = mLastKnownElement;
13247  break;
13248 
13249  default:
13251  pszName, "???", mParser.getCurrentLineNumber());
13252  break;
13253  }
13254 
13255  return;
13256 }
CLLineEnding * pLineEnding
#define pdelete(p)
Definition: copasi.h:215
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::LineEndingElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 13122 of file CCopasiXMLParser.cpp.

References CLRenderInformationBase::addLineEnding(), CCopasiMessage::EXCEPTION, CLRenderInformationBase::getLineEnding(), CLRenderInformationBase::getNumLineEndings(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pLineEnding, SCopasiXMLParserCommon::pRenderInformation, CLLineEnding::setEnableRotationalMapping(), CLLineEnding::setId(), and UNKNOWN_ELEMENT.

13124 {
13125  mCurrentElement++; /* We should always be on the next element */
13126  mpCurrentHandler = NULL;
13127 
13128  const char * Id;
13129  const char * EnableRotationalMapping;
13130  CLLineEnding* pLineEnding = NULL;
13131 
13132  switch (mCurrentElement)
13133  {
13134  case LineEnding:
13135 
13136  if (strcmp(pszName, "LineEnding"))
13138  pszName, "LineEnding", mParser.getCurrentLineNumber());
13139 
13140  Id = mParser.getAttributeValue("id", papszAttrs);
13141  EnableRotationalMapping = mParser.getAttributeValue("enableRotationalMapping", papszAttrs, "true");
13142  pLineEnding = new CLLineEnding();
13143  pLineEnding->setId(Id);
13144 
13145  if (!strcmp(EnableRotationalMapping, "true"))
13146  {
13147  pLineEnding->setEnableRotationalMapping(true);
13148  }
13149  else
13150  {
13151  pLineEnding->setEnableRotationalMapping(false);
13152  }
13153 
13155  // delete the line ending again since the addLineEnding method made a copy
13156  delete pLineEnding;
13159  break;
13160 
13161  case BoundingBox:
13162 
13163  //only one type of tags may occur here, so we can throw an exception.
13164  //No need to silently ignore unknown tags here.
13165  if (strcmp(pszName, "BoundingBox"))
13167  pszName, "BoundingBox", mParser.getCurrentLineNumber());
13168 
13169  //only one type of tags may occur here, so if the handler exists
13170  //it must be the correct one
13171  if (!mpCurrentHandler)
13172  mpCurrentHandler = new BoundingBoxElement(mParser, mCommon);
13173 
13175  mpCurrentHandler->start(pszName, papszAttrs);
13176  break;
13177 
13178  case Group:
13179 
13180  //only one type of tags may occur here, so we can throw an exception.
13181  //No need to silently ignore unknown tags here.
13182  if (strcmp(pszName, "Group"))
13184  pszName, "Group", mParser.getCurrentLineNumber());
13185 
13186  //only one type of tags may occur here, so if the handler exists
13187  //it must be the correct one
13188  if (!mpCurrentHandler)
13189  mpCurrentHandler = new GroupElement(mParser, mCommon);
13190 
13192  mpCurrentHandler->start(pszName, papszAttrs);
13193  break;
13194 
13195  default:
13199  mParser.onStartElement(pszName, papszAttrs);
13200  break;
13201  }
13202 
13203  return;
13204 }
CLLineEnding * pLineEnding
void addLineEnding(const CLLineEnding *le)
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
void setId(const std::string &id)
CLRenderInformationBase * pRenderInformation
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
CLLineEnding * getLineEnding(size_t index)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
virtual void start(const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
Definition: CXMLHandler.h:87
int getCurrentLineNumber() const
Definition: CExpat.h:470
void setEnableRotationalMapping(bool enable)

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