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

Public Member Functions

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Slider 

Definition at line 3255 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 10667 of file CCopasiXMLParser.cpp.

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 10757 of file CCopasiXMLParser.cpp.

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

10758 {
10759  switch (mCurrentElement)
10760  {
10761  case Slider:
10762 
10763  if (strcmp(pszName, "Slider"))
10765  pszName, "Slider", mParser.getCurrentLineNumber());
10766 
10769 
10770  /* Tell the parent element we are done. */
10771  mParser.onEndElement(pszName);
10772  break;
10773 
10774  case UNKNOWN_ELEMENT:
10776  break;
10777 
10778  default:
10780  pszName, "???", mParser.getCurrentLineNumber());
10781  break;
10782  }
10783 
10784  return;
10785 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::SliderElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 10672 of file CCopasiXMLParser.cpp.

References CCopasiVector< T >::add(), C_FLOAT64, C_INT32, CSlider::convertScaleNameToScale(), CCopasiMessage::EXCEPTION, CSlider::Float, CKeyFactory::get(), CCopasiObject::getKey(), SCopasiXMLGUI::getSliderList(), SCopasiXMLParserCommon::KeyMap, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pGUI, CSlider::setAssociatedEntityKey(), CSlider::setMaxValue(), CSlider::setMinValue(), CSlider::setScaling(), CSlider::setSliderObject(), CSlider::setSliderType(), CSlider::setSliderValue(), CSlider::setTickFactor(), CSlider::setTickNumber(), strToUnsignedInt(), toEnum(), CSlider::TypeName, and UNKNOWN_ELEMENT.

10674 {
10675  mCurrentElement++; /* We should always be on the next element */
10676 
10677  CSlider * pSlider = NULL;
10678  const char * Key;
10679  const char * AssociatedEntityKey;
10680  const char * ObjectCN;
10681  const char * objectType;
10682  CSlider::Type ObjectType;
10683  const char * tmp;
10684  C_FLOAT64 ObjectValue;
10685  C_FLOAT64 MinValue;
10686  C_FLOAT64 MaxValue;
10687  unsigned C_INT32 TickNumber;
10688  unsigned C_INT32 TickFactor;
10689  const char* scaling;
10690 
10691  switch (mCurrentElement)
10692  {
10693  case Slider:
10694 
10695  if (strcmp(pszName, "Slider"))
10697  pszName, "Slider", mParser.getCurrentLineNumber());
10698 
10699  Key = mParser.getAttributeValue("key", papszAttrs);
10700  AssociatedEntityKey = mParser.getAttributeValue("associatedEntityKey", papszAttrs);
10701  ObjectCN = mParser.getAttributeValue("objectCN", papszAttrs);
10702  objectType = mParser.getAttributeValue("objectType", papszAttrs);
10703  ObjectType = toEnum(objectType, CSlider::TypeName, CSlider::Float);
10704  tmp = mParser.getAttributeValue("objectValue", papszAttrs);
10705  ObjectValue = CCopasiXMLInterface::DBL(tmp);
10706  tmp = mParser.getAttributeValue("minValue", papszAttrs);
10707  MinValue = CCopasiXMLInterface::DBL(tmp);
10708  tmp = mParser.getAttributeValue("maxValue", papszAttrs);
10709  MaxValue = CCopasiXMLInterface::DBL(tmp);
10710  tmp = mParser.getAttributeValue("tickNumber", papszAttrs, "1000");
10711  TickNumber = strToUnsignedInt(tmp);
10712  tmp = mParser.getAttributeValue("tickFactor", papszAttrs, "100");
10713  TickFactor = strToUnsignedInt(tmp);
10714 
10715  scaling = mParser.getAttributeValue("scaling", papszAttrs, "linear");
10716 
10717  // This is always the case if the XML is conforming to the schema.
10718 
10719  if (mCommon.KeyMap.get(AssociatedEntityKey))
10720  {
10721  pSlider = new CSlider("slider", mCommon.pGUI->getSliderList());
10722  addFix(Key, pSlider);
10723 
10724  if (strncmp(AssociatedEntityKey, "", 1))
10725  {
10726  pSlider->setAssociatedEntityKey(mCommon.KeyMap.get(AssociatedEntityKey)->getKey());
10727  }
10728  else
10729  {
10730  pSlider->setAssociatedEntityKey("");
10731  }
10732 
10733  pSlider->setSliderObject((std::string) ObjectCN);
10734  pSlider->setSliderType(ObjectType);
10735  pSlider->setMaxValue(MaxValue);
10736  pSlider->setMinValue(MinValue);
10737  pSlider->setSliderValue(ObjectValue);
10738  pSlider->setTickNumber(TickNumber);
10739  pSlider->setTickFactor(TickFactor);
10740  pSlider->setScaling(pSlider->convertScaleNameToScale(scaling));
10741  mCommon.pGUI->getSliderList()->add(pSlider, true);
10742  }
10743 
10744  break;
10745 
10746  default:
10750  mParser.onStartElement(pszName, papszAttrs);
10751  break;
10752  }
10753 
10754  return;
10755 }
CCopasiVector< CSlider > * getSliderList()
objectType
UnknownElement mUnknownElement
bool setScaling(Scale scaling)
Definition: CSlider.cpp:374
bool setSliderObject(CCopasiObject *pObject)
Definition: CSlider.cpp:104
CCopasiObject * get(const std::string &key)
bool setMaxValue(const C_FLOAT64 maxValue)
Definition: CSlider.cpp:323
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
#define C_INT32
Definition: copasi.h:90
bool setTickFactor(const unsigned C_INT32 tickFactor)
Definition: CSlider.cpp:360
static const char * TypeName[]
Definition: CSlider.h:45
void addFix(const std::string &key, CCopasiObject *pObject)
Definition: CXMLHandler.h:119
virtual const std::string & getKey() const
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
bool setAssociatedEntityKey(const std::string &associatedEntityKey)
Definition: CSlider.cpp:94
bool setSliderType(const CSlider::Type type)
Definition: CSlider.cpp:182
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
virtual bool add(const CType &src)
unsigned C_INT32 strToUnsignedInt(const char *str, char const **pTail)
Definition: utility.cpp:384
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
Definition: utility.h:107
bool setTickNumber(const unsigned C_INT32 tickNumber)
Definition: CSlider.cpp:351
#define C_FLOAT64
Definition: copasi.h:92
bool setMinValue(const C_FLOAT64 minValue)
Definition: CSlider.cpp:295
int getCurrentLineNumber() const
Definition: CExpat.h:470
bool setSliderValue(const C_FLOAT64 value, const bool &writeToObject=true)
Definition: CSlider.cpp:215
Scale convertScaleNameToScale(const char *scaleName)
Definition: CSlider.cpp:380

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