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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 GradientStopElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~GradientStopElement ()
 
- 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 { GradientStop = 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 3749 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enumerator
GradientStop 

Definition at line 3756 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 11266 of file CCopasiXMLParser.cpp.

References pdelete.

11267 {
11269 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 11309 of file CCopasiXMLParser.cpp.

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

11310 {
11311  switch (mCurrentElement)
11312  {
11313  case GradientStop:
11314 
11315  if (strcmp(pszName, "Stop"))
11317  pszName, "Stop", mParser.getCurrentLineNumber());
11318 
11320 
11321  //reset handler
11323  //call parent handler
11324  mParser.onEndElement(pszName);
11325  break;
11326 
11327  case UNKNOWN_ELEMENT:
11329  break;
11330 
11331  default:
11333  pszName, "???", mParser.getCurrentLineNumber());
11334  break;
11335  }
11336 
11337  return;
11338 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::GradientStopElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 11271 of file CCopasiXMLParser.cpp.

References CLGradientBase::addGradientStop(), CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pGradient, CLGradientStop::setOffset(), CLGradientStop::setStopColor(), and UNKNOWN_ELEMENT.

11273 {
11274  mCurrentElement++; /* We should always be on the next element */
11275 
11276  const char * Offset;
11277  const char * StopColor;
11278  CLGradientStop* pStop = NULL;
11279 
11280  switch (mCurrentElement)
11281  {
11282  case GradientStop:
11283 
11284  if (strcmp(pszName, "Stop"))
11286  pszName, "Stop", mParser.getCurrentLineNumber());
11287 
11288  Offset = mParser.getAttributeValue("offset", papszAttrs);
11289  StopColor = mParser.getAttributeValue("stop-color", papszAttrs);
11290  pStop = new CLGradientStop();
11291  pStop->setOffset(Offset);
11292  pStop->setStopColor(StopColor);
11294  // delete the gradient stop again since the add method made a copy
11295  delete pStop;
11296  break;
11297 
11298  default:
11302  mParser.onStartElement(pszName, papszAttrs);
11303  break;
11304  }
11305 
11306  return;
11307 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
CLGradientBase * pGradient
void setStopColor(const std::string &key)
void addGradientStop(const CLGradientStop *pStop)
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
void setOffset(double x, double y)
int getCurrentLineNumber() const
Definition: CExpat.h:470

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