本文整理汇总了C++中Hdf::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ Hdf::exists方法的具体用法?C++ Hdf::exists怎么用?C++ Hdf::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hdf
的用法示例。
在下文中一共展示了Hdf::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadRootHdf
void Option::LoadRootHdf(const Hdf &roots, map<string, string> &map) {
if (roots.exists()) {
for (Hdf hdf = roots.firstChild(); hdf.exists(); hdf = hdf.next()) {
map[hdf["root"].get()] = hdf["path"].get();
}
}
}
示例2: LoadRootHdf
void Option::LoadRootHdf(const IniSetting::Map& ini, const Hdf &roots, vector<string> &vec) {
if (roots.exists()) {
for (Hdf hdf = roots.firstChild(); hdf.exists(); hdf = hdf.next()) {
vec.push_back(Config::GetString(ini, hdf,""));
}
}
}
示例3: 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());
}
}
}
}
示例4: LoadRootHdf
void Option::LoadRootHdf(const IniSetting::Map& ini, const Hdf &roots,
map<string, string> &map) {
if (roots.exists()) {
for (Hdf hdf = roots.firstChild(); hdf.exists(); hdf = hdf.next()) {
map[Config::Get(ini, hdf["root"])] = Config::Get(ini, hdf["path"]);
}
}
}
示例5: LoadRootHdf
void Option::LoadRootHdf(const IniSetting::Map& ini,
const Hdf &roots,
const std::string& name,
std::map<std::string, std::string> &map) {
if (roots.exists()) {
for (Hdf hdf = roots[name].firstChild(); hdf.exists(); hdf = hdf.next()) {
map[Config::Get(ini, hdf, "root", "", false)] =
Config::Get(ini, hdf, "path", "", false);
}
}
}
示例6: configGet
void Hdf::configGet(std::map<std::string, std::string,
stdltistr> &values) const {
values.clear();
for (Hdf hdf = firstChild(); hdf.exists(); hdf = hdf.next()) {
values[hdf.getName()] = hdf.configGetString("");
}
}
示例7: lintImpl
bool Hdf::lintImpl(std::vector<std::string> &names,
const std::vector<std::string> &excludes, bool visited) {
unsigned int size = names.size();
bool childVisited = false;
for (Hdf hdf = firstChild(false); hdf.exists(); hdf = hdf.next(false)) {
if (hdf.lintImpl(names, excludes, visited)) {
childVisited = true;
}
}
bool meVisited = childVisited || hdf_is_visited(getRaw());
std::string fullname = getFullPath();
if (!fullname.empty()) {
if (meVisited == visited) {
bool excluded = false;
for (unsigned int i = 0; i < excludes.size(); i++) {
if (match(fullname, excludes[i])) {
excluded = true;
break;
}
}
if (!excluded) {
if (!visited) {
names.resize(size); // so reports about my children are gone
}
names.push_back(fullname);
}
}
}
return meVisited;
}
示例8: Iterate
// Hdf takes precedence, as usual. No `ini` binding yet.
void Config::Iterate(const IniSettingMap &ini, const Hdf &hdf,
std::function<void (const IniSettingMap&,
const Hdf&)> cb) {
if (hdf.exists()) {
for (Hdf c = hdf.firstChild(); c.exists(); c = c.next()) {
cb(ini, c);
}
} else {
auto ini_name = IniName(hdf);
auto* ini_value = ini.get_ptr(ini_name);
if (ini_value && ini_value->isObject()) {
for (auto& val : ini_value->values()) {
cb(val, hdf);
}
}
}
}
示例9: replayInputImpl
void ReplayTransport::replayInputImpl() {
String postData = StringUtil::UUDecode(m_hdf["post"].get(""));
m_postData = string(postData.data(), postData.size());
m_requestHeaders.clear();
for (Hdf hdf = m_hdf["headers"].firstChild(); hdf.exists();
hdf = hdf.next()) {
m_requestHeaders[hdf["name"].get("")].push_back(hdf["value"].get(""));
}
}
示例10: LoadIpList
void IpBlockMap::LoadIpList(hphp_string_map<bool> &ips, Hdf hdf, bool allow) {
for (Hdf child = hdf.firstChild(); child.exists(); child = child.next()) {
string ip = child.getString();
size_t pos = ip.find('/');
if (pos != string::npos) {
ip = ip.substr(0, pos);
}
ips[ip] = allow;
}
}
示例11: 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());
}
}
}
}
示例12:
FilesMatch::FilesMatch(const IniSetting::Map& ini, const Hdf& vh) {
if (vh.exists()) {
m_pattern = format_pattern(vh["pattern"].configGetString(), true);
vh["headers"].configGet(m_headers);
} else {
m_pattern = format_pattern(
ini[String("pattern")].toString().toCppString(),
true
);
for (ArrayIter iter(ini[String("headers")].toArray());
iter; ++iter) {
m_headers.push_back(iter.second().toString().toCppString());
}
}
}
示例13: lint
void Hdf::lint(std::vector<std::string> &names,
const char *excludePatternNode /* = "LintExcludePatterns" */,
bool visited /* = false */) {
std::vector<std::string> patterns;
if (excludePatternNode && *excludePatternNode) {
for (Hdf hdf = operator[](excludePatternNode).firstChild();
hdf.exists(); hdf = hdf.next()) {
std::string value = hdf.configGetString();
if (!value.empty()) {
patterns.push_back(value);
}
}
}
lintImpl(names, patterns, visited);
}
示例14: LoadModules
void Extension::LoadModules(Hdf hdf) {
// Load up any dynamic extensions
std::string path = hdf["DynamicExtensionPath"].getString(".");
for (Hdf ext = hdf["DynamicExtensions"].firstChild();
ext.exists(); ext = ext.next()) {
std::string extLoc = ext.getString();
if (extLoc.empty()) {
continue;
}
if (extLoc[0] != '/') {
extLoc = path + "/" + extLoc;
}
// Extensions are self-registering,
// so we bring in the SO then
// throw away its handle.
void *ptr = dlopen(extLoc.c_str());
if (!ptr) {
throw Exception("Could not open extension %s: %s",
extLoc.c_str(), dlerror());
}
auto getModule = (Extension *(*)())dlsym(ptr, "getModule");
if (!getModule) {
throw Exception("Could not load extension %s: %s (%s)",
extLoc.c_str(),
"getModule() symbol not defined.",
dlerror());
}
Extension *mod = getModule();
if (mod->m_hhvmAPIVersion != HHVM_API_VERSION) {
throw Exception("Could not use extension %s: "
"Compiled with HHVM API Version %" PRId64 ", "
"this version of HHVM expects %ld",
extLoc.c_str(),
mod->m_hhvmAPIVersion,
HHVM_API_VERSION);
}
mod->setDSOName(extLoc);
}
// Invoke Extension::moduleLoad() callbacks
assert(s_registered_extensions);
for (ExtensionMap::const_iterator iter = s_registered_extensions->begin();
iter != s_registered_extensions->end(); ++iter) {
iter->second->moduleLoad(hdf);
}
}
示例15: acl
IpBlockMap::IpBlockMap(Hdf config) {
for (Hdf hdf = config.firstChild(); hdf.exists(); hdf = hdf.next()) {
AclPtr acl(new Acl());
bool allow = hdf["AllowFirst"].getBool(false);
if (allow) {
LoadIpList(acl->ips, hdf["Ip.Deny"], false);
LoadIpList(acl->ips, hdf["Ip.Allow"], true);
} else {
LoadIpList(acl->ips, hdf["Ip.Allow"], true);
LoadIpList(acl->ips, hdf["Ip.Deny"], false);
}
string location = hdf["Location"].getString();
if (!location.empty() && location[0] == '/') {
location = location.substr(1);
}
m_acls[location] = acl;
}
}