本文整理汇总了C++中Index::GetKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ Index::GetKeys方法的具体用法?C++ Index::GetKeys怎么用?C++ Index::GetKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index::GetKeys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PackagePath
Index<String> MakeBuild::PackageConfig(const Workspace& wspc, int package,
const VectorMap<String, String>& bm, String mainparam,
Host& host, Builder& b, String *target)
{
String packagepath = PackagePath(wspc[package]);
const Package& pkg = wspc.package[package];
Index<String> cfg;
mainparam << ' ' << bm.Get(targetmode ? "RELEASE_FLAGS" : "DEBUG_FLAGS", NULL);
cfg = SplitFlags(mainparam, package == 0, wspc.GetAllAccepts(package));
cfg.FindAdd(bm.Get("BUILDER", "GCC"));
const TargetMode& m = GetTargetMode();
if(targetmode == 0)
cfg.FindAdd("DEBUG");
switch(m.linkmode) {
case 2:
cfg.FindAdd("SO");
case 1:
cfg.FindAdd("SHARED");
}
if(targetmode == 2)
cfg.FindAdd("FORCE_SPEED");
if(targetmode == 3)
cfg.FindAdd("FORCE_SIZE");
int q = m.package.Find(wspc[package]);
if(q >= 0) {
const PackageMode& p = m.package[q];
switch(p.debug >= 0 ? p.debug : m.def.debug) {
case 1: cfg.FindAdd("DEBUG_MINIMAL"); break;
case 2: cfg.FindAdd("DEBUG_FULL"); break;
}
if(!pkg.noblitz && (p.blitz >= 0 ? p.blitz : m.def.blitz))
cfg.FindAdd("BLITZ");
}
else {
switch(m.def.debug) {
case 1: cfg.FindAdd("DEBUG_MINIMAL"); break;
case 2: cfg.FindAdd("DEBUG_FULL"); break;
}
if(!pkg.noblitz && m.def.blitz)
cfg.FindAdd("BLITZ");
}
host.AddFlags(cfg);
b.AddFlags(cfg);
for(int i = 0; i < pkg.flag.GetCount(); i++) {
if(MatchWhen(pkg.flag[i].when, cfg.GetKeys()))
cfg.Add(pkg.flag[i].text);
}
if(target)
*target = Gather(pkg.target, cfg.GetKeys(), true);
return cfg;
}
示例2: Build
bool MakeBuild::Build()
{
VectorMap<String, String> bm = GetMethodVars(method);
if(bm.GetCount() == 0) {
PutConsole("Invalid build method");
ConsoleShow();
return false;
}
One<Host> host = CreateHost(false);
One<Builder> builder = CreateBuilder(~host);
if(!builder)
return false;
Index<String> p = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam,
*host, *builder);
Workspace wspc;
wspc.Scan(GetMain(), p.GetKeys());
return Build(wspc, mainconfigparam, Null);
}
示例3: GetAllUses
Vector<String> MakeBuild::GetAllLibraries(const Workspace& wspc, int index,
const VectorMap<String, String>& bm, String mainparam,
Host& host, Builder& builder)
{ // Warning: This does not seem to do what it is supposed to do...
Vector<String> uses = GetAllUses(wspc, index);
uses.Add(wspc[index]);
Index<String> libraries;
for(int i = 0; i < uses.GetCount(); i++) {
int f = wspc.package.Find(UnixPath(uses[i]));
if(f >= 0) {
const Package& pk = wspc.package[f];
Index<String> config = PackageConfig(wspc, f, bm, mainparam, host, builder);
Vector<String> pklibs = Split(Gather(pk.library, config.GetKeys()), ' ');
FindAppend(libraries, pklibs);
}
}
return libraries.PickKeys();
}
示例4: SaveMakeFile
void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
{
BeginBuilding(false, true);
VectorMap<String, String> bm = GetMethodVars(method);
One<Host> host = CreateHost(false);
One<Builder> b = CreateBuilder(~host);
if(!b)
return;
const TargetMode& tm = GetTargetMode();
String makefile;
Vector<String> uppdirs = GetUppDirs();
String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
String inclist;
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b);
bool win32 = allconfig.Find("WIN32") >= 0;
Workspace wspc;
wspc.Scan(GetMain(), allconfig.GetKeys());
for(int i = 1; i < wspc.GetCount(); i++) {
Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
for(int a = allconfig.GetCount(); --a >= 0;)
if(modconfig.Find(allconfig[a]) < 0)
allconfig.Remove(a);
}
if(!exporting)
for(int i = 0; i < uppdirs.GetCount(); i++) {
String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32);
makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n";
inclist << " -I$(UPPDIR" << (i + 1) << ")";
}
else
inclist << "-I./";
Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
for(int i = 0; i < includes.GetCount(); i++)
inclist << " -I" << includes[i];
makefile << "\n"
"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n"
"CINC = " << inclist << "\n"
"Macro = ";
for(int i = 0; i < allconfig.GetCount(); i++)
makefile << " -Dflag" << allconfig[i];
makefile << "\n";
String output, config, install, rules, linkdep, linkfiles, linkfileend;
for(int i = 0; i < wspc.GetCount(); i++) {
b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
b->version = tm.version;
b->method = method;
MakeFile mf;
b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i),
GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig,
exporting);
if(!i) {
String tdir = mf.outdir;
String trg;
if(tm.target_override) {
trg = GetMakePath(AdjustMakePath(tm.target), win32);
if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/'))
trg << mf.outfile;
else if(trg.Find(win32 ? '\\' : '/') < 0)
trg.Insert(0, "$(OutDir)");
}
output = Nvl(trg, mf.output);
if(exporting)
output = wspc[i] + ".out";
install << "\n"
"OutDir = " << tdir << "\n"
"OutFile = " << output << "\n"
"\n"
".PHONY: all\n"
"all: prepare $(OutFile)\n"
"\n"
".PHONY: prepare\n"
"prepare:\n";
}
config << mf.config;
install << mf.install;
rules << mf.rules;
linkdep << mf.linkdep;
linkfiles << mf.linkfiles;
linkfileend << mf.linkfileend;
}
makefile
<< config
<< install
<< "\n"
"$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n"
<< rules
//.........这里部分代码省略.........
示例5: BuildPackage
bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, int pkcount,
String mainparam, String outfile, Vector<String>& linkfile, String& linkopt, bool link)
{
String package = wspc[pkindex];
String mainpackage = wspc[0];
const Package& pkg = wspc.package[pkindex];
VectorMap<String, String> bm = GetMethodVars(method);
if(bm.GetCount() == 0) {
PutConsole("Invalid build method");
ConsoleShow();
return false;
}
One<Host> host = CreateHost(false);
if(!IsNull(onefile)) {
OneFileHost *h = new OneFileHost;
h->host = host;
h->onefile = onefile;
host = h;
}
One<Builder> b = CreateBuilder(~host);
if(!b)
return false;
b->config = PackageConfig(wspc, pkindex, bm, mainparam, *host, *b);
const TargetMode& m = targetmode == 0 ? debug : release;
b->version = m.version;
b->method = method;
b->outdir = OutDir(b->config, package, bm);
host->RealizeDir(b->outdir);
String mainfn = Null;
Index<String> mcfg = PackageConfig(wspc, 0, bm, mainparam, *host, *b, &mainfn);
HdependClearDependencies();
for(int i = 0; i < pkg.GetCount(); i++) {
const Array<OptItem>& f = pkg[i].depends;
for(int j = 0; j < f.GetCount(); j++)
if(MatchWhen(f[j].when, mcfg.GetKeys()))
HdependAddDependency(SourcePath(package, pkg[i]), SourcePath(package, f[j].text));
}
String tout = OutDir(mcfg, mainpackage, bm, use_target);
host->RealizeDir(tout);
if(IsNull(mainfn))
mainfn = GetFileTitle(mainpackage) + b->GetTargetExt();
if(!IsNull(outfile))
target = NormalizePath(outfile, tout);
else {
if(m.target_override && !IsNull(m.target) && IsFolder(m.target))
target = host->NormalizePath(AppendFileName(m.target, mainfn));
else
if(m.target_override && (IsFullPath(m.target) || *m.target == '/' || *m.target == '\\'))
target = m.target;
else
if(m.target_override && !IsNull(m.target))
target = host->NormalizePath(AppendFileName(tout, m.target));
else
if(IsFullPath(mainfn))
target = mainfn;
else
target = host->NormalizePath(AppendFileName(tout, mainfn));
}
b->target = target;
b->mainpackage = mainpackage;
if(IsNull(onefile)) {
String out;
out << "----- " << package << " ( " << Join(b->config.GetKeys(), " ") << " )";
if(pkcount > 1)
out << " (" << (pknumber + 1) << " / " << pkcount << ')';
PutConsole(out);
}
else
b->config.FindAdd("NOLIB");
bool ok = b->BuildPackage(package, linkfile, linkopt,
GetAllUses(wspc, pkindex),
GetAllLibraries(wspc, pkindex, bm, mainparam, *host, *b),
targetmode - 1);
Vector<String> errors = PickErrors();
host->DeleteFile(errors);
if(!ok || !errors.IsEmpty())
return false;
if(link) {
ok = b->Link(linkfile, linkopt, GetTargetMode().createmap);
errors = PickErrors();
host->DeleteFile(errors);
if(!ok || !errors.IsEmpty())
return false;
}
return true;
}