1
/******************************************************************************
2
Copyright (c) 2007 netAllied GmbH, Tettnang
4
Permission is hereby granted, free of charge, to any person
5
obtaining a copy of this software and associated documentation
6
files (the "Software"), to deal in the Software without
7
restriction, including without limitation the rights to use,
8
copy, modify, merge, publish, distribute, sublicense, and/or sell
9
copies of the Software, and to permit persons to whom the
10
Software is furnished to do so, subject to the following
13
The above copyright notice and this permission notice shall be
14
included in all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
OTHER DEALINGS IN THE SOFTWARE.
24
******************************************************************************/
26
#ifndef __MATHML_AST_UNARY_ARITHMETIC_EXPRESSION_H___
27
#define __MATHML_AST_UNARY_ARITHMETIC_EXPRESSION_H___
29
#include "MathMLSolverPrerequisites.h"
30
#include "MathMLASTNode.h"
37
/** String representation for enum Operator::ADD. */
38
static const String OPERATOR_UNARY_ADD = "+";
39
/** String representation for enum Operator::SUB. */
40
static const String OPERATOR_UNARY_SUB = "-";
41
/** String representation for enum Operator::NOT. */
42
static const String OPERATOR_UNARY_NOT = "!";
43
/** String representation for invalid operator. */
44
static const String OPERATOR_UNARY_ILLEGAL = "ILLEGAL";
46
/** Specialized unary arithmetic node implementing INode. */
48
class _MATHML_SOLVER_EXPORT UnaryExpression : public INode
52
/** Enumeration of the unary arithmetic operators. */
61
/** The operand for the unary expression. */
64
/** The operator of the unary expression. */
67
/** Disable copy construction to avoid expensive deep copies of big trees.
69
UnaryExpression( const UnaryExpression& );
70
UnaryExpression& operator=( const UnaryExpression& );
77
virtual ~UnaryExpression();
79
// see INode::accept(IVisitor* )
80
virtual void accept( IVisitor* visitor ) const;
82
// see INode::getType()
83
virtual NodeType getNodeType() const { return UNARY; }
85
/** @return a copy of this node. */
86
virtual INode* clone(CloneFlags cloneFlags) const;
88
/** Getter for the operator of the unary expression.
89
@return The operator of the expression.
91
virtual Operator getOperator() const;
93
/** Setter for the operator of the unary expression.
94
@param op The operator to set.
96
virtual void setOperator( Operator op );
98
/** Getter for the operator of the unary expression.
99
@return The operator of the expression as string.
101
virtual const String& getOperatorString() const;
103
/** Setter for the operator of the unary expression.
104
@param op The operator to set as string.
106
virtual void setOperator( const String& op );
108
/** Getter for the operand of the unary expression.
109
@return The operand of the expression.
111
virtual INode* getOperand() const;
113
/** Setter for the operand of the unary expression.
114
@param operand The operand to set.
116
virtual void setOperand( INode* operand );
118
/** Returns a string representation of passed operator. */
119
static const String& operatorString( Operator op );
126
#endif //__MATHML_AST_UNARY_ARITHMETIC_EXPRESSION_H___