本文整理汇总了C++中ds::String::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ String::isEmpty方法的具体用法?C++ String::isEmpty怎么用?C++ String::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ds::String
的用法示例。
在下文中一共展示了String::isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fopen
std::list<AuthServer_AgeInfo> configure_static_ages()
{
AuthServer_AgeInfo age;
std::list<AuthServer_AgeInfo> configs;
DS::String filename = DS::Settings::SettingsPath() + "/static_ages.ini";
FILE* cfgfile = fopen(filename.c_str(), "r");
if (!cfgfile) {
fprintf(stderr, "Cannot open %s for reading\n", filename.c_str());
return configs;
}
try {
char buffer[4096];
bool haveAge = false;
while (fgets(buffer, 4096, cfgfile)) {
DS::String line = DS::String(buffer).strip('#');
if (line.isEmpty())
continue;
if (line.strip().c_str()[0] == '[') {
if (haveAge)
configs.push_back(age);
age.clear();
DS::String header = line.strip();
header.replace("[","");
header.replace("]","");
if (header == "auto")
age.m_ageId = gen_uuid();
else
age.m_ageId = DS::Uuid(header.c_str());
haveAge = true;
continue;
}
std::vector<DS::String> params = line.split('=', 1);
if (params.size() != 2) {
fprintf(stderr, "Warning: Invalid config line: %s\n", line.c_str());
continue;
}
// Clean any whitespace around the '='
params[0] = params[0].strip();
params[1] = params[1].strip();
if (params[0] == "Filename") {
age.m_filename = params[1];
} else if (params[0] == "Instance") {
age.m_instName = params[1];
} else if (params[0] == "UserName") {
age.m_userName = params[1];
} else {
fprintf(stderr, "Warning: Unknown setting '%s' ignored\n",
params[0].c_str());
}
}
if (haveAge)
configs.push_back(age);
} catch (DS::AssertException ex) {
fprintf(stderr, "[Auth] Assertion failed at %s:%ld: %s\n",
ex.m_file, ex.m_line, ex.m_cond);
fclose(cfgfile);
return configs;
}
fclose(cfgfile);
return configs;
}