token.cpp
来自「表达式计算expression evaluate expression eval」· C++ 代码 · 共 69 行
CPP
69 行
/******************************************************************************
文件名 :Token.cpp
版本号 : 1.0
作者 : Amos Peng
生成日期 :2008-07-08
最近修改 :
功能描述 :运算符
函数列表 :
*******************************************************************************/
#include "Token.h"
using namespace ExprEval;
// Constructor
CToken::CToken(TokenType type, ::std::string::size_type start, ::std::string::size_type end) :
m_type(type),
m_start(start),
m_end(end)
{
}
// Construct identifier token
CToken::CToken(const ::std::string &ident, ::std::string::size_type start, ::std::string::size_type end) :
m_type(CToken::TypeIdentifier),
m_ident(ident),
m_start(start),
m_end(end)
{
}
// Construct value token
CToken::CToken(double value, string::size_type start, string::size_type end) :
m_type(CToken::TypeValue),
m_value(value),
m_start(start),
m_end(end)
{
}
// Get type
CToken::TokenType CToken::GetType() const
{
return m_type;
}
// Get identifier
const ::std::string& CToken::GetIdentifier() const
{
return m_ident;
}
// Get value
double CToken::GetValue() const
{
return m_value;
}
// Get start
::std::string::size_type CToken::GetStart() const
{
return m_start;
}
::std::string::size_type CToken::GetEnd() const
{
return m_end;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?