本文整理汇总了C++中Package::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::Load方法的具体用法?C++ Package::Load怎么用?C++ Package::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::Load方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadWorld
void World::LoadWorld( const String& pFilename )
{
Package* package = PackageManager::Instance()->CreatePackage( pFilename );
SetOwner( package );
package->Load();
SetOwner( NULL );
}
示例2: New
IResource *PackageResourceLoader(const char *filename, ResourceManager *res, IMemoryPool *pool)
{
Package *pkg = New(Package());
BOOL loaded = pkg->Load(filename, res, pool);
if (!loaded)
{
Delete(pkg);
}
return pkg;
}
示例3: OnOK
void SelectPackageDlg::OnOK()
{
Package pkg;
int f = ~filter;
String n = GetCurrentName();
if(n.GetCount() && pkg.Load(PackagePath(n)) &&
(!(f & MAIN) || pkg.config.GetCount())) {
loading = false;
finished = true;
AcceptBreak(IDOK);
}
}
示例4: ListCursor
void SelectPackageDlg::ListCursor()
{
int c = GetCurrentIndex();
if(c >= 0 && c < packages.GetCount()) {
String pp = PackagePath(GetCurrentName());
Package pkg;
pkg.Load(pp);
description <<= pkg.description;
}
else
description <<= Null;
}
示例5: Create
void TemplateDlg::Create()
{
const PackageTemplate& tp = ActualTemplate();
ArrayMap<String, EscValue> var = MakeVars();
for(int i = 0; i < tp.file.GetCount(); i++) {
const FileTemplate& ft = tp.file[i];
if(IsNull(ft.condition) || IsTrue(Evaluate(ft.condition, var))) {
String fn = Expand(ft.filename, var);
if(!IsNull(fn)) {
fn = AppendFileName(AppendFileName(~nest, (String)~package), fn);
RealizePath(fn);
SaveFile(fn, Expand(ft.text, var));
}
}
}
Package p;
String f = AppendFileName(AppendFileName(~nest, (String)~package), (String)~package + ".upp");
p.Load(f);
p.description = ~description;
p.Save(f);
}
示例6: GetPackageInfo
PackageInfo GetPackageInfo(const String& name)
{
String path = PackagePath(name);
Time tm = FileGetTime(path);
int q = sPi.Find(name);
if(q >= 0) {
if(path == sPi[q].path && tm == sPi[q].stamp)
return sPi[q];
}
else {
q = sPi.GetCount();
sPi.Add(name);
}
PackageInfo& pi = sPi[q];
pi.path = path;
pi.stamp = tm;
Package p;
p.Load(path);
pi.ink = p.ink;
pi.italic = p.italic;
pi.bold = p.bold;
return pi;
}
示例7: PackageOp
void WorkspaceWork::PackageOp(String active, String from_package, String rename)
{
active = UnixPath(active);
from_package = UnixPath(from_package);
rename = UnixPath(rename);
for(int i = 0; i < package.GetCount(); i++)
if(IsNull(from_package) || UnixPath(package[i].name) == from_package) {
String pp = PackagePath(package[i].name);
RealizePath(pp);
Package prj;
prj.Load(pp);
for(int i = prj.uses.GetCount(); --i >= 0;)
if(UnixPath(prj.uses[i].text) == active) {
if(rename.GetCount())
prj.uses[i].text = rename;
else
prj.uses.Remove(i);
}
prj.Save(pp);
}
ScanWorkspace();
SyncWorkspace();
}
示例8: ChangeDescription
void SelectPackageDlg::ChangeDescription()
{
int ii = GetCurrentIndex();
if(ii >= 0 && ii < packages.GetCount()) {
PkInfo& p = packages[ii];
WithDescriptionLayout<TopWindow> dlg;
CtrlLayoutOKCancel(dlg, "Package description");
String pp = PackagePath(p.package);
Package pkg;
if(!pkg.Load(pp)) {
Exclamation("Package does not exist.");
return;
}
dlg.text <<= pkg.description;
if(dlg.Run() != IDOK)
return;
pkg.description = ~dlg.text;
pkg.Save(pp);
p.description = description <<= ~dlg.text;
if(alist.IsCursor())
alist.Set(2, ~dlg.text);
}
}
示例9: RemovePackageMenu
void WorkspaceWork::RemovePackageMenu(Bar& bar)
{
if(bar.IsScanKeys() || bar.IsScanHelp() || !bar.IsMenuBar())
return;
String active = UnixPath(GetActivePackage());
int usecnt = 0;
for(int i = 0; i < package.GetCount(); i++) {
String pn = UnixPath(package[i].name);
Package prj;
String pp = PackagePath(pn);
prj.Load(pp);
for(int i = 0; i < prj.uses.GetCount(); i++)
if(UnixPath(prj.uses[i].text) == active) {
usecnt++;
bar.Add("Remove from '" + pn + '\'', THISBACK1(RemovePackage, pn))
.Help(NFormat("Remove package '%s' from uses section in '%s'", active, pp));
}
}
if(usecnt > 1) {
bar.MenuSeparator();
bar.Add("Remove all uses", THISBACK1(RemovePackage, String(Null)))
.Help(NFormat("Remove package '%s' from all uses in active project and its submodules", active));
}
}
示例10: p
Vector<String> CppBuilder::CustomStep(const String& pf, const String& package_, bool& error)
{
String package = Nvl(package_, mainpackage);
String path = (*pf == '.' && pf[1] != '.') ? target : SourcePath(package, pf);
String file = GetHostPath(path);
String ext = ToLower(GetFileExt(pf));
if(ext == ".ext") {
Vector<String> files;
Vector<String> dirs;
sGatherAllExt(files, dirs, GetFileFolder(path), "");
Index<String> pkg_files;
Package pkg;
pkg.Load(PackagePath(package));
for(int i = 0; i < pkg.GetCount(); i++)
pkg_files.Add(pkg[i]);
Index<String> out;
Index<String> include_path;
String f = LoadFile(path);
try {
CParser p(f);
while(!p.IsEof()) {
if(p.Id("files")) {
Vector<String> e = ReadPatterns(p);
for(int i = 0; i < files.GetCount(); i++)
for(int j = 0; j < e.GetCount(); j++) {
String f = files[i];
if(PatternMatch(e[j], f) && pkg_files.Find(f) < 0)
out.FindAdd(f);
}
}
if(p.Id("exclude")) {
ExtExclude(p, out);
}
if(p.Id("include_path")) {
Vector<String> e = ReadPatterns(p);
for(int j = 0; j < e.GetCount(); j++) {
String ee = e[j];
if(ee.Find('*') >= 0)
for(int i = 0; i < dirs.GetCount(); i++) {
String d = dirs[i];
if(PatternMatch(e[j], d)) {
include_path.FindAdd(d);
}
}
else
include_path.Add(ee);
}
}
if(p.Id("exclude_path")) {
ExtExclude(p, include_path);
}
if(p.Id("includes")) {
Vector<String> e = ReadPatterns(p);
for(int i = 0; i < files.GetCount(); i++)
for(int j = 0; j < e.GetCount(); j++) {
String f = files[i];
if(PatternMatch(e[j], f) && pkg_files.Find(f) < 0)
include_path.FindAdd(GetFileFolder(f));
}
}
}
}
catch(CParser::Error) {
PutConsole("Invalid .ext file");
error = true;
return Vector<String>();
}
for(int i = 0; i < include_path.GetCount(); i++)
include.Add(NormalizePath(include_path[i], GetFileFolder(path)));
Vector<String> o;
for(int i = 0; i < out.GetCount(); i++)
o.Add(SourcePath(package, out[i]));
return o;
}
for(int i = 0; i < wspc.GetCount(); i++) {
const Array< ::CustomStep >& mv = wspc.GetPackage(i).custom;
for(int j = 0; j < mv.GetCount(); j++) {
const ::CustomStep& m = mv[j];
if(MatchWhen(m.when, config.GetKeys()) && m.MatchExt(ext)) {
VectorMap<String, String> mac;
AddPath(mac, "PATH", file);
AddPath(mac, "RELPATH", pf);
AddPath(mac, "DIR", GetFileFolder(PackagePath(package)));
AddPath(mac, "FILEDIR", GetFileFolder(file));
AddPath(mac, "PACKAGE", package);
mac.Add("FILE", GetFileName(file));
mac.Add("TITLE", GetFileTitle(file));
AddPath(mac, "EXEPATH", GetHostPath(target));
AddPath(mac, "EXEDIR", GetHostPath(GetFileFolder(target)));
mac.Add("EXEFILE", GetFileName(target));
mac.Add("EXETITLE", GetFileTitle(target));
AddPath(mac, "OUTDIR", GetHostPath(outdir));
//BW
AddPath(mac, "OUTDIR", GetHostPath(GetFileFolder(target)));
AddPath(mac, "OUTFILE", GetHostPath(GetFileName(target)));
AddPath(mac, "OUTTITLE", GetHostPath(GetFileTitle(target)));
//.........这里部分代码省略.........
示例11: AddMakeFile
void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
const Vector<String>& all_uses, const Vector<String>& all_libraries,
const Index<String>& common_config, bool exporting)
{
String packagepath = PackagePath(package);
Package pkg;
pkg.Load(packagepath);
String packagedir = GetFileFolder(packagepath);
Vector<String> src = GetUppDirs();
for(int i = 0; i < src.GetCount(); i++)
src[i] = UnixPath(src[i]);
bool main = HasFlag("MAIN");
bool is_shared = HasFlag("SO");
bool libout = !main && !HasFlag("NOLIB");
bool win32 = HasFlag("WIN32");
String pack_ident = MakeIdent(package);
String outdir = "OutDir_" + pack_ident;
String macros = "Macro_" + pack_ident;
String macdef = "$(Macro)";
String objext = (HasFlag("MSC") || HasFlag("EVC") ? ".obj" : ".o");
Vector<String> x(config.GetKeys(), 1);
Sort(x);
for(int i = 0; i < x.GetCount(); i++) {
if(common_config.Find(x[i]) < 0)
macdef << " -Dflag" << x[i];
x[i] = InitCaps(x[i]);
}
makefile.outdir << "$(" << outdir << ")";
makefile.outfile << AdjustMakePath(GetFileTitle(NativePath(package)));
if(main)
makefile.outfile << GetTargetExt();
else if(is_shared)
makefile.outfile << (win32 ? ".dll" : ".so");
else
makefile.outfile << (win32 && HasFlag("MSC") ? ".lib" : ".a");
makefile.output << (main ? String("$(OutDir)") : makefile.outdir) << makefile.outfile;
if(main) {
makefile.config << "CXX = c++\n"
"LINKER = $(CXX)\n";
String flags;
if(HasFlag("DEBUG"))
flags << " -D_DEBUG " << debug_options;
else
flags << ' ' << release_options;
if(HasFlag("DEBUG_MINIMAL"))
flags << " -ggdb -g1";
if(HasFlag("DEBUG_FULL"))
flags << " -ggdb -g2";
if(is_shared && !win32)
flags << " -fPIC ";
flags << ' ' << Gather(pkg.option, config.GetKeys());
makefile.config << "CFLAGS =" << flags << "\n"
"CXXFLAGS =" << flags << "\n"
"LDFLAGS = " << (HasFlag("DEBUG") ? debug_link : release_link) << " $(LINKOPTIONS)\n"
"LIBPATH =";
for(int i = 0; i < libpath.GetCount(); i++)
makefile.config << " -L" << GetMakePath(AdjustMakePath(GetHostPathQ(libpath[i])));
makefile.config << "\n"
"AR = ar -sr\n\n";
makefile.install << "\t-mkdir -p $(OutDir)\n";
Vector<String> lib;
String lnk;
lnk << "$(LINKER)";
if(!HasFlag("SHARED"))
lnk << " -static";
if(HasFlag("WIN32")) {
lnk << " -mwindows";
if(!HasFlag("GUI"))
makefile.linkfiles << " -mconsole";
}
lnk << " -o $(OutFile)";
if(HasFlag("DEBUG") || HasFlag("DEBUG_MINIMAL") || HasFlag("DEBUG_FULL"))
lnk << " -ggdb";
else
lnk << (!HasFlag("OSX11") ? " -Wl,-s" : "");
lnk << " $(LIBPATH)";
if (!HasFlag("OSX11"))
lnk << " -Wl,-O,2";
lnk << " $(LDFLAGS) -Wl,--start-group ";
makefile.linkfiles = lnk;
}
makefile.config << outdir << " = $(UPPOUT)"
<< GetMakePath(AdjustMakePath(String().Cat() << package << '/' << method << '-' << Join(x, "-") << '/')) << "\n"
<< macros << " = " << macdef << "\n";
makefile.install << "\t-mkdir -p $(" << outdir << ")\n";
String libdep, libfiles;
libdep << makefile.output << ":";
if(is_shared)
{
//.........这里部分代码省略.........
示例12: Load
void SelectPackageDlg::Load()
{
if(selectvars && !base.IsCursor())
return;
if(loading) { // If we are called recursively from ProcessEvents, stop current loading and change loadi
loadi++;
loading = false;
return;
}
int current_loadi = -1;
while(current_loadi != loadi) {
current_loadi = loadi;
if(selectvars) {
String assembly = (String)base.Get(0);
list.Enable(base.IsCursor());
if(!base.IsCursor())
return;
LoadVars(assembly);
}
Vector<String> upp = GetUppDirs();
packages.Clear();
description.Hide();
progress.Show();
loading = true;
data.Clear();
Index<String> dir_exists;
String cache_path = CachePath(GetVarsName());
LoadFromFile(data, cache_path);
data.SetCount(upp.GetCount());
for(int i = 0; i < upp.GetCount(); i++) // Scan nest folders for subfolders (package candidates)
ScanFolder(upp[i], data[i], GetFileName(upp[i]), dir_exists, Null);
int update = msecs();
for(int i = 0; i < data.GetCount() && loading; i++) { // Now investigate individual sub folders
ArrayMap<String, PkData>& nest = data[i];
for(int i = 0; i < nest.GetCount() && loading; i++) {
if(msecs(update) >= 100) { // each 100 ms update the list (and open select dialog after splash screen is closed)
if(!IsSplashOpen() && !IsOpen())
Open();
progress++;
SyncList();
update = msecs();
}
ProcessEvents(); // keep GUI running
PkData& d = nest[i];
String path = nest.GetKey(i);
FindFile ff(path);
if(ff && ff.IsFolder()) {
String upp_path = AppendFileName(path, GetFileName(d.package) + ".upp");
LSLOW();
Time tm = FileGetTime(upp_path);
if(IsNull(tm)) // .upp file does not exist - not a package
d.ispackage = false;
else
if(tm != d.tm) { // cached info is outdated
Package p;
if(p.Load(upp_path)) {
d.description = p.description;
d.main = p.config.GetCount();
d.tm = tm;
d.ispackage = true;
}
else
d.ispackage = false;
}
else
d.ispackage = true;
if(d.ispackage) {
String icon_path = AppendFileName(path, "icon16x16.png");
tm = FileGetTime(icon_path);
if(IsNull(tm)) // package icon does not exist
d.icon = Null;
else
if(tm != d.itm) { // chached package icon outdated
d.icon = StreamRaster::LoadFileAny(icon_path);
d.itm = tm;
}
}
}
else
nest.Unlink(i); // cached folder was deleted
ScanFolder(path, nest, d.nest, dir_exists, d.package + '/');
}
nest.Sweep();
}
StoreToFile(data, cache_path);
progress.Hide();
while(IsSplashOpen())
ProcessEvents();
if(!IsOpen())
Open();
description.Show();
if(loading) {
loading = false;
SyncList();
}
}
}