本文整理汇总了C++中StrList::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ StrList::Count方法的具体用法?C++ StrList::Count怎么用?C++ StrList::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StrList
的用法示例。
在下文中一共展示了StrList::Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindParts
void FindParts(const char* file, const char* part,StrList& dst)
{
String filename=file;
filename.ToLower();
dst.Clean();
StrList tmp;
int i;
for(i=0;i<files.Count();i++)
{
if(files[i]->mainaload ||
files[i]->isLoadBase(filename))
{
FindPartsInFile(files[i],part,tmp);
}
}
if(tmp.Count()==0)return;
tmp.Sort(dst);
i=1;
String *s=&dst[0];
while(i<dst.Count())
{
if(dst[i]==*s)
{
dst.Delete();
}else
{
s=&dst[i];
i++;
if(i==dst.Count())break;
}
}
}
示例2: UpdateTagsFile
int UpdateTagsFile(const char* file)
{
TagFileInfo *fi=NULL;
int i;
String filename=file;
filename.ToLower();
for(i=0;i<files.Count();i++)
{
if(files[i]->filename==filename)
{
fi=files[i];
break;
}
}
if(!fi)
{
struct stat st;
if(stat(filename,&st)==-1)return 0;
TagFileInfo tfi;
tfi.filename=filename;
tfi.modtm=st.st_mtime;
if(!FindIdx(&tfi))return 0;
if(Load(filename,"")!=1)return 0;
}
StrList sl;
if(!CheckChangedFiles(filename,sl))return 0;
if(sl.Count()==0)return 1;
sl.SaveToFile("tags.changes");
String cmd=config.exe+" ";
String opt=config.opt;
opt.Replace("-R","");
RegExp re("/\\*(\\.\\S*)?/");
SMatch m[4];
int n=4;
while(re.Search(opt,m,n))
{
opt.Delete(m[0].start,m[0].end-m[0].start);
}
cmd+=opt;
cmd+=" -f tags.update -L tags.changes";
//extern int Msg(const char* err);
//Msg(cmd);
if(!Execute(cmd))
{
remove("tags.changes");
return 0;
}
MergeFiles(file,"tags.update");
remove("tags.changes");
remove("tags.update");
Load(file,"");
return 1;
}
示例3: Autoload
void Autoload(const char* fn)
{
String dir;
if(fn)
{
dir=fn;
int bs=dir.RIndex("\\");
dir.Delete(bs);
}
else
{
char buf[512];
GetCurrentDirectory(sizeof(buf),buf);
dir=buf;
}
dir+="\\.tags-autoload";
dir.ToLower();
//DebugBreak();
StrList sl;
int isenv=0;
bool mainaload=false;
for(;;)
{
if(GetFileAttributes(dir)!=0xFFFFFFFF)
{
sl.LoadFromFile(dir);
for(int i=0;i<sl.Count();i++)
{
String fn=sl[i];
if(fn.Length()==0)continue;
if(!(fn[0]=='\\' || fn[1]==':'))
{
int i=dir.RIndex("\\");
if(i!=-1)
{
fn.Insert(0,dir.Substr(0,i+1));
}
}
int z=dir.RIndex("\\");
if(z==-1)z=dir.RIndex(":");
Load(fn,isenv && z!=-1?"":dir.Substr(0,z+1),mainaload);
}
}
if(!isenv)
{
int bs=dir.RIndex("\\");
if(bs!=-1)
{
dir.Delete(bs);
bs=dir.RIndex("\\");
if(bs!=-1)
{
dir.Delete(bs+1);
dir+=".tags-autoload";
}else
{
isenv=1;
}
}else
{
isenv=1;
}
if(isenv==1)
{
if(config.autoload.Length()!=0)
{
dir=config.autoload;
mainaload=true;
}else
{
break;
}
}
}else
{
break;
}
}
}
示例4: OpenPlugin
FARAPI(HANDLE) OpenPlugin(int OpenFrom,int Item)
{
UpdateConfig();
if(OpenFrom==OPEN_EDITOR)
{
//DebugBreak();
EditorInfo ei;
I.EditorControl(ECTL_GETINFO,&ei);
Autoload(ei.FileName);
if(Count()==0)
{
Msg(MENotLoaded);
return INVALID_HANDLE_VALUE;
}
MenuList ml;
enum{
miFindSymbol,miUndo,miResetUndo,
miComplete,miBrowseFile,miBrowseClass,
};
ml<<MI(MFindSymbol,miFindSymbol)
<<MI(MCompleteSymbol,miComplete)
<<MI(MUndoNavigation,miUndo)
<<MI(MResetUndo,miResetUndo)
<<MI(MBrowseSymbolsInFile,miBrowseFile)
<<MI(MBrowseClass,miBrowseClass);
int res=Menu(GetMsg(MPlugin),ml,0);
if(res==-1)return INVALID_HANDLE_VALUE;
switch(res)
{
case miFindSymbol:
{
String word=GetWord();
if(word.Length()==0)return INVALID_HANDLE_VALUE;
//Msg(word);
PTagArray ta=Find(word,ei.FileName);
if(!ta)
{
Msg(GetMsg(MNotFound));
return INVALID_HANDLE_VALUE;
}
TagInfo *ti;
if(ta->Count()==1)
{
ti=(*ta)[0];
}else
{
ti=TagsMenu(ta);
}
if(ti)NavigateTo(ti);
FreeTagsArray(ta);
}break;
case miUndo:
{
if(UndoArray.Count()==0)return INVALID_HANDLE_VALUE;
/*char b[32];
sprintf(b,"%d",ei.CurState);
Msg(b);*/
if(ei.CurState==ECSTATE_SAVED)
{
I.EditorControl(ECTL_QUIT,NULL);
I.AdvControl(I.ModuleNumber,ACTL_COMMIT,(void*)-1);
}
SUndoInfo ui;
UndoArray.Pop(ui);
SetPos(ui.file,ui.line,ui.pos,ui.top,ui.left);
}break;
case miResetUndo:
{
UndoArray.Clean();
}break;
case miComplete:
{
EditorInfo ei;
I.EditorControl(ECTL_GETINFO,&ei);
String word=GetWord(1);
if(word.Length()==0)return INVALID_HANDLE_VALUE;
StrList lst;
FindParts(ei.FileName,word,lst);
if(lst.Count()==0)
{
Msg(MNothingFound);
return INVALID_HANDLE_VALUE;
}
int res;
if(lst.Count()>1)
{
MenuList ml;
for(int i=0;i<lst.Count();i++)
{
ml<<MI(lst[i],i);
}
res=Menu(GetMsg(MSelectSymbol),ml,0,MF_FILTER|MF_SHOWCOUNT,(void*)word.Str());
if(res==-1)return INVALID_HANDLE_VALUE;
}else
{
res=0;
}
EditorGetString egs;
egs.StringNumber=-1;
I.EditorControl(ECTL_GETSTRING,&egs);
//.........这里部分代码省略.........