本文整理汇总了C++中Hdf::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Hdf::isEmpty方法的具体用法?C++ Hdf::isEmpty怎么用?C++ Hdf::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hdf
的用法示例。
在下文中一共展示了Hdf::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Iterate
// No `ini` binding yet. Hdf still takes precedence but will be removed
// once we have made all options ini-aware. All new settings should
// use the ini path of this method (i.e., pass a bogus Hdf or keep it null)
void Config::Iterate(std::function<void (const IniSettingMap&,
const Hdf&,
const std::string&)> cb,
const IniSettingMap &ini, const Hdf& config,
const std::string &name,
const bool prepend_hhvm /* = true */) {
// We shouldn't be passing a leaf here. That's why name is not
// optional.
assert(!name.empty());
Hdf hdf = config[name];
if (hdf.exists() && !hdf.isEmpty()) {
for (Hdf c = hdf.firstChild(); c.exists(); c = c.next()) {
cb(IniSetting::Map::object, c, "");
}
} else {
Hdf empty;
auto ini_name = IniName(name, prepend_hhvm);
auto* ini_value = ini_iterate(ini, ini_name);
if (ini_value && ini_value->isObject()) {
for (auto& pair : ini_value->items()) {
cb(pair.second, empty, pair.first.data());
}
}
}
}
示例2: Iterate
// No `ini` binding yet. Hdf still takes precedence but will be removed
// once we have made all options ini-aware. All new settings should
// use the ini path of this method (i.e., pass a bogus Hdf or keep it null)
void Config::Iterate(std::function<void (const IniSettingMap&,
const Hdf&,
const std::string&)> cb,
const IniSettingMap &ini, const Hdf& config,
const std::string &name,
const bool prepend_hhvm /* = true */) {
Hdf hdf = name.empty() ? config : config[name];
if (hdf.exists() && !hdf.isEmpty()) {
for (Hdf c = hdf.firstChild(); c.exists(); c = c.next()) {
cb(IniSetting::Map::object, c, "");
}
} else {
Hdf empty;
auto ini_value = name.empty() ? ini :
ini_iterate(ini, IniName(name, prepend_hhvm));
if (ini_value.isArray()) {
for (ArrayIter iter(ini_value.toArray()); iter; ++iter) {
cb(iter.second(), empty, iter.first().toString().toCppString());
}
}
}
}