📄 token.cpp
字号:
#include"Token.h"
#include<iostream>
#include <iomanip>
using namespace std;
Token::Token()
{
token="";
type="";
attribute="";
line=1;
tLength=0;
digitValue=0;
expo=0;
}
Token::Token(string token1,string type1,string attribute1,int line1,int tLength1,double digitValue1,float expo1,char Buffer)
{
token=token1;
type=type1;
attribute=attribute1;
line=line1;
tLength=tLength1;
digitValue=digitValue1;
expo=expo1;
inBuffer[0]=Buffer;
}
Token::addBuffer(char in)
{
inBuffer[tLength]=in;
tLength++;
}
Token::convertBuffer(string& remember)
{
int count;
for(count=0;count<tLength;count++)
remember=remember+inBuffer[count];
}
Token::setToken(string type1, string attribute1)
{
type=type1;
attribute=attribute1;
}
Token::setDefault()
{
token="";
type="";
attribute="";
tLength=0;
int count;
for(count=0;count<tLength;count++)
inBuffer[count]='\0';
}
Token::setNum(double digitValue1,float expo1)
{
digitValue=digitValue1;
expo=expo1;
}
Token::outPutData(ofstream& out,double digitValue1,float expo1)
{
out<<"Type: "<<type<<setw(24)<<"Attribute Value:"<<setw(12)<<digitValue<<endl;
}
Token::outPutToken(ofstream& out)
{
out<<"Type: "<<type<<setw(24)<<"Attribute Value:"<<setw(12)<<attribute<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -