本文整理汇总了C++中Index::FindAdd方法的典型用法代码示例。如果您正苦于以下问题:C++ Index::FindAdd方法的具体用法?C++ Index::FindAdd怎么用?C++ Index::FindAdd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::FindAdd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializePPFiles
void SerializePPFiles(Stream& s)
{
s % sAllMacros % sPPfile % sPPserial;
if(s.IsLoading())
LoadPPConfig();
#if 0
if(s.IsLoading()) { _DBG_
DDUMP(sPPfile.GetCount());
DDUMP(sAllMacros.GetCount());
DDUMP(sPPserial);
Index<int> psegment;
for(int i = 0; i < sPPfile.GetCount(); i++) {
const PPFile& p = sPPfile[i];
for(int j = 0; j < p.item.GetCount(); j++)
psegment.FindAdd(p.item[j].segment_id);
}
DDUMP(psegment.GetCount());
int n = 0; _DBG_
Index<int> msegment;
for(int i = 0; i < sAllMacros.GetCount(); i++) { _DBG_
if(sAllMacros.IsUnlinked(i))
n++;
else
msegment.FindAdd(sAllMacros[i].segment_id);
}
DLOG("UNLINKED " << n);
DLOG("Segments " << msegment.GetCount());
}
示例2: ExportProject
void Ide::ExportProject(const String& ep, bool all, bool gui, bool deletedir)
{
SaveFile(false);
::Workspace wspc;
wspc.Scan(main);
Index<String> used;
HdependClearDependencies();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& p = wspc.GetPackage(i);
String pn = wspc[i];
for(int j = 0; j < p.GetCount(); j++) {
const Package::File& f = p[j];
if(!f.separator) {
String p = SourcePath(pn, f);
used.FindAdd(p);
Vector<String> d = HdependGetDependencies(p);
for(int q = 0; q < d.GetCount(); q++)
used.FindAdd(d[q]);
for(int q = 0; q < f.depends.GetCount(); q++)
used.FindAdd(SourcePath(pn, f.depends[q].text));
}
}
}
if(FileExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
"Do you want to delete it?")) return;
FileDelete(ep);
}
if(deletedir && DirectoryExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
"Do you want to replace it?")) return;
DeleteFolderDeep(ep);
}
Progress pi("Exporting project");
pi.SetTotal(wspc.GetCount());
for(int i = 0; i < wspc.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
}
Vector<String> upp = GetUppDirs();
for(int i = 0; i < upp.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
String d = upp[i];
FindFile ff(AppendFileName(d, "*"));
while(ff) {
if(ff.IsFile()) {
String fn = ff.GetName();
String path = AppendFileName(d, fn);
if(all || used.Find(path) >= 0)
CopyFile(AppendFileName(ep, fn), path, true);
}
ff.Next();
}
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
}
ExportMakefile(ep);
}
示例3:
PPMacro *FindPPMacro(const String& id, Index<int>& segment_id, int& segmenti)
{
Index<int> undef;
PPMacro *r;
int best;
for(int pass = 0; pass < 2; pass++) {
r = NULL;
best = segmenti;
int line = -1;
int q = sAllMacros.Find(id);
while(q >= 0) {
PPMacro& m = sAllMacros[q];
if(m.macro.IsUndef()) {
if(pass == 0 && segment_id.Find(m.segment_id) >= 0)
undef.FindAdd(m.segment_id); // cancel out undefined macro...
}
else
if(pass == 0 || m.segment_id == 0 || undef.Find(m.undef_segment_id) < 0) {
int si = m.segment_id == 0 ? INT_MAX : segment_id.Find(m.segment_id); // defs macros always override
if(si > best || si >= 0 && si == best && m.line > line) {
best = si;
line = m.line;
r = &m;
}
}
q = sAllMacros.FindNext(q);
}
if(undef.GetCount() == 0)
break;
}
segmenti = best;
return r;
}
示例4: HelpTopicEnumDeclModules
Vector<String> HelpTopicEnumDeclModules()
{
Index<String> modmap;
const HelpTopicInfoMap& map = HelpTopicMap();
for(int i = 0; i < map.GetCount(); i++)
modmap.FindAdd(map[i].decl_module);
Vector<String> mm = modmap.PickKeys();
Sort(mm, StdLess<String>());
return mm;
}
示例5: GetAllLanguages
NAMESPACE_UPP
void RichTxt::GetAllLanguages(Index<int>& all) const
{
for(int i = 0; i < part.GetCount(); i++) {
if(IsTable(i)) {
const RichTable& tab = part[i].Get<RichTable>();
for(int i = 0; i < tab.GetRows(); i++)
for(int j = 0; j < tab.GetColumns(); j++)
if(tab(i, j))
tab[i][j].text.GetAllLanguages(all);
}
else {
RichPara p = Get(i, RichStyle::GetDefault());
all.FindAdd(p.format.language);
for(int i = 0; i < p.GetCount(); i++)
all.FindAdd(p[i].format.language);
}
}
}
示例6: FinishOldTable
void RichQtfParser::FinishOldTable()
{
FinishCell();
Index<int> pos;
Vector<int> srow;
RichTable& t = Table();
Tab& b = table.Top();
for(int i = 0; i < t.GetRows(); i++) {
int& s = srow.Add();
s = 0;
int nx = b.rown[i];
for(int j = 0; j < nx; j++)
s += t.GetSpan(i, j).cx;
int xn = 0;
for(int j = 0; j < nx; j++) {
pos.FindAdd(xn * 10000 / s);
xn += t.GetSpan(i, j).cx;
}
}
Vector<int> h = pos.PickKeys();
if(h.GetCount() == 0)
Error("table");
Sort(h);
pos = pick(h);
pos.Add(10000);
RichTable tab;
tab.SetFormat(t.GetFormat());
for(int i = 0; i < pos.GetCount() - 1; i++) {
tab.AddColumn(pos[i + 1] - pos[i]);
}
for(int i = 0; i < t.GetRows(); i++) {
int s = srow[i];
int nx = b.rown[i];
int xn = 0;
int xi = 0;
for(int j = 0; j < nx; j++) {
Size span = t.GetSpan(i, j);
xn += span.cx;
int nxi = pos.Find(xn * 10000 / s);
tab.SetPick(i, xi, t.GetPick(i, j));
tab.SetFormat(i, xi, t.GetFormat(i, j));
tab.SetSpan(i, xi, max(span.cy - 1, 0), nxi - xi - 1);
xi = nxi;
}
}
table.Drop();
if(table.GetCount())
table.Top().text.CatPick(pick(tab));
else
target.CatPick(pick(tab));
oldtab = false;
}
示例7: operator
virtual bool operator()(int pos, const RichPara& para)// A++ bug here....
{
if(!IsNull(para.format.label)) {
AddLinkRef(link, para.format.label);
ref.FindAdd(para.format.label);
}
for(int i = 0; i < para.part.GetCount(); i++)
if(para.part[i].IsText()) {
const wchar *s = para.part[i].text;
for(;;) {
while(!IsLetter(*s) && !IsDigit(*s) && *s)
s++;
if(*s == '\0')
break;
StringBuffer sb;
while(IsLetter(*s) || IsDigit(*s))
sb.Cat(ToAscii(ToLower(*s++)));
words.FindAdd(TopicWordIndex(sb));
}
}
return false;
}
示例8: DoDirDiff
void Ide::DoDirDiff()
{
Index<String> dir;
Vector<String> d = GetUppDirs();
for(int i = 0; i < d.GetCount(); i++)
dir.FindAdd(d[i]);
FindFile ff(ConfigFile("*.bm"));
while(ff) {
VectorMap<String, String> var;
LoadVarFile(ff.GetPath(), var);
Vector<String> p = Split(var.Get("UPP", String()), ';');
for(int i = 0; i < p.GetCount(); i++)
dir.FindAdd(p[i]);
ff.Next();
}
String n = GetFileFolder(editfile);
if(n.GetCount())
dir.FindAdd(n);
SortIndex(dir);
static DirDiffDlg dlg;
dlg.diff.WhenLeftLine = THISBACK1(GotoDirDiffLeft, &dlg);
dlg.diff.WhenRightLine = THISBACK1(GotoDirDiffRight, &dlg);
for(int i = 0; i < dir.GetCount(); i++) {
dlg.Dir1AddList(dir[i]);
dlg.Dir2AddList(dir[i]);
}
if(d.GetCount())
dlg.Dir1(d[0]);
if(!dlg.IsOpen()) {
dlg.SetFont(veditorfont);
dlg.Maximize();
dlg.Title("Compare directories");
dlg.OpenMain();
}
else
dlg.SetFocus();
}
示例9: HelpTopicEnumLang
Vector<int> HelpTopicEnumLang()
{
Index<int> lngmap;
const HelpTopicInfoMap& map = HelpTopicMap();
for(int i = 0; i < map.GetCount(); i++)
{
const HelpTopicInfo& topic = map[i];
for(int l = 0; l < topic.language.GetCount(); l++)
lngmap.FindAdd(topic.language[l]);
}
Vector<int> lng = lngmap.PickKeys();
Sort(lng);
return lng;
}
示例10: HelpTopicEnumSpace
Vector<String> HelpTopicEnumSpace()
{
const HelpTopicInfoMap& map = HelpTopicMap();
Index<String> spaces;
for(int i = 0; i < map.GetCount(); i++)
{
String space, nesting, topic;
HelpParseDPP(map.GetKey(i), space, nesting, topic);
spaces.FindAdd(space);
}
Vector<String> splist = spaces.PickKeys();
Sort(splist, StdLess<String>());
return splist;
}
示例11: Load
void ExtToMime::Load(const char *fn)
{
FileIn in(fn);
if(in)
while(!in.IsEof()) {
String ln = TrimLeft(TrimRight(in.GetLine()));
if(ln[0] != '#') {
int q = ln.Find(':');
if(q >= 0) {
String h = ln.Mid(0, q);
int w = h.Find('/');
if(w >= 0) {
int x = ln.Find("*.", q);
if(x >= 0) {
String ext = ln.Mid(x + 2);
if(ext.GetCount() && map.Find(ext) < 0)
map.Add(ext, MAKELONG(minor.FindAdd(h.Mid(w + 1)), major.FindAdd(h.Mid(0, w))));
}
}
}
}
}
}
示例12: SearchForFiles
void SearchForFiles(Index<String>& files, String dir, String mask, int readonly, Progress& pi) {
FindFile ff(AppendFileName(dir, "*.*"));
while(ff) {
if(ff.IsFolder() && *ff.GetName() != '.')
SearchForFiles(files, AppendFileName(dir, ff.GetName()), mask, readonly, pi);
else
if(ff.IsFile() && PatternMatchMulti(mask, ff.GetName())) {
if(IsNull(readonly) || !!readonly == !!ff.IsReadOnly()) {
if(pi.StepCanceled()) return;
files.FindAdd(AppendFileName(dir, ff.GetName()));
}
}
ff.Next();
}
}
示例13: __
Index<int> GetLngSet()
{
CriticalSection::Lock __(slng);
Index<int> ndx;
Array<LngModule>& ma = sMod();
for(int i = 0; i < ma.GetCount(); i++) {
LngModule& m = ma[i];
for(int j = 0; j < m.map.GetCount(); j++) {
Vector<LngRec>& lr = m.map[j];
for(int k = 0; k < lr.GetCount(); k++)
ndx.FindAdd(lr[k].lang);
}
}
return ndx;
}
示例14: HelpTopicEnumNesting
Vector<String> HelpTopicEnumNesting(String sp)
{
const HelpTopicInfoMap& map = HelpTopicMap();
Index<String> nest;
for(int i = 0; i < map.GetCount(); i++)
{
String space, nesting, topic;
HelpParseDPP(map.GetKey(i), space, nesting, topic);
if(IsNull(sp) || sp == space)
nest.FindAdd(nesting);
}
Vector<String> nelist = nest.PickKeys();
Sort(nelist, StdLess<String>());
return nelist;
}
示例15:
Vector<String> Workspace::GetAllAccepts(int pk) const
{
Index<String> accepts;
Index<int> pkg;
pkg.Add(pk);
for(int i = 0; i < pkg.GetCount(); i++) {
const Package& p = package[pkg[i]];
FindAppend(accepts, p.accepts);
for(int u = 0; u < p.uses.GetCount(); u++) {
int f = package.Find(UnixPath(p.uses[u].text));
if(f >= 0)
pkg.FindAdd(f);
}
}
return accepts.PickKeys();
}