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

Public Member Functions

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

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 7519 of file CCopasiXMLParser.cpp.

7520 {}

Member Function Documentation

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

Definition at line 7647 of file CCopasiXMLParser.cpp.

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

7648 {
7649  if (!strcmp(pszName, "TextGlyph"))
7650  {
7653 
7654  /* Tell the parent element we are done. */
7655  mParser.onEndElement(pszName);
7656  }
7657  else
7658  {
7659  switch (mCurrentElement)
7660  {
7661  case BoundingBox:
7662  break;
7663 
7664  case Position:
7665  break;
7666 
7667  case Dimensions:
7668  //tell the handler where to continue
7670  break;
7671 
7672  case UNKNOWN_ELEMENT:
7674  break;
7675 
7676  default:
7678  pszName, "???", mParser.getCurrentLineNumber());
7679  break;
7680  }
7681  }
7682 
7683  return;
7684 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::TextGlyphElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Definition at line 7522 of file CCopasiXMLParser.cpp.

References CLayout::addTextGlyph(), CCopasiMessage::EXCEPTION, CKeyFactory::get(), CLGraphicalObject::getKey(), CModelEntity::getKey(), CReaction::getKey(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurrentLayout, SCopasiXMLParserCommon::pTextGlyph, CLTextGlyph::setGraphicalObjectKey(), CLGraphicalObject::setHeight(), CLGraphicalObject::setModelObjectKey(), CLGraphicalObject::setObjectRole(), CLTextGlyph::setText(), CLGraphicalObject::setWidth(), CLGraphicalObject::setX(), CLGraphicalObject::setY(), UNKNOWN_ELEMENT, and CCopasiMessage::WARNING.

7523 {
7524  mCurrentElement++; /* We should always be on hte next element */
7525  mpCurrentHandler = NULL;
7526  mLineNumber = (size_t) - 1;
7527 
7528  switch (mCurrentElement)
7529  {
7530  case TextGlyph:
7531 
7532  if (strcmp(pszName, "TextGlyph"))
7534  pszName, "TextGlyph", mParser.getCurrentLineNumber());
7535 
7536  {
7537  //workload
7538  const char * key;
7539  const char * name;
7540  const char * graphicalObject;
7541  const char * originOfText;
7542  const char * text;
7543  key = mParser.getAttributeValue("key", papszAttrs);
7544  name = mParser.getAttributeValue("name", papszAttrs);
7545  graphicalObject = mParser.getAttributeValue("graphicalObject", papszAttrs); //TODO
7546  originOfText = mParser.getAttributeValue("originOfText", papszAttrs, false);
7547  text = mParser.getAttributeValue("text", papszAttrs, false);
7548 
7549  mCommon.pTextGlyph = new CLTextGlyph(name);
7550  const char * objectRole = mParser.getAttributeValue("objectRole", papszAttrs, false);
7551 
7552  if (objectRole != NULL && objectRole[0] != 0)
7553  {
7554  mCommon.pTextGlyph->setObjectRole(objectRole);
7555  }
7556 
7557  CLGraphicalObject * pGO = dynamic_cast<CLGraphicalObject *>(mCommon.KeyMap.get(graphicalObject));
7558 
7559  if (pGO)
7561 
7562  if (text)
7563  mCommon.pTextGlyph->setText(text);
7564  else if (originOfText && originOfText[0])
7565  {
7566  CCopasiObject * pObj = mCommon.KeyMap.get(originOfText);
7567  CModelEntity * pME = dynamic_cast<CModelEntity *>(pObj);
7568  CReaction * pR = dynamic_cast<CReaction *>(pObj);
7569 
7570  if (pME)
7571  {
7573  }
7574  else if (pR)
7575  {
7577  }
7578  else
7579  {
7580  if (!text)
7581  {
7582  mCommon.pTextGlyph->setText("unset");
7584  }
7585  }
7586 
7587  //TODO: When we have a way to handle references to metab references, this needs to be adapted.
7588  }
7589 
7591  addFix(key, mCommon.pTextGlyph);
7592  }
7593  return;
7594  break;
7595 
7596  case BoundingBox:
7597 
7598  if (!strcmp(pszName, "BoundingBox"))
7599  return;
7600 
7601  break;
7602 
7603  case Position:
7604 
7605  if (!strcmp(pszName, "Position"))
7606  {
7607  //workload
7608  const char * attr;
7609  attr = mParser.getAttributeValue("x", papszAttrs);
7611  attr = mParser.getAttributeValue("y", papszAttrs);
7613  return;
7614  }
7615 
7616  break;
7617 
7618  case Dimensions:
7619 
7620  if (!strcmp(pszName, "Dimensions"))
7621  {
7622  //workload
7623  const char * attr;
7624  attr = mParser.getAttributeValue("width", papszAttrs);
7626  attr = mParser.getAttributeValue("height", papszAttrs);
7628  return;
7629  }
7630 
7631  break;
7632 
7633  default:
7636  break;
7637  }
7638 
7639  if (mpCurrentHandler)
7641 
7642  mParser.onStartElement(pszName, papszAttrs);
7643 
7644  return;
7645 }
UnknownElement mUnknownElement
CCopasiObject * get(const std::string &key)
virtual const std::string & getKey() const
Definition: CReaction.cpp:190
void setY(const C_FLOAT64 &y)
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
virtual const std::string & getKey() const
void setModelObjectKey(const std::string &k)
void addFix(const std::string &key, CCopasiObject *pObject)
Definition: CXMLHandler.h:119
void addTextGlyph(CLTextGlyph *glyph)
Definition: CLayout.cpp:257
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
virtual const std::string & getKey() const
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
void setGraphicalObjectKey(const std::string &k)
Definition: CLGlyphs.cpp:338
void setHeight(const C_FLOAT64 &h)
void setObjectRole(const std::string &role)
void setText(const std::string &t)
Definition: CLGlyphs.cpp:250
int getCurrentLineNumber() const
Definition: CExpat.h:470
void setWidth(const C_FLOAT64 &w)
void setX(const C_FLOAT64 &x)

Member Data Documentation

size_t CCopasiXMLParser::TextGlyphElement::mLineNumber
private

Definition at line 3514 of file CCopasiXMLParser.h.


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