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

Public Member Functions

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

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

Member Enumeration Documentation

Enumerator
CurveElement 

Definition at line 4366 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 13014 of file CCopasiXMLParser.cpp.

References pdelete.

13015 {
13017 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 13079 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, MCXML, CExpatTemplate< CExpat >::mParser, START_ELEMENT, and UNKNOWN_ELEMENT.

13080 {
13081  switch (mCurrentElement)
13082  {
13083  case CurveElement:
13084 
13085  if (strcmp(pszName, "Element"))
13087  pszName, "Element", mParser.getCurrentLineNumber());
13088 
13090 
13091  //reset handler
13093  //call parent handler
13094  mParser.onEndElement(pszName);
13095  break;
13096 
13097  case UNKNOWN_ELEMENT:
13099  break;
13100 
13101  default:
13103  pszName, "???", mParser.getCurrentLineNumber());
13104  break;
13105  }
13106 
13107  return;
13108 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::CurveElementElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 13019 of file CCopasiXMLParser.cpp.

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

13021 {
13022  mCurrentElement++; /* We should always be on the next element */
13023 
13024  const char * X;
13025  const char * Y;
13026  const char * Z;
13027  const char * BP1X;
13028  const char * BP1Y;
13029  const char * BP1Z;
13030  const char * BP2X;
13031  const char * BP2Y;
13032  const char * BP2Z;
13033  CLRenderPoint* pCurveElement = NULL;
13034 
13035  switch (mCurrentElement)
13036  {
13037  case CurveElement:
13038 
13039  if (strcmp(pszName, "Element"))
13041  pszName, "Element", mParser.getCurrentLineNumber());
13042 
13043  X = mParser.getAttributeValue("x", papszAttrs);
13044  Y = mParser.getAttributeValue("y", papszAttrs);
13045  Z = mParser.getAttributeValue("z", papszAttrs, "0.0");
13046  BP1X = mParser.getAttributeValue("basePoint1_x", papszAttrs, false);
13047  BP1Y = mParser.getAttributeValue("basePoint1_y", papszAttrs, false);
13048  BP1Z = mParser.getAttributeValue("basePoint1_z", papszAttrs, "0.0");
13049  BP2X = mParser.getAttributeValue("basePoint2_x", papszAttrs, false);
13050  BP2Y = mParser.getAttributeValue("basePoint2_y", papszAttrs, false);
13051  BP2Z = mParser.getAttributeValue("basePoint2_z", papszAttrs, "0.0");
13052 
13053  // for a cubic bezier, x any y value for both basepoints are mandatory
13054  if (BP1X != NULL && BP1Y != NULL && BP2X != NULL && BP2Y != NULL)
13055  {
13056  pCurveElement = new CLRenderCubicBezier(CLRelAbsVector(BP1X), CLRelAbsVector(BP1Y), CLRelAbsVector(BP1Z),
13057  CLRelAbsVector(BP2X), CLRelAbsVector(BP2Y), CLRelAbsVector(BP2Z),
13059  }
13060  else
13061  {
13062  pCurveElement = new CLRenderPoint(CLRelAbsVector(X), CLRelAbsVector(Y), CLRelAbsVector(Z));
13063  }
13064 
13065  mCommon.pListOfCurveElements->push_back(pCurveElement);
13066  break;
13067 
13068  default:
13072  mParser.onStartElement(pszName, papszAttrs);
13073  break;
13074  }
13075 
13076  return;
13077 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
std::vector< CLRenderPoint * > * pListOfCurveElements
int getCurrentLineNumber() const
Definition: CExpat.h:470

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