本文整理汇总了C++中VarList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ VarList::Add方法的具体用法?C++ VarList::Add怎么用?C++ VarList::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarList
的用法示例。
在下文中一共展示了VarList::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseBool
void ParseBool(char *buffer)
{
string VarName="";
// skip boool
int i=5;
while(buffer[i]!= '=')
VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// now get the variable value up to the ; token
// skip = sign
i++;
VarName="";
while(buffer[i]!= ';')
VarName+=buffer[i++];
bool vf;
if(VarName == "true")
vf=true;
else if(VarName == "false")
vf=false;
else
{
cout <<"***************ERROR IN COMPILATION**********************"<<endl;
cout <<" Error in compilation line :"<<line<<endl;
cout <<" bool data type must be initialised as either true or false "<<endl;
cout << "****************** COMPILATION FAILED EXITING ***********"<<endl;
exit(0);
}
VarObj Vo(vf);
Globals.Add(Vo);
}
示例2: ParseVector
void ParseVector(char *buffer)
{
string VarName="";
char val[BUFFSIZE];
//Vector vf;
// skip Vector
int i=7;
int s=0;
while(buffer[i]!= '=')
VarName+=buffer[i++];
//VarName[s]='\0';
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z,w;
s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
i++; s=0;
while(buffer[i]!= ']')
val[s++]=buffer[i++];
val[s]='\0';
w=atof(val);
Vec4 vf(x,y,z,w);
VarObj Vo(vf);
Globals.Add(Vo);
//cout <<"Buffer "<<buffer <<" ";
//cout <<"X "<<x<<" Y "<<y <<" z "<<z<<endl;
}
示例3: ParsePoint
void ParsePoint(char *buffer)
{
string VarName="";
char val[30];
Vec3 vf;
// skip Vector
int i=6;
int s=0;
while(buffer[i]!= '=')
VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z;
s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);
i++; s=0;
while(buffer[i]!= ']')
val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
vf.set(x,y,z);
VarObj Vo(vf);
Globals.Add(Vo);
}
示例4: ParseFuzzy
void ParseFuzzy(char *buffer)
{
string VarName="";
char val[30];
fuzzy vf;
// skip float
int i=6;
int s=0;
while(buffer[i]!= '=')
VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// now get the variable value up to the ; token
// skip = sign
i++;
while(buffer[i]!= ';')
val[s++]=buffer[i++];
vf=atof(val);
VarObj Vo(vf);
Globals.Add(Vo);
}