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


C++ ArchiveTreeNode::getEntry方法代码示例

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


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

示例1: readConfiguration

/* ColourConfiguration::readConfiguration
 * Reads saved colour configuration [name]
 *******************************************************************/
bool ColourConfiguration::readConfiguration(string name)
{
	// TODO: search custom folder

	// Search resource pk3
	Archive* res = theArchiveManager->programResourceArchive();
	ArchiveTreeNode* dir = res->getDir("config/colours");
	for (unsigned a = 0; a < dir->numEntries(); a++)
	{
		if (S_CMPNOCASE(dir->getEntry(a)->getName(true), name))
			return readConfiguration(dir->getEntry(a)->getMCData());
	}

	return false;
}
开发者ID:Genghoidal,项目名称:SLADE,代码行数:18,代码来源:ColourConfiguration.cpp

示例2: deleteEntry

	bool deleteEntry()
	{
		// Get parent dir
		ArchiveTreeNode* dir = archive->getDir(path);
		if (dir)
			return archive->removeEntry(dir->getEntry(index));
		else
			return false;
	}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:9,代码来源:Archive.cpp

示例3: getConfigurationNames

/* ColourConfiguration::getConfigurationNames
 * Adds all available colour configuration names to [names]
 *******************************************************************/
void ColourConfiguration::getConfigurationNames(vector<string>& names)
{
	// TODO: search custom folder

	// Search resource pk3
	Archive* res = theArchiveManager->programResourceArchive();
	ArchiveTreeNode* dir = res->getDir("config/colours");
	for (unsigned a = 0; a < dir->numEntries(); a++)
		names.push_back(dir->getEntry(a)->getName(true));
}
开发者ID:Genghoidal,项目名称:SLADE,代码行数:13,代码来源:ColourConfiguration.cpp

示例4: doRedo

	bool doRedo()
	{
		// Get entry parent dir
		ArchiveTreeNode* dir = archive->getDir(entry_path);
		if (dir)
		{
			// Rename entry
			ArchiveEntry* entry = dir->getEntry(entry_index);
			return archive->renameEntry(entry, new_name);
		}

		return false;
	}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:13,代码来源:Archive.cpp

示例5: addArchive

/* ArchiveManager::addArchive
 * Adds an archive to the archive list
 *******************************************************************/
bool ArchiveManager::addArchive(Archive* archive)
{
	// Only add if archive is a valid pointer
	if (archive)
	{
		// Add to the list
		archive_t n_archive;
		n_archive.archive = archive;
		n_archive.resource = true;
		open_archives.push_back(n_archive);

		// Listen to the archive
		listenTo(archive);

		// Announce the addition
		announce("archive_added");

		// Add to resource manager
		theResourceManager->addArchive(archive);

		// ZDoom also loads any WADs found in the root of a PK3 or directory
		if ((archive->getType() == ARCHIVE_ZIP || archive->getType() == ARCHIVE_FOLDER) && auto_open_wads_root)
		{
			ArchiveTreeNode* root = archive->getRoot();
			ArchiveEntry* entry;
			EntryType* type;
			for (unsigned a = 0; a < root->numEntries(); a++)
			{
				entry = root->getEntry(a);

				if (entry->getType() == EntryType::unknownType())
					EntryType::detectEntryType(entry);

				type = entry->getType();

				if (type->getId() == "wad")
					// First true: yes, manage this
					// Second true: open silently, don't open a tab for it
					openArchive(entry, true, true);
			}
		}

		return true;
	}
	else
		return false;
}
开发者ID:Genghoidal,项目名称:SLADE,代码行数:50,代码来源:ArchiveManager.cpp

示例6: updateMapPreview

/* MapBackupPanel::updateMapPreview
 * Updates the map preview with the currently selected backup
 *******************************************************************/
void MapBackupPanel::updateMapPreview()
{
	// Clear current preview
	canvas_map->clearMap();

	// Check for selection
	if (list_backups->selectedItems().IsEmpty())
		return;
	int selection = (list_backups->GetItemCount()-1) - list_backups->selectedItems()[0];

	// Load map data to temporary wad
	if (archive_mapdata)
		delete archive_mapdata;
	archive_mapdata = new WadArchive();
	ArchiveTreeNode* dir = (ArchiveTreeNode*)dir_current->getChild(selection);
	for (unsigned a = 0; a < dir->numEntries(); a++)
		archive_mapdata->addEntry(dir->getEntry(a), "", true);

	// Open map preview
	vector<Archive::mapdesc_t> maps = archive_mapdata->detectMaps();
	if (!maps.empty())
		canvas_map->openMap(maps[0]);
}
开发者ID:Blzut3,项目名称:SLADE,代码行数:26,代码来源:MapBackupPanel.cpp

示例7: entryAtPath

/* Archive::entryAtPath
 * Returns the entry at the given path in the archive, or NULL if it
 * doesn't exist
 *******************************************************************/
ArchiveEntry* Archive::entryAtPath(string path)
{
	// Remove leading / from path if needed
	if (path.StartsWith("/"))
		path.Remove(0, 1);

	// Get path as wxFileName for processing
	wxFileName fn(path);

	// Get directory from path
	ArchiveTreeNode* dir;
	if (fn.GetPath(false, wxPATH_UNIX).IsEmpty())
		dir = getRoot();
	else
		dir = getDir(fn.GetPath(true, wxPATH_UNIX));

	// If dir doesn't exist, return null
	if (!dir)
		return NULL;

	// Return entry
	return dir->getEntry(fn.GetFullName());
}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:27,代码来源:Archive.cpp

示例8: loadResourceStyles

/* StyleSet::loadResourceStyles
 * Loads all text styles from the slade resource archive (slade.pk3)
 *******************************************************************/
bool StyleSet::loadResourceStyles()
{
	// Get 'config/text_styles' directory in slade.pk3
	ArchiveTreeNode* dir = theArchiveManager->programResourceArchive()->getDir("config/text_styles");

	// Check it exists
	if (!dir)
	{
		wxLogMessage("Warning: No 'config/text_styles' directory exists in slade.pk3");
		return false;
	}

	// Read default style set first
	ArchiveEntry* default_style = dir->getEntry("default.sss");
	if (default_style)
	{
		// Read entry data into tokenizer
		Tokenizer tz;
		tz.openMem(&default_style->getMCData(), default_style->getName());

		// Parse it
		ParseTreeNode root;
		root.allowDup(true);
		root.parse(tz);

		// Read any styleset definitions
		vector<STreeNode*> nodes = root.getChildren("styleset");
		for (unsigned b = 0; b  < nodes.size(); b++)
		{
			StyleSet* newset = new StyleSet();
			if (newset->parseSet((ParseTreeNode*)nodes[b]))
				style_sets.push_back(newset);
			else
				delete newset;
		}
	}

	// Go through all entries within it
	for (unsigned a = 0; a < dir->numEntries(); a++)
	{
		ArchiveEntry* entry = dir->getEntry(a);

		// Skip default
		if (entry->getName(true) == "default")
			continue;

		// Read entry data into tokenizer
		Tokenizer tz;
		tz.openMem(&entry->getMCData(), entry->getName());

		// Parse it
		ParseTreeNode root;
		root.allowDup(true);
		root.parse(tz);

		// Read any styleset definitions
		vector<STreeNode*> nodes = root.getChildren("styleset");
		for (unsigned b = 0; b  < nodes.size(); b++)
		{
			StyleSet* newset = new StyleSet();
			if (newset->parseSet((ParseTreeNode*)nodes[b]))
				style_sets.push_back(newset);
			else
				delete newset;
		}
	}

	return true;
}
开发者ID:IjonTichy,项目名称:SLADE,代码行数:72,代码来源:TextStyle.cpp

示例9: if

/* Archive::findAll
 * Returns a list of entries matching the search criteria in
 * [options]
 *******************************************************************/
vector<ArchiveEntry*> Archive::findAll(search_options_t& options)
{
	// Init search variables
	ArchiveTreeNode* dir = options.dir;
	if (!dir) dir = dir_root;
	vector<ArchiveEntry*> ret;
	options.match_name.MakeLower();		// Force case-insensitive

	// Begin search

	// Search entries
	for (unsigned a = 0; a < dir->numEntries(); a++)
	{
		ArchiveEntry* entry = dir->getEntry(a);

		// Check type
		if (options.match_type)
		{
			if (entry->getType() == EntryType::unknownType())
			{
				if (!options.match_type->isThisType(entry))
					continue;
			}
			else if (options.match_type != entry->getType())
				continue;
		}

		// Check name
		if (!options.match_name.IsEmpty())
		{
			// Cut extension if ignoring
			wxFileName fn(entry->getName());
			if (options.ignore_ext)
			{
				if (!fn.GetName().MakeLower().Matches(options.match_name))
					continue;
			}
			else if (!fn.GetFullName().MakeLower().Matches(options.match_name))
				continue;
		}

		// Check namespace
		if (!options.match_namespace.IsEmpty())
		{
			if (!(S_CMPNOCASE(detectNamespace(entry), options.match_namespace)))
				continue;
		}

		// Entry passed all checks so far, so we found a match
		ret.push_back(entry);
	}

	// Search subdirectories (if needed)
	if (options.search_subdirs)
	{
		for (unsigned a = 0; a < dir->nChildren(); a++)
		{
			search_options_t opt = options;
			opt.dir = (ArchiveTreeNode*)dir->getChild(a);

			// Add any matches to the list
			vector<ArchiveEntry*> vec = findAll(opt);
			ret.insert(ret.end(), vec.begin(), vec.end());
		}
	}

	// Return matches
	return ret;
}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:73,代码来源:Archive.cpp

示例10: findLast

/* Archive::findLast
 * Returns the last entry matching the search criteria in [options],
 * or NULL if no matching entry was found
 *******************************************************************/
ArchiveEntry* Archive::findLast(search_options_t& options)
{
	// Init search variables
	ArchiveTreeNode* dir = options.dir;
	if (!dir) dir = dir_root;
	options.match_name.MakeLower();		// Force case-insensitive

	// Begin search

	// Search subdirectories (if needed) (bottom-up)
	if (options.search_subdirs)
	{
		for (int a = dir->nChildren() - 1; a >= 0; a--)
		{
			search_options_t opt = options;
			opt.dir = (ArchiveTreeNode*)dir->getChild(a);
			ArchiveEntry* match = findLast(opt);

			// If a match was found in this subdir, return it
			if (match)
				return match;
		}
	}

	// Search entries (bottom-up)
	for (int a = dir->numEntries() - 1; a >= 0; a--)
	{
		ArchiveEntry* entry = dir->getEntry(a);

		// Check type
		if (options.match_type)
		{
			if (entry->getType() == EntryType::unknownType())
			{
				if (!options.match_type->isThisType(entry))
					continue;
			}
			else if (options.match_type != entry->getType())
				continue;
		}

		// Check name
		if (!options.match_name.IsEmpty())
		{
			// Cut extension if ignoring
			wxFileName fn(entry->getName());
			if (options.ignore_ext)
			{
				if (!options.match_name.Matches(fn.GetName().MakeLower()))
					continue;
			}
			else if (!options.match_name.Matches(fn.GetFullName().MakeLower()))
				continue;
		}

		// Check namespace
		if (!options.match_namespace.IsEmpty())
		{
			if (!(S_CMPNOCASE(detectNamespace(entry), options.match_namespace)))
				continue;
		}

		// Entry passed all checks so far, so we found a match
		return entry;
	}

	// No matches found
	return NULL;
}
开发者ID:Aeyesx,项目名称:SLADE,代码行数:73,代码来源:Archive.cpp


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