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

Public Member Functions

 CurveElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *pszName)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~CurveElement ()
 
- 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 {
  Curve = 0, ListOfCurveSegments, CurveSegment, Start,
  End, BasePoint1, BasePoint2
}
 

Private Attributes

size_t mLineNumber
 

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 6299 of file CCopasiXMLParser.cpp.

6300 {}

Member Function Documentation

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

Definition at line 6442 of file CCopasiXMLParser.cpp.

References CLCurve::addCurveSegment(), CCopasiMessage::EXCEPTION, CLLineSegment::isBezier(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurve, SCopasiXMLParserCommon::pLineSegment, and START_ELEMENT.

6443 {
6444  if (!strcmp(pszName, "Curve"))
6445  {
6448 
6449  /* Tell the parent element we are done. */
6450  mParser.onEndElement(pszName);
6451  }
6452  else
6453  {
6454  switch (mCurrentElement)
6455  {
6456  case ListOfCurveSegments:
6457  break;
6458 
6459  case CurveSegment:
6461  //tell the handler where to continue
6463  break;
6464 
6465  case Start:
6466  break;
6467 
6468  case End:
6469 
6470  //tell the handler where to continue, depending on the type of the curve segment
6473 
6474  break;
6475 
6476  case BasePoint1:
6477  break;
6478 
6479  case BasePoint2:
6481  break;
6482 
6483  default:
6485  pszName, "???", mParser.getCurrentLineNumber());
6486  break;
6487  }
6488  }
6489 
6490  return;
6491 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
CLLineSegment * pLineSegment
void addCurveSegment(const CLLineSegment &ls)
Definition: CLCurve.cpp:101
bool isBezier() const
Definition: CLCurve.h:90
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::CurveElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Definition at line 6302 of file CCopasiXMLParser.cpp.

References C_FLOAT64, CLCurve::clear(), CCopasiMessage::EXCEPTION, fatalError, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurve, SCopasiXMLParserCommon::pLineSegment, CLLineSegment::setBase1(), CLLineSegment::setBase2(), CLLineSegment::setEnd(), CLLineSegment::setIsBezier(), CLLineSegment::setStart(), and UNKNOWN_ELEMENT.

6303 {
6304  mCurrentElement++; /* We should always be on hte next element */
6305  // mpCurrentHandler = NULL;
6306  mLineNumber = (size_t) - 1;
6307 
6308  switch (mCurrentElement)
6309  {
6310  case Curve:
6311 
6312  if (strcmp(pszName, "Curve"))
6314  pszName, "Curve", mParser.getCurrentLineNumber());
6315 
6316  if (!mCommon.pCurve) fatalError(); //pCurve must point to a curve of a reaction glyph
6317 
6318  //or a metab reference glyph
6319  mCommon.pCurve->clear();
6320  {
6321  //workload
6322 
6323  /* mCommon.pReactionGlyph = new CLReactionGlyph(name);
6324 
6325  CReaction * pReaction = dynamic_cast< CReaction * >(mCommon.KeyMap.get(reaction));
6326  if (!pReaction) fatalError();
6327  mCommon.pReactionGlyph->setModelObjectKey(pReaction->getKey());
6328 
6329  mCommon.pCurrentLayout->addReactionGlyph(mCommon.pReactionGlyph);
6330  addFix(key, mCommon.pReactionGlyph);*/
6331  }
6332  return;
6333  break;
6334 
6335  case ListOfCurveSegments:
6336 
6337  if (!strcmp(pszName, "ListOfCurveSegments"))
6338  return;
6339 
6340  break;
6341 
6342  case CurveSegment:
6343 
6344  if (!strcmp(pszName, "CurveSegment"))
6345  {
6346  //workload
6347  const char * type;
6348  type = mParser.getAttributeValue("xsi:type", papszAttrs);
6349 
6350  if (!mCommon.pLineSegment)
6352 
6353  mCommon.pLineSegment->setIsBezier(!strcmp(type, "CubicBezier"));
6354  }
6355 
6356  return;
6357  break;
6358 
6359  case Start:
6360 
6361  if (!strcmp(pszName, "Start"))
6362  {
6363  //workload
6364  const char * attr;
6365  attr = mParser.getAttributeValue("x", papszAttrs);
6367  attr = mParser.getAttributeValue("y", papszAttrs);
6370  return;
6371  }
6372 
6373  return;
6374  break;
6375 
6376  case End:
6377 
6378  if (!strcmp(pszName, "End"))
6379  {
6380  //workload
6381  const char * attr;
6382  attr = mParser.getAttributeValue("x", papszAttrs);
6384  attr = mParser.getAttributeValue("y", papszAttrs);
6386  mCommon.pLineSegment->setEnd(CLPoint(dX, dY));
6387  return;
6388  }
6389 
6390  return;
6391  break;
6392 
6393  case BasePoint1:
6394 
6395  if (!strcmp(pszName, "BasePoint1"))
6396  {
6397  //workload
6398  const char * attr;
6399  attr = mParser.getAttributeValue("x", papszAttrs);
6401  attr = mParser.getAttributeValue("y", papszAttrs);
6404  return;
6405  }
6406 
6407  return;
6408  break;
6409 
6410  case BasePoint2:
6411 
6412  if (!strcmp(pszName, "BasePoint2"))
6413  {
6414  //workload
6415  const char * attr;
6416  attr = mParser.getAttributeValue("x", papszAttrs);
6418  attr = mParser.getAttributeValue("y", papszAttrs);
6421  return;
6422  }
6423 
6424  return;
6425  break;
6426 
6427  default:
6430  mParser.onStartElement(pszName, papszAttrs);
6431  break;
6432  }
6433 
6434  // if (mpCurrentHandler)
6435  // mParser.pushElementHandler(mpCurrentHandler);
6436  //
6437  // mParser.onStartElement(pszName, papszAttrs);
6438 
6439  return;
6440 }
UnknownElement mUnknownElement
void setStart(const CLPoint &p)
Definition: CLCurve.h:79
#define fatalError()
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
void setIsBezier(bool b)
Definition: CLCurve.h:91
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
Definition: CLBase.h:54
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
CLLineSegment * pLineSegment
void setBase1(const CLPoint &p)
Definition: CLCurve.h:87
void setBase2(const CLPoint &p)
Definition: CLCurve.h:88
#define C_FLOAT64
Definition: copasi.h:92
void setEnd(const CLPoint &p)
Definition: CLCurve.h:80
int getCurrentLineNumber() const
Definition: CExpat.h:470
void clear()
Definition: CLCurve.cpp:112

Member Data Documentation

size_t CCopasiXMLParser::CurveElement::mLineNumber
private

Definition at line 3302 of file CCopasiXMLParser.h.


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