示例#1
0
bool NDSFile::hasResource(Common::UString name) const {
	name.makeLower();

	for (ResourceList::const_iterator r = _resources.begin(); r != _resources.end(); ++r)
		if (TypeMan.setFileType(r->name, r->type) == name)
			return true;

	return false;
}
示例#2
0
Encoding parseEncoding(Common::UString str) {
	if (str.empty())
		return kEncodingInvalid;

	str.makeLower();

	for (size_t i = 0; i < ARRAYSIZE(kEncodingStrings); i++) {
		for (size_t j = 0; j < ARRAYSIZE(kEncodingStrings[i].strings); j++) {
			if (!kEncodingStrings[i].strings[j])
				break;

			if (str == kEncodingStrings[i].strings[j])
				return kEncodingStrings[i].encoding;
		}
	}

	return kEncodingInvalid;
}
示例#3
0
Language LanguageManager::parseLanguage(Common::UString str) {
	if (str.empty())
		return kLanguageInvalid;

	str.makeLower();

	for (size_t i = 0; i < ARRAYSIZE(kLanguageStrings); i++) {
		for (size_t j = 0; j < ARRAYSIZE(kLanguageStrings[i].strings); j++) {
			if (!kLanguageStrings[i].strings[j])
				break;

			if (str == kLanguageStrings[i].strings[j])
				return kLanguageStrings[i].language;
		}
	}

	return kLanguageInvalid;
}
示例#4
0
void XMLNode::load(_xmlNode &node, bool makeLower) {
	_name    = node.name    ? (const char *) node.name    : "";
	_content = node.content ? (const char *) node.content : "";

	if (makeLower)
		_name.makeLower();

	for (xmlAttrPtr attrib = node.properties; attrib; attrib = attrib->next) {
		Common::UString name (attrib->name     ? (const char *) attrib->name              : "");
		Common::UString value(attrib->children ? (const char *) attrib->children->content : "");

		if (makeLower)
			name.makeLower();

		_properties.insert(std::make_pair(name, value));
	}

	for (xmlNodePtr child = node.children; child; child = child->next) {
		_children.push_back(new XMLNode(*child, makeLower, this));

		_childMap.insert(std::make_pair(_children.back()->getName(), _children.back()));
	}
}