本文整理汇总了C++中ConfigFile::getOption方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigFile::getOption方法的具体用法?C++ ConfigFile::getOption怎么用?C++ ConfigFile::getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFile
的用法示例。
在下文中一共展示了ConfigFile::getOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLayerOptionFlags
// Map option strings to flag enum values
VkFlags GetLayerOptionFlags(std::string _option, std::unordered_map<std::string, VkFlags> const &enum_data,
uint32_t option_default) {
VkDebugReportFlagsEXT flags = option_default;
std::string option_list = g_configFileObj.getOption(_option.c_str());
while (option_list.length() != 0) {
// Find length of option string
std::size_t option_length = option_list.find(",");
if (option_length == option_list.npos) {
option_length = option_list.size();
}
// Get first option in list
const std::string option = option_list.substr(0, option_length);
auto enum_value = enum_data.find(option);
if (enum_value != enum_data.end()) {
flags |= enum_value->second;
}
// Remove first option from option_list
option_list.erase(0, option_length);
// Remove possible comma separator
std::size_t char_position = option_list.find(",");
if (char_position == 0) {
option_list.erase(char_position, 1);
}
// Remove possible space
char_position = option_list.find(" ");
if (char_position == 0) {
option_list.erase(char_position, 1);
}
}
return flags;
}
示例2: getLayerOptionEnum
bool getLayerOptionEnum(const char *_option, uint32_t *optionDefault)
{
bool res;
const char *option = (g_configFileObj.getOption(_option));
if (option != NULL) {
*optionDefault = convertStringEnumVal(option);
res = false;
} else {
res = true;
}
return res;
}
示例3: getLayerOptionFlags
VkDebugReportFlagsEXT getLayerOptionFlags(const char *_option, uint32_t optionDefault)
{
VkDebugReportFlagsEXT flags = optionDefault;
const char *option = (g_configFileObj.getOption(_option));
/* parse comma-separated options */
while (option) {
const char *p = strchr(option, ',');
size_t len;
if (p)
len = p - option;
else
len = strlen(option);
if (len > 0) {
if (strncmp(option, "warn", len) == 0) {
flags |= VK_DEBUG_REPORT_WARNING_BIT_EXT;
} else if (strncmp(option, "info", len) == 0) {
flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT;
} else if (strncmp(option, "perf", len) == 0) {
flags |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
} else if (strncmp(option, "error", len) == 0) {
flags |= VK_DEBUG_REPORT_ERROR_BIT_EXT;
} else if (strncmp(option, "debug", len) == 0) {
flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT;
}
}
if (!p)
break;
option = p + 1;
}
return flags;
}
示例4:
const char *getLayerOption(const char *_option)
{
return g_configFileObj.getOption(_option);
}