本文整理汇总了C++中TStringList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ TStringList::add方法的具体用法?C++ TStringList::add怎么用?C++ TStringList::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStringList
的用法示例。
在下文中一共展示了TStringList::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddIncludes
//***************************************************
int Logic::AddIncludes()
{
TStringList IncludeStrings,IncludeLines;
int CurInputLine,CurIncludeLine;
string filename;
int err=0;
string::size_type pos1,pos2;
int CurLine;
char *ptr;
IncludeFilenames = TStringList();
IncludeStrings = TStringList();
EditLines = TStringList();
IncludeLines = TStringList();
CurLine = 0;
for(CurInputLine = 0;CurInputLine<InputLines.num;CurInputLine++){
EditLines.add(InputLines.at(CurInputLine));
CurLine = EditLines.num -1;
RealLineNum[CurLine] = CurInputLine;
LineFile[CurLine] = 0;
#ifdef _WIN32
if(_strnicmp(InputLines.at(CurInputLine).c_str(),"#include",8)) {
#else
if(strncasecmp(InputLines.at(CurInputLine).c_str(),"#include",8)){
#endif
continue;
}
string str = InputLines.at(CurInputLine).substr(8);
if(str.length()<4){
ShowError(CurLine,"Missing include filename !");
err=1;
continue;
}
if(str[0] != ' '){
ShowError(CurLine,"' ' expected after #include.");
err=1;
continue;
}
pos1 = str.find_first_of("\"",1);
pos2 = str.find_first_of("\"",pos1+1);
if(pos1 == string::npos || pos2 == string::npos){
ShowError(CurLine,"Include filenames need quote marks around them.");
err=1;
continue;
}
filename = str.substr(pos1+1,pos2-pos1-1);
if(filename.find_first_of("/")!=string::npos){
ShowError(CurLine,"Only files in the src directory can be included.");
err=1;
continue;
}
sprintf(tmp,"%s/src/%s",game->dir.c_str(),filename.c_str());
FILE *fptr = fopen(tmp,"rb");
if(fptr==NULL){
sprintf(tmp,"Can't open include file: %s/src/%s",game->dir.c_str(),filename.c_str());
ShowError(CurLine,tmp);
err=1;
continue;
}
IncludeLines.lfree();
while(fgets(tmp,MAX_TMP,fptr)!=NULL){
if((ptr=strchr(tmp,0x0a)))*ptr=0;
if((ptr=strchr(tmp,0x0d)))*ptr=0;
IncludeLines.add(tmp);
}
fclose(fptr);
if(IncludeLines.num==0)continue;
IncludeFilenames.add(filename);
RemoveComments(IncludeLines);
EditLines.replace(CurLine,empty_tmp);
for(CurIncludeLine=0;CurIncludeLine<IncludeLines.num;CurIncludeLine++){
EditLines.add(IncludeLines.at(CurIncludeLine));
CurLine=EditLines.num-1;
RealLineNum[CurLine] = CurIncludeLine;
LineFile[CurLine] = IncludeFilenames.num;
}
}
IncludeLines.lfree();
InputLines.lfree();
return err;
}
//***************************************************
int Logic::ReadDefines()
{
int err=0,i;
string::size_type pos1,pos2;
string ThisDefineName,ThisDefineValue;
int CurLine;
NumDefines = 0;
for(CurLine = 0;CurLine<EditLines.num;CurLine++){
#ifdef _WIN32
if(_strnicmp(EditLines.at(CurLine).c_str(),"#define",7)){
#else
if(strncasecmp(EditLines.at(CurLine).c_str(),"#define",7)){
//.........这里部分代码省略.........