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

Public Member Functions

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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 6750 of file CCopasiXMLParser.cpp.

6751 {}

Member Function Documentation

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

Definition at line 6855 of file CCopasiXMLParser.cpp.

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

6856 {
6857  if (!strcmp(pszName, "MetaboliteGlyph"))
6858  {
6861 
6862  /* Tell the parent element we are done. */
6863  mParser.onEndElement(pszName);
6864  }
6865  else
6866  {
6867  switch (mCurrentElement)
6868  {
6869  case BoundingBox:
6870  break;
6871 
6872  case Position:
6873  break;
6874 
6875  case Dimensions:
6876  //tell the handler where to continue
6878  break;
6879 
6880  case UNKNOWN_ELEMENT:
6882  break;
6883 
6884  default:
6886  pszName, "???", mParser.getCurrentLineNumber());
6887  break;
6888  }
6889  }
6890 
6891  return;
6892 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::MetaboliteGlyphElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Definition at line 6753 of file CCopasiXMLParser.cpp.

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

6754 {
6755  mCurrentElement++; /* We should always be on hte next element */
6756  mpCurrentHandler = NULL;
6757  mLineNumber = (size_t) - 1;
6758 
6759  switch (mCurrentElement)
6760  {
6761  case MetaboliteGlyph:
6762 
6763  if (strcmp(pszName, "MetaboliteGlyph"))
6765  pszName, "MetaboliteGlyph", mParser.getCurrentLineNumber());
6766 
6767  {
6768  //workload
6769  const char * key;
6770  const char * name;
6771  const char * metabolite;
6772  key = mParser.getAttributeValue("key", papszAttrs);
6773  name = mParser.getAttributeValue("name", papszAttrs);
6774  metabolite = mParser.getAttributeValue("metabolite", papszAttrs, false);
6775 
6777  const char * objectRole = mParser.getAttributeValue("objectRole", papszAttrs, false);
6778 
6779  if (objectRole != NULL && objectRole[0] != 0)
6780  {
6781  mCommon.pMetaboliteGlyph->setObjectRole(objectRole);
6782  }
6783 
6784  if (metabolite && metabolite[0])
6785  {
6786  CMetab * pMetab = dynamic_cast< CMetab * >(mCommon.KeyMap.get(metabolite));
6787 
6788  if (!pMetab)
6789  {
6790  CCopasiMessage(CCopasiMessage::WARNING, MCXML + 19, "MetaboliteGlyph", key);
6791  }
6792  else
6793  {
6795  }
6796  }
6797 
6800  }
6801  return;
6802  break;
6803 
6804  case BoundingBox:
6805 
6806  if (!strcmp(pszName, "BoundingBox"))
6807  return;
6808 
6809  break;
6810 
6811  case Position:
6812 
6813  if (!strcmp(pszName, "Position"))
6814  {
6815  //workload
6816  const char * attr;
6817  attr = mParser.getAttributeValue("x", papszAttrs);
6819  attr = mParser.getAttributeValue("y", papszAttrs);
6821  return;
6822  }
6823 
6824  break;
6825 
6826  case Dimensions:
6827 
6828  if (!strcmp(pszName, "Dimensions"))
6829  {
6830  //workload
6831  const char * attr;
6832  attr = mParser.getAttributeValue("width", papszAttrs);
6834  attr = mParser.getAttributeValue("height", papszAttrs);
6836  return;
6837  }
6838 
6839  break;
6840 
6841  default:
6844  break;
6845  }
6846 
6847  if (mpCurrentHandler)
6849 
6850  mParser.onStartElement(pszName, papszAttrs);
6851 
6852  return;
6853 }
CLMetabGlyph * pMetaboliteGlyph
UnknownElement mUnknownElement
CCopasiObject * get(const std::string &key)
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
Definition: CMetab.h:178
void addMetaboliteGlyph(CLMetabGlyph *glyph)
Definition: CLayout.cpp:245
void setModelObjectKey(const std::string &k)
void addFix(const std::string &key, CCopasiObject *pObject)
Definition: CXMLHandler.h:119
#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 setHeight(const C_FLOAT64 &h)
void setObjectRole(const std::string &role)
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::MetaboliteGlyphElement::mLineNumber
private

Definition at line 3373 of file CCopasiXMLParser.h.


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