当前位置: 首页>>代码示例>>C++>>正文


C++ PackageManager类代码示例

本文整理汇总了C++中PackageManager的典型用法代码示例。如果您正苦于以下问题:C++ PackageManager类的具体用法?C++ PackageManager怎么用?C++ PackageManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _imageDataPtr

SWImage::SWImage(const Common::String &filename, bool &result) :
	_imageDataPtr(0),
	_width(0),
	_height(0) {
	result = false;

	PackageManager *pPackage = Kernel::getInstance()->getPackage();
	assert(pPackage);

	// Load file
	byte *pFileData;
	uint fileSize;
	pFileData = pPackage->getFile(filename, &fileSize);
	if (!pFileData) {
		error("File \"%s\" could not be loaded.", filename.c_str());
		return;
	}

	// Uncompress the image
	int pitch;
	byte *pUncompressedData;
	if (!ImgLoader::decodePNGImage(pFileData, fileSize, pUncompressedData, _width, _height, pitch)) {
		error("Could not decode image.");
		return;
	}

	// Cleanup FileData
	delete[] pFileData;

	_imageDataPtr = (uint *)pUncompressedData;

	result = true;
	return;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:34,代码来源:swimage.cpp

示例2: LoadPackage

static int LoadPackage(lua_State *L) {
	const char* str = lua_tostring(L,-1);
	PackageManager* p = App::getPackageManager();
	p->LoadPackage(str);
	lua_pop(L,1);
	return 0;
}
开发者ID:sunxfancy,项目名称:artist,代码行数:7,代码来源:artistlib.cpp

示例3: _pKernel

FontResource::FontResource(Kernel *pKernel, const Common::String &fileName) :
	_pKernel(pKernel),
	_valid(false),
	Resource(fileName, Resource::TYPE_FONT),
	Common::XMLParser() {

	// Get a pointer to the package manager
	assert(_pKernel);
	PackageManager *pPackage = _pKernel->getPackage();
	assert(pPackage);

	// Load the contents of the file
	uint fileSize;
	char *xmlData = pPackage->getXmlFile(getFileName(), &fileSize);
	if (!xmlData) {
		error("Could not read \"%s\".", getFileName().c_str());
		return;
	}

	// Parse the contents
	if (!loadBuffer((const byte *)xmlData, fileSize))
		return;

	_valid = parse();
	close();
	free(xmlData);
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例4: warning

bool FontResource::parserCallback_font(ParserNode *node) {
	// Get the attributes of the font
	Common::String bitmapFilename = node->values["bitmap"];

	if (!parseIntegerKey(node->values["lineheight"], 1, &_lineHeight)) {
		warning("Illegal or missing lineheight attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
		                 getFileName().c_str(), DEFAULT_LINEHEIGHT);
		_lineHeight = DEFAULT_LINEHEIGHT;
	}

	if (!parseIntegerKey(node->values["gap"], 1, &_gapWidth)) {
		warning("Illegal or missing gap attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
		                 getFileName().c_str(), DEFAULT_GAPWIDTH);
		_gapWidth = DEFAULT_GAPWIDTH;
	}
	
	// Get a reference to the package manager
	assert(_pKernel);
	PackageManager *pPackage = _pKernel->getPackage();
	assert(pPackage);

	// Get the full path and filename for the bitmap resource
	_bitmapFileName = pPackage->getAbsolutePath(bitmapFilename);
	if (_bitmapFileName == "") {
		error("Image file \"%s\" was specified in <font> tag of \"%s\" but could not be found.",
		               _bitmapFileName.c_str(), getFileName().c_str());
	}

	// Pre-cache the resource
	if (!_pKernel->getResourceManager()->precacheResource(_bitmapFileName)) {
		error("Could not precache \"%s\".", _bitmapFileName.c_str());
	}

	return true;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: AddSearchPath

static int AddSearchPath(lua_State *L) {
	const char* str = lua_tostring(L,-1);
	PackageManager* p = App::getPackageManager();
	p->addSearchPath(str);
	lua_pop(L,1);
	return 0;
}
开发者ID:sunxfancy,项目名称:artist,代码行数:7,代码来源:artistlib.cpp

示例6: PackageManager

PackageManager* Project::createPackage()
{
	PackageManager* pkgMgr = new PackageManager();
	pkgMgr->metadata()->setName("Untitled Package");
	mPackageManagers.push_back(pkgMgr);
	return pkgMgr;
}
开发者ID:nbtdev,项目名称:teardrop,代码行数:7,代码来源:Project.cpp

示例7: main

int
main(void)
{
	PackageManager app;
	app.Run();

	return 0;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:8,代码来源:PackageManager.cpp

示例8: _type

Resource::Resource(const Common::String &fileName, RESOURCE_TYPES type) :
	_type(type),
	_refCount(0) {
	PackageManager *pPM = Kernel::getInstance()->getPackage();
	assert(pPM);

	_fileName = pPM->getAbsolutePath(fileName);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:8,代码来源:resource.cpp

示例9: _data

RenderedImage::RenderedImage(const Common::String &filename, bool &result) :
	_data(0),
	_width(0),
	_height(0),
	_isTransparent(true) {
	result = false;

	PackageManager *pPackage = Kernel::getInstance()->getPackage();
	assert(pPackage);

	_backSurface = Kernel::getInstance()->getGfx()->getSurface();

	// Load file
	byte *pFileData;
	uint fileSize;

	bool isPNG = true;

	if (filename.hasPrefix("/saves")) {
		pFileData = readSavegameThumbnail(filename, fileSize, isPNG);
	} else {
		pFileData = pPackage->getFile(filename, &fileSize);
	}

	if (!pFileData) {
		error("File \"%s\" could not be loaded.", filename.c_str());
		return;
	}

	// Uncompress the image
	int pitch;
	if (isPNG)
		result = ImgLoader::decodePNGImage(pFileData, fileSize, _data, _width, _height, pitch);
	else
		result = ImgLoader::decodeThumbnailImage(pFileData, fileSize, _data, _width, _height, pitch);

	if (!result) {
		error("Could not decode image.");
		delete[] pFileData;
		return;
	}

	// Cleanup FileData
	delete[] pFileData;

	_doCleanup = true;

#if defined(SCUMM_LITTLE_ENDIAN)
	// Makes sense for LE only at the moment
	checkForTransparency();
#endif

	return;
}
开发者ID:andrew889,项目名称:scummvm,代码行数:54,代码来源:renderedimage.cpp

示例10: main

int              main(int ac, char **av) {
  PackageManager pkgMan;
  JsonParser     parser;
  std::string    cmd, topic, type;
  int            cpt;
  int            size = parser.getSize();;

  while (parser.parseNextPackage(cmd, topic, type, cpt)) {
    std::cout << "launch package:" << cmd << "   " << topic << "   " << type <<std::endl;
    pkgMan.launchPackage(cmd, topic, type);
    std::cout << "Package " << cpt << "/" << size << " launched..." << std::endl;
    sleep(2);
  }
  std::cout << std::endl << "<<< MscProject launched >>>" << std::endl << std::endl;
  return 0;
}
开发者ID:zukoo,项目名称:MScProject,代码行数:16,代码来源:main.cpp

示例11: checkImport

//throw on error
static ResolutionResult checkImport(const PackageManager& pm, const ParseResultPtr& pr, const std::string& pkgName, const CustomTypeExprNode* tnode, const std::string& type)
{
    PackagePtr pkg = pm.package(pkgName);
    NodePtr node = pkg->getExport(type);
    TypeKind kind;
    if (node) {
        switch (node->type()) {
        case NodeType_InterfaceDecl:
            kind = TypeKind_Interface;
            break;
        case NodeType_EnumDecl:
            kind = TypeKind_Enum;
            break;
        case NodeType_StructDecl:
            kind = TypeKind_Struct;
            break;
        default:
            pr->addDiag(Diagnostic(DiagnosticType_Error, "'" + type + "' in package '" + pkgName + "' is not a type", tnode->loc()));
            throw std::runtime_error("Not a type");
            break;
        }
        return ResolutionResult(pkgName, type, kind);
    }
    pr->addDiag(Diagnostic(DiagnosticType_Error, "Can't find '" + type + "' in package '" + pkgName + "'", tnode->loc()));
    throw std::runtime_error("Can't find import");
}
开发者ID:aldebaran,项目名称:qilang,代码行数:27,代码来源:packagemanager.cpp

示例12: pathname

bool Project::write(ProgressFeedback* feedback)
{
	String pathname(mPath);
	pathname += PATHSEP;
	pathname += mName;
	pathname += ".project";

	TiXmlDocument doc;
	TiXmlDeclaration decl("1.0", "", "");
	doc.InsertEndChild(decl);

	TiXmlElement project("project");
	std::stringstream ss;
	ss << mVersion;
	std::string str(ss.str());
	project.SetAttribute("version", str.c_str());

	ss.str("");
	ss << mPackageManagers.size();
	str.assign(ss.str());
	project.SetAttribute("package_count", str.c_str());

	String packagePath(mPath);
	packagePath += "/packages/";

	for (PackageManagers::iterator it = mPackageManagers.begin(); it != mPackageManagers.end(); ++it) {
		PackageManager* pkgMgr = *it;

		TiXmlElement package("package");
		String name(pkgMgr->metadata()->getName());
		package.SetAttribute("name", name);

		name = pkgMgr->packageFilename();
		package.SetAttribute("filename", name);

		project.InsertEndChild(package);

		// write out the actual package file
		pkgMgr->save(packagePath);
	}

	doc.InsertEndChild(project);

	doc.SaveFile(pathname);

	return true;
}
开发者ID:nbtdev,项目名称:teardrop,代码行数:47,代码来源:Project.cpp

示例13: add

void
PackageManager::add(const PackageManager & theOther) {
    AC_TRACE << "add from package '" << theOther.getSearchPath() << "'";
    PackageList::const_iterator it = theOther._myPackages.begin();
    for (; it != theOther._myPackages.end(); ++it) {
        add(*it);
    }
}
开发者ID:artcom,项目名称:asl,代码行数:8,代码来源:PackageManager.cpp

示例14: dir

bool Sword25Engine::loadPackages() {
	PackageManager *packageManagerPtr = Kernel::getInstance()->getPackage();
	assert(packageManagerPtr);

	// Load the main package
	if (!packageManagerPtr->loadPackage("data.b25c", "/"))
		return false;

	// Get the contents of the main program directory and sort them alphabetically
	Common::FSNode dir(ConfMan.get("path"));
	Common::FSList files;
	if (!dir.isDirectory() || !dir.getChildren(files, Common::FSNode::kListAll)) {
		warning("Game data path does not exist or is not a directory");
		return false;
	}

	Common::sort(files.begin(), files.end());

	// Identify all patch packages
	// The filename of patch packages must have the form patch??.b25c, with the question marks
	// are placeholders for numbers.
	// Since the filenames have been sorted, patches are mounted with low numbers first, through
	// to ones with high numbers. This is important, because newly mount packages overwrite
	// existing files in the virtual file system, if they include files with the same name.
	for (Common::FSList::const_iterator it = files.begin(); it != files.end(); ++it) {
		if (it->getName().matchString("patch???.b25c", true))
			if (!packageManagerPtr->loadPackage(it->getName(), "/"))
				return false;
	}

	// Identify and mount all language packages
	// The filename of the packages have the form lang_*.b25c (eg. lang_de.b25c)
	for (Common::FSList::const_iterator it = files.begin(); it != files.end(); ++it) {
		if (it->getName().matchString("lang_*.b25c", true))
			if (!packageManagerPtr->loadPackage(it->getName(), "/"))
				return false;
	}

	return true;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:40,代码来源:sword25.cpp

示例15: _imageDataPtr

SWImage::SWImage(const Common::String &filename, bool &result) :
	_imageDataPtr(0),
	_width(0),
	_height(0) {
	result = false;

	PackageManager *pPackage = Kernel::getInstance()->getPackage();
	assert(pPackage);

	// Datei laden
	byte *pFileData;
	uint fileSize;
	pFileData = pPackage->getFile(filename, &fileSize);
	if (!pFileData) {
		error("File \"%s\" could not be loaded.", filename.c_str());
		return;
	}

	// Bildeigenschaften bestimmen
	int pitch;
	if (!PNGLoader::imageProperties(pFileData, fileSize, _width, _height)) {
		error("Could not read image properties.");
		return;
	}

	// Das Bild dekomprimieren
	byte *pUncompressedData;
	if (!PNGLoader::decodeImage(pFileData, fileSize, pUncompressedData, _width, _height, pitch)) {
		error("Could not decode image.");
		return;
	}

	// Dateidaten freigeben
	delete[] pFileData;

	_imageDataPtr = (uint *)pUncompressedData;

	result = true;
	return;
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:40,代码来源:swimage.cpp


注:本文中的PackageManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。