📄 expressionbase.h
字号:
// Function.h : main header file for the FUNCTION application
//
#pragma once
////////////////////////////////////////////////////////////////////////////////
#include "afxtempl.h"
#include "value.h"
// Tree evaluation variables
#define DIVISION_BY_0 1 //被零除
#define ILEGAL_OPERATION 2 //
#define UNDEFINED_VARIABLE 3 //没有定义变量
#define INVALID_DOMAIN 4 //
//函数主键
#define OPER_SIN 150
#define OPER_COS 151
#define OPER_EXP 152
#define OPER_SQRT 153
#define OPER_LOG 154
#define OPER_TAN 155
#define OPER_CTAN 156
#define OPER_ASIN 157
#define OPER_ACOS 158
#define OPER_ATAN 159
#define OPER_FABS 160
typedef CTypedPtrMap<CMapStringToOb,CString,CValue *> CMapVariabile;
/////////////////////////////////////////////////////////////////////////////
//表达式基类:CExpressionBase,表达式执行类:CExpression
//
class DllImprotExpression CExpressionBase: public CObject
{
public:
DECLARE_SERIAL(CExpressionBase);
CExpressionBase();
CExpressionBase(CExpressionBase & expresie);
CExpressionBase(CMapVariabile * vars);
virtual ~CExpressionBase();
CExpressionBase &operator=(CExpressionBase& expr);
void AtachVariables(CMapVariabile *vars);
struct nod
{
struct nod *left,*right;
unsigned char operatie;
union
{
double valoare;
CString *valoarestr;
};
};
typedef nod NOD;
typedef nod *arbore;
arbore CloneTree(void);
int UpdateArbore(void); // Update the tree
arbore GetArbore();
int Value(double & valoare); // gets the value of the expression
int ChangeExpression(CString& expresie); // Change expression
virtual void Serialize(CArchive& ar); // The serialization function
private:
arbore sgOp();
arbore LogicalOp();
void SkipSpaces();
CMapVariabile * m_pVariabile; // pointer to value table
CString m_definitie; // the expression in string
int pozitie; // string parsing variable
arbore m_Arbore; // the expresion as a binary tree
double vexp(arbore a);
arbore Factor(void); // the partial expresion parsing functions
arbore Identificator(void);
arbore Putere(void);
arbore Termen(void);
arbore Expresie(void);
void Elibmem(arbore a);
arbore Clone(arbore arb);
int code; // Error code var
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -