All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Attributes | Protected Member Functions
QGpCoreTools::ExpressionFunction Class Reference

#include <ExpressionAction.h>

Inheritance diagram for QGpCoreTools::ExpressionFunction:
QGpCoreTools::ExpressionAction QGpCoreTools::XMLClass

List of all members.

Public Member Functions

virtual bool addArgument (ExpressionAction *a)
virtual ExpressionActionclose (Type t)
 ExpressionFunction (QString name, ExpressionContext *context)
virtual ExpressionActionparent () const
virtual void replaceArgument (ExpressionAction *oldA, ExpressionAction *newA)
virtual QVariant value () const
virtual const QString & xml_tagName () const
virtual ~ExpressionFunction ()

Static Public Attributes

static const QString xmlExpressionFunctionTag = "ExpressionFunction"

Protected Member Functions

virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const
virtual void xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const

Constructor & Destructor Documentation

QGpCoreTools::ExpressionFunction::ExpressionFunction ( QString  name,
ExpressionContext context 
) [inline]
{_name=name; _open=true; _currentArg=0; _context=context;}
{qDeleteAll(_args);}

Member Function Documentation

If argument is already set, the new argument is set as the current and the old one is set as the argument of the new argument. This mechanism is designed for cases where an operator with a higher priority is encountered during parse.

Implements QGpCoreTools::ExpressionAction.

References QGpCoreTools::ExpressionAction::addArgument(), QGpCoreTools::ExpressionAction::setParent(), and TRACE.

{
  TRACE;
  if(!_currentArg || a->addArgument(_currentArg)) {
    a->setParent(this);
    _currentArg=a;
    return true;
  } else return false;
}

Reimplemented from QGpCoreTools::ExpressionAction.

References QGpCoreTools::ExpressionAction::_parent, QGpCoreTools::ExpressionAction::CloseBracket, QGpCoreTools::ExpressionAction::Coma, and TRACE.

{
  TRACE;
  switch (t) {
  case CloseBracket:
    if(_open) {
      if(_currentArg) {
        _args << _currentArg;
        _currentArg=0;
      }
      _open=false;
      return _parent;
    }
    break;
  case Coma:
    ASSERT(_open);
    if(_currentArg) {
      _args << _currentArg;
      _currentArg=0;
    }
    return this;
  default:
    break;
  }
  return ExpressionAction::close(t);
}
virtual ExpressionAction* QGpCoreTools::ExpressionFunction::parent ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::ExpressionAction.

{if(_open) return 0; else return _parent;}

Implements QGpCoreTools::ExpressionAction.

References QGpCoreTools::ExpressionAction::setParent(), and TRACE.

{
  TRACE;
  ASSERT(_currentArg==oldA);
  _currentArg=newA;
  newA->setParent(this);
}
virtual QVariant QGpCoreTools::ExpressionFunction::value ( ) const [inline, virtual]

Implements QGpCoreTools::ExpressionAction.

{return _context->functionValue(_name, _args);}
virtual const QString& QGpCoreTools::ExpressionFunction::xml_tagName ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::XMLClass.

References TRACE.

{
  TRACE;
  Q_UNUSED(context);
  for(QVector<ExpressionAction *>::const_iterator it=_args.begin(); it!=_args.end();++it) {
    (*it)->xml_save(s, context);
  }
}

Reimplemented from QGpCoreTools::XMLClass.

References TRACE, and QGpCoreTools::XMLClass::writeProperty().

{
  TRACE;
  Q_UNUSED(context);
  writeProperty(s,  "name", _name);
  writeProperty(s,  "open", _open);
}

Member Data Documentation

const QString QGpCoreTools::ExpressionFunction::xmlExpressionFunctionTag = "ExpressionFunction" [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines