本文整理汇总了C++中common::StringMap类的典型用法代码示例。如果您正苦于以下问题:C++ StringMap类的具体用法?C++ StringMap怎么用?C++ StringMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringMap类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parseActiveKey
bool XMLParser::parseActiveKey(bool closed) {
bool ignore = false;
assert(_activeKey.empty() == false);
ParserNode *key = _activeKey.top();
if (key->name == "xml" && key->header == true) {
assert(closed);
return parseXMLHeader(key) && closeKey();
}
XMLKeyLayout *layout = (_activeKey.size() == 1) ? _XMLkeys : getParentNode(key)->layout;
if (layout->children.contains(key->name)) {
key->layout = layout->children[key->name];
Common::StringMap localMap = key->values;
int keyCount = localMap.size();
for (Common::List<XMLKeyLayout::XMLKeyProperty>::const_iterator i = key->layout->properties.begin(); i != key->layout->properties.end(); ++i) {
if (i->required && !localMap.contains(i->name))
return parserError("Missing required property '%s' inside key '%s'", i->name.c_str(), key->name.c_str());
else if (localMap.contains(i->name))
keyCount--;
}
if (keyCount > 0)
return parserError("Unhandled property inside key '%s'.", key->name.c_str());
} else {
return parserError("Unexpected key in the active scope ('%s').", key->name.c_str());
}
// check if any of the parents must be ignored.
// if a parent is ignored, all children are too.
for (int i = _activeKey.size() - 1; i >= 0; --i) {
if (_activeKey[i]->ignore)
ignore = true;
}
if (ignore == false && keyCallback(key) == false) {
// HACK: People may be stupid and overlook the fact that
// when keyCallback() fails, a parserError() must be set.
// We set it manually in that case.
if (_state != kParserError)
parserError("Unhandled exception when parsing '%s' key.", key->name.c_str());
return false;
}
if (closed)
return closeKey();
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:55,代码来源:xmlparser.cpp
示例2: detectClashes
void FrotzMetaEngine::detectClashes(Common::StringMap &map) {
for (const PlainGameDescriptor *pd = FROTZ_GAME_LIST; pd->gameId; ++pd) {
if (map.contains(pd->gameId))
error("Duplicate game Id found - %s", pd->gameId);
map[pd->gameId] = "";
}
}
开发者ID:sev-,项目名称:scummvm,代码行数:7,代码来源:detection.cpp
示例3: detectClashes
void GlulxeMetaEngine::detectClashes(Common::StringMap &map) {
for (const GlulxeDescriptor *pd = GLULXE_GAME_LIST; pd->gameId; ++pd) {
if (map.contains(pd->gameId))
error("Duplicate game Id found - %s", pd->gameId);
map[pd->gameId] = "";
}
}
开发者ID:Templier,项目名称:scummvm,代码行数:7,代码来源:detection.cpp
示例4: buildMap
bool Databases::buildMap(const dBase &db, Common::StringMap &map) const {
int fLanguage = findField(db, "Langage", dBase::kTypeString);
int fGroup = findField(db, "Nom" , dBase::kTypeString);
int fSection = findField(db, "Section", dBase::kTypeString);
int fKeyword = findField(db, "Motcle" , dBase::kTypeString);
int fText = findField(db, "Texte" , dBase::kTypeString);
if ((fLanguage < 0) || (fGroup < 0) || (fSection < 0) || (fKeyword < 0) || (fText < 0))
return false;
const Common::Array<dBase::Record> &records = db.getRecords();
Common::Array<dBase::Record>::const_iterator record;
for (record = records.begin(); record != records.end(); ++record) {
Common::String key;
key += db.getString(*record, fLanguage) + ":";
key += db.getString(*record, fGroup ) + ":";
key += db.getString(*record, fSection ) + ":";
key += db.getString(*record, fKeyword );
map.setVal(key, db.getString(*record, fText));
}
return true;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:26,代码来源:databases.cpp
示例5: detectClashes
void FrotzMetaEngine::detectClashes(Common::StringMap &map) {
for (int idx = 0; idx < 2; ++idx) {
for (const PlainGameDescriptor *pd = (idx == 0) ? INFOCOM_GAME_LIST : ZCODE_GAME_LIST; pd->gameId; ++pd) {
if (map.contains(pd->gameId))
error("Duplicate game Id found - %s", pd->gameId);
map[pd->gameId] = "";
}
}
}
开发者ID:fingolfin,项目名称:scummvm,代码行数:9,代码来源:detection.cpp
示例6: if
extern "C" int scummvm_main(int argc, const char * const argv[]) {
Common::String specialDebug;
Common::String command;
// Verify that the backend has been initialized (i.e. g_system has been set).
assert(g_system);
OSystem &system = *g_system;
// Register config manager defaults
Base::registerDefaults();
// Parse the command line
Common::StringMap settings;
command = Base::parseCommandLine(settings, argc, argv);
// Load the config file (possibly overridden via command line):
if (settings.contains("config")) {
ConfMan.loadConfigFile(settings["config"]);
settings.erase("config");
} else {
ConfMan.loadDefaultConfigFile();
}
// Update the config file
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
// Load and setup the debuglevel and the debug flags. We do this at the
// soonest possible moment to ensure debug output starts early on, if
// requested.
if (settings.contains("debuglevel")) {
gDebugLevel = (int)strtol(settings["debuglevel"].c_str(), 0, 10);
printf("Debuglevel (from command line): %d\n", gDebugLevel);
settings.erase("debuglevel"); // This option should not be passed to ConfMan.
} else if (ConfMan.hasKey("debuglevel"))
gDebugLevel = ConfMan.getInt("debuglevel");
if (settings.contains("debugflags")) {
specialDebug = settings["debugflags"];
settings.erase("debugflags");
}
PluginManager::instance().init();
PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager
// If we received an invalid music parameter via command line we check this here.
// We can't check this before loading the music plugins.
// On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
if (settings.contains("music-driver")) {
if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_INVALID) {
warning("Unrecognized music driver '%s'. Switching to default device", settings["music-driver"].c_str());
settings["music-driver"] = "auto";
}
}
// Process the remaining command line settings. Must be done after the
// config file and the plugins have been loaded.
Common::Error res;
// TODO: deal with settings that require plugins to be loaded
if ((res = Base::processSettings(command, settings)) != Common::kArgumentNotProcessed)
return res;
// Init the backend. Must take place after all config data (including
// the command line params) was read.
system.initBackend();
// If we received an invalid graphics mode parameter via command line
// we check this here. We can't do it until after the backend is inited,
// or there won't be a graphics manager to ask for the supported modes.
if (settings.contains("gfx-mode")) {
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
Common::String option = settings["gfx-mode"];
bool isValid = false;
while (gm->name && !isValid) {
isValid = !scumm_stricmp(gm->name, option.c_str());
gm++;
}
if (!isValid) {
warning("Unrecognized graphics mode '%s'. Switching to default mode", option.c_str());
settings["gfx-mode"] = "default";
}
}
setupGraphics(system);
// Init the different managers that are used by the engines.
// Do it here to prevent fragmentation later
system.getAudioCDManager();
MusicManager::instance();
Common::DebugManager::instance();
// Init the event manager. As the virtual keyboard is loaded here, it must
// take place after the backend is initiated and the screen has been setup
system.getEventManager()->init();
// Directly after initializing the event manager, we will initialize our
// event recorder.
//
//.........这里部分代码省略.........
开发者ID:MatChung,项目名称:scummvm-ps3,代码行数:101,代码来源:main.cpp
示例7: if
extern "C" int scummvm_main(int argc, const char * const argv[]) {
Common::String specialDebug;
Common::String command;
// Verify that the backend has been initialized (i.e. g_system has been set).
assert(g_system);
OSystem &system = *g_system;
// Register config manager defaults
Base::registerDefaults();
// Parse the command line
Common::StringMap settings;
command = Base::parseCommandLine(settings, argc, argv);
// Load the config file (possibly overridden via command line):
if (settings.contains("config")) {
ConfMan.loadConfigFile(settings["config"]);
settings.erase("config");
} else {
ConfMan.loadDefaultConfigFile();
}
// Update the config file
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
// Load and setup the debuglevel and the debug flags. We do this at the
// soonest possible moment to ensure debug output starts early on, if
// requested.
if (settings.contains("debuglevel")) {
gDebugLevel = (int)strtol(settings["debuglevel"].c_str(), 0, 10);
printf("Debuglevel (from command line): %d\n", gDebugLevel);
settings.erase("debuglevel"); // This option should not be passed to ConfMan.
} else if (ConfMan.hasKey("debuglevel"))
gDebugLevel = ConfMan.getInt("debuglevel");
if (settings.contains("debugflags")) {
specialDebug = settings["debugflags"];
settings.erase("debugflags");
}
PluginManager::instance().init();
PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager
// If we received an invalid music parameter via command line we check this here.
// We can't check this before loading the music plugins.
// On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
if (settings.contains("music-driver")) {
if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_INVALID) {
warning("Unrecognized music driver '%s'. Switching to default device", settings["music-driver"].c_str());
settings["music-driver"] = "auto";
}
}
// Process the remaining command line settings. Must be done after the
// config file and the plugins have been loaded.
Common::Error res;
// TODO: deal with settings that require plugins to be loaded
if (Base::processSettings(command, settings, res)) {
if (res.getCode() != Common::kNoError)
warning("%s", res.getDesc().c_str());
return res.getCode();
}
// Init the backend. Must take place after all config data (including
// the command line params) was read.
system.initBackend();
// If we received an invalid graphics mode parameter via command line
// we check this here. We can't do it until after the backend is inited,
// or there won't be a graphics manager to ask for the supported modes.
if (settings.contains("gfx-mode")) {
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
Common::String option = settings["gfx-mode"];
bool isValid = false;
while (gm->name && !isValid) {
isValid = !scumm_stricmp(gm->name, option.c_str());
gm++;
}
if (!isValid) {
warning("Unrecognized graphics mode '%s'. Switching to default mode", option.c_str());
settings["gfx-mode"] = "default";
}
}
if (settings.contains("disable-display")) {
ConfMan.setInt("disable-display", 1, Common::ConfigManager::kTransientDomain);
}
setupGraphics(system);
// Init the different managers that are used by the engines.
// Do it here to prevent fragmentation later
system.getAudioCDManager();
MusicManager::instance();
Common::DebugManager::instance();
// Init the event manager. As the virtual keyboard is loaded here, it must
// take place after the backend is initiated and the screen has been setup
//.........这里部分代码省略.........
开发者ID:colin3dmax,项目名称:scummvm,代码行数:101,代码来源:main.cpp
注:本文中的common::StringMap类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论