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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 MethodElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~MethodElement ()
 
- 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 { Method = 0, Content }
 

Private Attributes

size_t mLineNumber
 
ParameterGroupElementmpContentHandler
 

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

Member Enumeration Documentation

Enum of invoked parsers

Enumerator
Method 
Content 

Definition at line 2360 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

CCopasiXMLParser::MethodElement::MethodElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)

Constructor

Definition at line 9262 of file CCopasiXMLParser.cpp.

CCopasiXMLParser::MethodElement::~MethodElement ( )
virtual

Destructor

Definition at line 9270 of file CCopasiXMLParser.cpp.

References pdelete.

9271 {
9273 }
#define pdelete(p)
Definition: copasi.h:215
ParameterGroupElement * mpContentHandler

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 9340 of file CCopasiXMLParser.cpp.

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

9341 {
9342  switch (mCurrentElement)
9343  {
9344  case Method:
9345 
9346  if (strcmp(pszName, "Method"))
9348  pszName, "Method", mParser.getCurrentLineNumber());
9349 
9352  mParser.onEndElement(pszName);
9353  break;
9354 
9355  case Content:
9356  break;
9357 
9358  case UNKNOWN_ELEMENT:
9359  mCurrentElement = mLastKnownElement;
9360  break;
9361 
9362  default:
9364  pszName, "???", mParser.getCurrentLineNumber());
9365  break;
9366  }
9367 
9368  return;
9369 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::MethodElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 9275 of file CCopasiXMLParser.cpp.

References CCopasiTask::getMethod(), CCopasiMethod::getSubType(), CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, SCopasiXMLParserCommon::pCurrentTask, CCopasiTask::setMethodType(), CCopasiObject::setObjectName(), toEnum(), UNKNOWN_ELEMENT, CCopasiMethod::unset, CCopasiMessage::WARNING, and CCopasiMethod::XMLSubType.

9277 {
9278  mCurrentElement++; // We should always be on the next element
9279  mpCurrentHandler = NULL;
9280  mLineNumber = (size_t) - 1;
9281 
9282  std::string name;
9283  std::string sType;
9284 
9285  switch (mCurrentElement)
9286  {
9287  case Method:
9288 
9289  if (!strcmp(pszName, "Method"))
9290  {
9291  // get name and type attribute
9292  name = mParser.getAttributeValue("name", papszAttrs);
9293  sType = mParser.getAttributeValue("type", papszAttrs, "default");
9294  // first set the type of the with setMethodType of the current task
9295  // object
9296  CCopasiMethod::SubType type =
9298 
9299  if (type != CCopasiMethod::unset)
9300  {
9302  }
9303  else
9304  {
9305  // We use the default method for this task and issue a warning
9306  CCopasiMessage(CCopasiMessage::WARNING, MCXML + 18, sType.c_str(),
9309  }
9310 
9312 
9313  if (!mpContentHandler)
9314  {
9315  mpContentHandler = new ParameterGroupElement(mParser, mCommon);
9316  }
9317 
9320  }
9321 
9322  break;
9323 
9324  case Content:
9325  break;
9326 
9327  default:
9331  break;
9332  }
9333 
9334  if (mpCurrentHandler)
9336 
9337  mParser.onStartElement(pszName, papszAttrs);
9338 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
const CCopasiMethod::SubType & getSubType() const
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
virtual bool setMethodType(const int &type)
CType toEnum(const char *attribute, const char **enumNames, const CType &enumDefault)
Definition: utility.h:107
CCopasiMethod * getMethod()
int getCurrentLineNumber() const
Definition: CExpat.h:470
ParameterGroupElement * mpContentHandler
static const char * XMLSubType[]
void setDerivedElement(CCopasiParameterGroup *pDerivedElement)
bool setObjectName(const std::string &name)

Member Data Documentation

size_t CCopasiXMLParser::MethodElement::mLineNumber
private

The line number the unknown parameter was encountered.

Definition at line 2371 of file CCopasiXMLParser.h.

ParameterGroupElement* CCopasiXMLParser::MethodElement::mpContentHandler
private

Definition at line 2366 of file CCopasiXMLParser.h.


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