COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
CQValidatorExpression Class Reference

#include <CQExpressionWidget.h>

Inheritance diagram for CQValidatorExpression:
Inheritance graph
[legend]
Collaboration diagram for CQValidatorExpression:
Collaboration graph
[legend]

Public Member Functions

 CQValidatorExpression (QTextEdit *parent, const char *name=0, bool isBoolean=false)
 
virtual CExpressiongetExpression ()
 
void setBooleanRequired (bool booleanRequired)
 
virtual State validate (QString &input, int &pos) const
 
- Public Member Functions inherited from CQValidator< QTextEdit >
 CQValidator (QTextEdit *parent, QString(QTextEdit::*retrieve)(void) const, const char *name=0)
 
virtual void force (const QString &input) const
 
virtual State revalidate ()
 
virtual void saved () const
 

Protected Attributes

CExpression mExpression
 
- Protected Attributes inherited from CQValidator< QTextEdit >
QString mLastAccepted
 
QTextEdit * mpContainer
 
QString(QTextEdit::* mRetrieve )(void) const
 

Additional Inherited Members

- Protected Member Functions inherited from CQValidator< QTextEdit >
State setColor (const State &state) const
 

Detailed Description

The class for checking the validity of a given mathematical expression

Definition at line 55 of file CQExpressionWidget.h.

Constructor & Destructor Documentation

CQValidatorExpression::CQValidatorExpression ( QTextEdit *  parent,
const char *  name = 0,
bool  isBoolean = false 
)

Definition at line 80 of file CQExpressionWidget.cpp.

References CCopasiRootContainer::getDatamodelList(), mExpression, CExpression::setIsBoolean(), and CCopasiObject::setObjectParent().

80  :
81  CQValidator< QTextEdit >(parent, &QTextEdit::toPlainText, name),
82  mExpression()
83 {
85  assert(pDataModel != NULL);
86 
87  mExpression.setObjectParent(pDataModel);
88  mExpression.setIsBoolean(isBoolean);
89 }
virtual bool setObjectParent(const CCopasiContainer *pParent)
void setIsBoolean(const bool &booleanRequired)
Definition: CExpression.cpp:58
static CCopasiVector< CCopasiDataModel > * getDatamodelList()

Member Function Documentation

CExpression * CQValidatorExpression::getExpression ( )
virtual

Function to get CExpression object

Definition at line 120 of file CQExpressionWidget.cpp.

References mExpression.

Referenced by CQExpressionWidget::writeMathML().

121 {
122  return &mExpression;
123 }
void CQValidatorExpression::setBooleanRequired ( bool  booleanRequired)

Function to set whether boolean is required

Definition at line 125 of file CQExpressionWidget.cpp.

References mExpression, and CExpression::setIsBoolean().

Referenced by CQExpressionWidget::setBoolean().

126 {
127  mExpression.setIsBoolean(booleanRequired);
128 }
void setIsBoolean(const bool &booleanRequired)
Definition: CExpression.cpp:58
QValidator::State CQValidatorExpression::validate ( QString &  input,
int &  pos 
) const
virtual

Function to validate a string input

This function ensures that any characters on Expression Widget are validated to go to further processes.

Reimplemented from CQValidator< QTextEdit >.

Definition at line 95 of file CQExpressionWidget.cpp.

References CQExpressionWidget::getExpression(), mExpression, CQValidator< QTextEdit >::mpContainer, CQValidator< QTextEdit >::mRetrieve, CQValidator< QTextEdit >::setColor(), and CQValidator< Type >::validate().

96 {
97  // The input is the display version of the infix string.
98  // We must first convert the display string to infix.
99 
100  CQExpressionWidget * pExpressionWidget =
101  static_cast< CQExpressionWidget * >(parent());
102 
103  if (pExpressionWidget != NULL)
104  {
105  if (const_cast< CExpression * >(&mExpression)->setInfix(pExpressionWidget->getExpression()) &&
106  const_cast< CExpression * >(&mExpression)->compile())
107  {
108  QString Input = (*mpContainer.*mRetrieve)();
109  return CQValidator< QTextEdit >::validate(input, pos);
110  }
111  }
112 
113  setColor(Invalid);
114  return Intermediate;
115 }
QString(QTextEdit::* mRetrieve)(void) const
Definition: CQValidator.h:104
std::string getExpression() const
virtual State validate(QString &input, int &) const
Definition: CQValidator.h:51
State setColor(const State &state) const
Definition: CQValidator.h:84

Member Data Documentation

CExpression CQValidatorExpression::mExpression
protected

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