本文整理汇总了C++中Hdf::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ Hdf::getString方法的具体用法?C++ Hdf::getString怎么用?C++ Hdf::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hdf
的用法示例。
在下文中一共展示了Hdf::getString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadRootHdf
void Option::LoadRootHdf(const Hdf &roots, vector<string> &vec) {
if (roots.exists()) {
for (Hdf hdf = roots.firstChild(); hdf.exists(); hdf = hdf.next()) {
vec.push_back(hdf.getString(""));
}
}
}
示例2: 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;
}
}
示例3: matchHdfPattern
static bool matchHdfPattern(const std::string &value, Hdf hdfPattern) {
string pattern = hdfPattern.getString();
if (!pattern.empty()) {
Variant ret = preg_match(String(pattern.c_str(), pattern.size(),
AttachLiteral),
String(value.c_str(), value.size(),
AttachLiteral));
if (ret.toInt64() <= 0) {
return false;
}
}
return true;
}
示例4: 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.getString();
if (!value.empty()) {
patterns.push_back(value);
}
}
}
lintImpl(names, patterns, visited);
}
示例5: 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);
}
}
示例6: LoadIpList
void IpBlockMap::LoadIpList(AclPtr acl, Hdf hdf, bool allow) {
for (Hdf child = hdf.firstChild(); child.exists(); child = child.next()) {
string ip = child.getString();
unsigned int start, end;
if (ReadIPv4Address(ip.c_str(), start, end)) {
ASSERT(end >= start);
if (end - start < 1024) {
for (unsigned int i = start; i <= end; i++) {
acl->ips[i] = allow;
}
} else {
acl->ranges.resize(acl->ranges.size() + 1);
IpRange &range = acl->ranges.back();
range.start = start;
range.end = end;
range.allow = allow;
}
}
}
}
示例7: Load
void Option::Load(Hdf &config) {
LoadRootHdf(config["IncludeRoots"], IncludeRoots);
LoadRootHdf(config["AutoloadRoots"], AutoloadRoots);
config["PackageFiles"].get(PackageFiles);
config["IncludeSearchPaths"].get(IncludeSearchPaths);
config["PackageDirectories"].get(PackageDirectories);
config["PackageExcludeDirs"].get(PackageExcludeDirs);
config["PackageExcludeFiles"].get(PackageExcludeFiles);
config["PackageExcludePatterns"].get(PackageExcludePatterns);
config["PackageExcludeStaticDirs"].get(PackageExcludeStaticDirs);
config["PackageExcludeStaticFiles"].get(PackageExcludeStaticFiles);
config["PackageExcludeStaticPatterns"].get(PackageExcludeStaticPatterns);
CachePHPFile = config["CachePHPFile"].getBool();
config["ParseOnDemandDirs"].get(ParseOnDemandDirs);
{
Hdf cg = config["CodeGeneration"];
string tmp;
#define READ_CG_OPTION(name) \
tmp = cg[#name].getString(); \
if (!tmp.empty()) { \
name = OptionStrings.add(tmp.c_str()); \
}
READ_CG_OPTION(IdPrefix);
READ_CG_OPTION(LabelEscape);
READ_CG_OPTION(LambdaPrefix);
}
int count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
++count;
}
SepExtensions.resize(count);
count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
SepExtensionOptions &options = SepExtensions[count++];
options.name = hdf.getName();
options.soname = hdf["soname"].getString();
options.include_path = hdf["include"].getString();
options.lib_path = hdf["libpath"].getString();
options.shared = hdf["shared"].getBool();
}
config["DynamicFunctionPrefix"].get(DynamicFunctionPrefixes);
config["DynamicFunctionPostfix"].get(DynamicFunctionPostfixes);
config["DynamicMethodPrefix"].get(DynamicMethodPrefixes);
config["DynamicInvokeFunctions"].get(DynamicInvokeFunctions);
config["VolatileClasses"].get(VolatileClasses);
// build map from function names to sections
for (Hdf hdf = config["FunctionSections"].firstChild(); hdf.exists();
hdf = hdf.next()) {
for (Hdf hdfFunc = hdf.firstChild(); hdfFunc.exists();
hdfFunc = hdfFunc.next()) {
FunctionSections[hdfFunc.getString()] = hdf.getName();
}
}
{
Hdf repo = config["Repo"];
{
Hdf repoCentral = repo["Central"];
RepoCentralPath = repoCentral["Path"].getString();
}
RepoDebugInfo = repo["DebugInfo"].getBool(false);
}
{
Hdf autoloadMap = config["AutoloadMap"];
autoloadMap["class"].get(AutoloadClassMap);
autoloadMap["function"].get(AutoloadFuncMap);
autoloadMap["constant"].get(AutoloadConstMap);
AutoloadRoot = autoloadMap["root"].getString();
}
HardTypeHints = config["HardTypeHints"].getBool(true);
EnableHipHopSyntax = config["EnableHipHopSyntax"].getBool();
JitEnableRenameFunction = config["JitEnableRenameFunction"].getBool();
EnableHipHopExperimentalSyntax =
config["EnableHipHopExperimentalSyntax"].getBool();
EnableShortTags = config["EnableShortTags"].getBool(true);
EnableAspTags = config["EnableAspTags"].getBool();
EnableXHP = config["EnableXHP"].getBool(true);
ParserThreadCount = config["ParserThreadCount"].getInt32(0);
if (ParserThreadCount <= 0) {
ParserThreadCount = Process::GetCPUCount();
}
EnableFinallyStatement = config["EnableFinallyStatement"].getBool();
//.........这里部分代码省略.........
示例8: get
void Hdf::get(hphp_string_imap<std::string> &values) const {
values.clear();
for (Hdf hdf = firstChild(); hdf.exists(); hdf = hdf.next()) {
values[hdf.getName()] = hdf.getString("");
}
}
示例9: createFromUserConfig
void SourceRootInfo::createFromUserConfig() {
String homePath = String(RuntimeOption::SandboxHome) + "/" + m_user + "/";
{
struct stat hstat;
if (stat(homePath.c_str(), &hstat) != 0) {
if (!RuntimeOption::SandboxFallback.empty()) {
homePath = String(RuntimeOption::SandboxFallback) + "/" + m_user + "/";
if (stat(homePath.c_str(), &hstat) != 0) {
m_sandboxCond = SandboxOff;
return;
}
}
}
}
string confpath = string(homePath.c_str()) +
RuntimeOption::SandboxConfFile;
Hdf config, serverVars;
String sp, lp, alp, userOverride;
try {
config.open(confpath);
userOverride = config["user_override"].get();
Hdf sboxConf = config[m_sandbox.c_str()];
if (sboxConf.exists()) {
sp = sboxConf["path"].get();
lp = sboxConf["log"].get();
alp = sboxConf["accesslog"].get();
serverVars = sboxConf["ServerVars"];
}
} catch (HdfException &e) {
Logger::Error("%s ignored: %s", confpath.c_str(),
e.getMessage().c_str());
}
if (serverVars.exists()) {
for (Hdf hdf = serverVars.firstChild(); hdf.exists(); hdf = hdf.next()) {
m_serverVars.set(String(hdf.getName()), String(hdf.getString()));
}
}
if (!userOverride.empty()) {
m_user = std::move(userOverride);
}
if (m_sandbox == "default") {
if (sp.isNull()) {
sp = "www/";
}
}
if (sp.isNull()) {
m_sandboxCond = SandboxError;
return;
}
if (sp.charAt(0) == '/') {
m_path = std::move(sp);
} else {
m_path = homePath + sp;
}
if (m_path.charAt(m_path.size() - 1) != '/') {
m_path += "/";
}
if (!lp.isNull()) {
if (lp.charAt(0) != '/') {
lp = homePath + lp;
}
if (!Logger::SetThreadLog(lp.c_str())) {
Logger::Warning("Sandbox error log %s could not be opened",
lp.c_str());
}
}
if (!alp.isNull()) {
if (alp.charAt(0) != '/') {
alp = homePath + alp;
}
if (!HttpRequestHandler::GetAccessLog().setThreadLog(alp.c_str())) {
Logger::Warning("Sandbox access log %s could not be opened",
alp.c_str());
}
}
}
示例10: Load
void Option::Load(Hdf &config) {
LoadRootHdf(config["IncludeRoots"], IncludeRoots);
LoadRootHdf(config["AutoloadRoots"], AutoloadRoots);
config["PackageFiles"].get(PackageFiles);
config["IncludeSearchPaths"].get(IncludeSearchPaths);
config["PackageDirectories"].get(PackageDirectories);
config["PackageExcludeDirs"].get(PackageExcludeDirs);
config["PackageExcludeFiles"].get(PackageExcludeFiles);
config["PackageExcludePatterns"].get(PackageExcludePatterns);
config["PackageExcludeStaticDirs"].get(PackageExcludeStaticDirs);
config["PackageExcludeStaticFiles"].get(PackageExcludeStaticFiles);
config["PackageExcludeStaticPatterns"].get(PackageExcludeStaticPatterns);
CachePHPFile = config["CachePHPFile"].getBool();
config["ParseOnDemandDirs"].get(ParseOnDemandDirs);
{
Hdf cg = config["CodeGeneration"];
string tmp;
#define READ_CG_OPTION(name) \
tmp = cg[#name].getString(); \
if (!tmp.empty()) { \
name = OptionStrings.add(tmp.c_str()); \
}
READ_CG_OPTION(IdPrefix);
READ_CG_OPTION(LabelEscape);
READ_CG_OPTION(LambdaPrefix);
READ_CG_OPTION(FunctionPrefix);
READ_CG_OPTION(BuiltinFunctionPrefix);
READ_CG_OPTION(InvokePrefix);
READ_CG_OPTION(CreateObjectPrefix);
READ_CG_OPTION(PseudoMainPrefix);
READ_CG_OPTION(VariablePrefix);
READ_CG_OPTION(GlobalVariablePrefix);
READ_CG_OPTION(StaticVariablePrefix);
READ_CG_OPTION(ScalarArrayName);
READ_CG_OPTION(SystemScalarArrayName);
READ_CG_OPTION(ClassPrefix);
READ_CG_OPTION(ClassStaticsPrefix);
READ_CG_OPTION(ClassStaticsObjectPrefix);
READ_CG_OPTION(ClassStaticsCallbackPrefix);
READ_CG_OPTION(ClassStaticsIdGetterPrefix);
READ_CG_OPTION(ClassStaticInitializerPrefix);
READ_CG_OPTION(ClassStaticInitializerFlagPrefix);
READ_CG_OPTION(ClassWrapperFunctionPrefix);
READ_CG_OPTION(ObjectPrefix);
READ_CG_OPTION(ObjectStaticPrefix);
READ_CG_OPTION(SmartPtrPrefix);
READ_CG_OPTION(MethodPrefix);
READ_CG_OPTION(MethodWrapperPrefix);
READ_CG_OPTION(MethodImplPrefix);
READ_CG_OPTION(PropertyPrefix);
READ_CG_OPTION(StaticPropertyPrefix);
READ_CG_OPTION(ConstantPrefix);
READ_CG_OPTION(ClassConstantPrefix);
READ_CG_OPTION(ExceptionPrefix);
READ_CG_OPTION(TempVariablePrefix);
READ_CG_OPTION(EvalOrderTempPrefix);
READ_CG_OPTION(SilencerPrefix);
READ_CG_OPTION(EvalInvokePrefix);
READ_CG_OPTION(TempPrefix);
READ_CG_OPTION(MapPrefix);
READ_CG_OPTION(IterPrefix);
READ_CG_OPTION(InitPrefix);
READ_CG_OPTION(FFIFnPrefix);
READ_CG_OPTION(SystemFilePrefix);
READ_CG_OPTION(UserFilePrefix);
READ_CG_OPTION(ClassHeaderPrefix);
READ_CG_OPTION(ClusterPrefix);
READ_CG_OPTION(FFIFilePrefix);
}
int count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
++count;
}
SepExtensions.resize(count);
count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
SepExtensionOptions &options = SepExtensions[count++];
options.name = hdf.getName();
options.soname = hdf["soname"].getString();
options.include_path = hdf["include"].getString();
options.lib_path = hdf["libpath"].getString();
options.shared = hdf["shared"].getBool();
}
config["DynamicFunctionPrefix"].get(DynamicFunctionPrefixes);
config["DynamicFunctionPostfix"].get(DynamicFunctionPostfixes);
config["DynamicMethodPrefix"].get(DynamicMethodPrefixes);
config["DynamicInvokeFunctions"].get(DynamicInvokeFunctions);
config["VolatileClasses"].get(VolatileClasses);
// build map from function names to sections
for (Hdf hdf = config["FunctionSections"].firstChild(); hdf.exists();
//.........这里部分代码省略.........
示例11: Load
void Option::Load(Hdf &config) {
LoadRootHdf(config["IncludeRoots"], IncludeRoots);
LoadRootHdf(config["AutoloadRoots"], AutoloadRoots);
config["PackageFiles"].get(PackageFiles);
config["IncludeSearchPaths"].get(IncludeSearchPaths);
config["PackageDirectories"].get(PackageDirectories);
config["PackageExcludeDirs"].get(PackageExcludeDirs);
config["PackageExcludeFiles"].get(PackageExcludeFiles);
config["PackageExcludePatterns"].get(PackageExcludePatterns);
config["PackageExcludeStaticDirs"].get(PackageExcludeStaticDirs);
config["PackageExcludeStaticFiles"].get(PackageExcludeStaticFiles);
config["PackageExcludeStaticPatterns"].get(PackageExcludeStaticPatterns);
CachePHPFile = config["CachePHPFile"].getBool();
config["ParseOnDemandDirs"].get(ParseOnDemandDirs);
{
Hdf cg = config["CodeGeneration"];
string tmp;
#define READ_CG_OPTION(name) \
tmp = cg[#name].getString(); \
if (!tmp.empty()) { \
name = OptionStrings.add(tmp.c_str()); \
}
READ_CG_OPTION(IdPrefix);
READ_CG_OPTION(LabelEscape);
READ_CG_OPTION(LambdaPrefix);
}
config["DynamicFunctionPrefix"].get(DynamicFunctionPrefixes);
config["DynamicFunctionPostfix"].get(DynamicFunctionPostfixes);
config["DynamicMethodPrefix"].get(DynamicMethodPrefixes);
config["DynamicInvokeFunctions"].get(DynamicInvokeFunctions);
config["VolatileClasses"].get(VolatileClasses);
// build map from function names to sections
for (Hdf hdf = config["FunctionSections"].firstChild(); hdf.exists();
hdf = hdf.next()) {
for (Hdf hdfFunc = hdf.firstChild(); hdfFunc.exists();
hdfFunc = hdfFunc.next()) {
FunctionSections[hdfFunc.getString()] = hdf.getName();
}
}
{
Hdf repo = config["Repo"];
{
Hdf repoCentral = repo["Central"];
RepoCentralPath = repoCentral["Path"].getString();
}
RepoDebugInfo = repo["DebugInfo"].getBool(false);
}
{
Hdf autoloadMap = config["AutoloadMap"];
autoloadMap["class"].get(AutoloadClassMap);
autoloadMap["function"].get(AutoloadFuncMap);
autoloadMap["constant"].get(AutoloadConstMap);
AutoloadRoot = autoloadMap["root"].getString();
}
HardTypeHints = config["HardTypeHints"].getBool(true);
EnableHipHopSyntax = config["EnableHipHopSyntax"].getBool();
EnableZendCompat = config["EnableZendCompat"].getBool();
JitEnableRenameFunction = config["JitEnableRenameFunction"].getBool();
EnableHipHopExperimentalSyntax =
config["EnableHipHopExperimentalSyntax"].getBool();
EnableShortTags = config["EnableShortTags"].getBool(true);
EnableAspTags = config["EnableAspTags"].getBool();
EnableXHP = config["EnableXHP"].getBool(false);
if (EnableHipHopSyntax) {
// If EnableHipHopSyntax is true, it forces EnableXHP to true
// regardless of how it was set in the config
EnableXHP = true;
}
ParserThreadCount = config["ParserThreadCount"].getInt32(0);
if (ParserThreadCount <= 0) {
ParserThreadCount = Process::GetCPUCount();
}
EnableFinallyStatement = config["EnableFinallyStatement"].getBool();
EnableEval = (EvalLevel)config["EnableEval"].getByte(0);
AllDynamic = config["AllDynamic"].getBool(true);
AllVolatile = config["AllVolatile"].getBool();
GenerateDocComments = config["GenerateDocComments"].getBool(true);
EliminateDeadCode = config["EliminateDeadCode"].getBool(true);
CopyProp = config["CopyProp"].getBool(false);
LocalCopyProp = config["LocalCopyProp"].getBool(true);
StringLoopOpts = config["StringLoopOpts"].getBool(true);
AutoInline = config["AutoInline"].getInt32(0);
//.........这里部分代码省略.........
示例12: Load
void Option::Load(Hdf &config) {
LoadRootHdf(config["IncludeRoots"], IncludeRoots);
LoadRootHdf(config["AutoloadRoots"], AutoloadRoots);
config["IncludeSearchPaths"].get(IncludeSearchPaths);
config["PackageDirectories"].get(PackageDirectories);
config["PackageExcludeDirs"].get(PackageExcludeDirs);
config["PackageExcludeFiles"].get(PackageExcludeFiles);
config["PackageExcludeStaticFiles"].get(PackageExcludeStaticFiles);
CachePHPFile = config["CachePHPFile"].getBool();
{
Hdf cg = config["CodeGeneration"];
string tmp;
#define READ_CG_OPTION(name) \
tmp = cg[#name].getString(); \
if (!tmp.empty()) { \
name = OptionStrings.add(tmp.c_str()); \
}
READ_CG_OPTION(IdPrefix);
READ_CG_OPTION(LambdaPrefix);
READ_CG_OPTION(FunctionPrefix);
READ_CG_OPTION(BuiltinFunctionPrefix);
READ_CG_OPTION(InvokePrefix);
READ_CG_OPTION(CreateObjectPrefix);
READ_CG_OPTION(PseudoMainPrefix);
READ_CG_OPTION(VariablePrefix);
READ_CG_OPTION(GlobalVariablePrefix);
READ_CG_OPTION(StaticVariablePrefix);
READ_CG_OPTION(ScalarArrayName);
READ_CG_OPTION(SystemScalarArrayName);
READ_CG_OPTION(ClassPrefix);
READ_CG_OPTION(ClassStaticsPrefix);
READ_CG_OPTION(ClassStaticsObjectPrefix);
READ_CG_OPTION(ClassStaticsIdGetterPrefix);
READ_CG_OPTION(ClassStaticInitializerPrefix);
READ_CG_OPTION(ClassStaticInitializerFlagPrefix);
READ_CG_OPTION(ClassWrapperFunctionPrefix);
READ_CG_OPTION(ObjectPrefix);
READ_CG_OPTION(ObjectStaticPrefix);
READ_CG_OPTION(SmartPtrPrefix);
READ_CG_OPTION(MethodPrefix);
READ_CG_OPTION(MethodImplPrefix);
READ_CG_OPTION(PropertyPrefix);
READ_CG_OPTION(StaticPropertyPrefix);
READ_CG_OPTION(ConstantPrefix);
READ_CG_OPTION(ClassConstantPrefix);
READ_CG_OPTION(ExceptionPrefix);
READ_CG_OPTION(TempVariablePrefix);
READ_CG_OPTION(EvalOrderTempPrefix);
READ_CG_OPTION(SilencerPrefix);
READ_CG_OPTION(EvalInvokePrefix);
READ_CG_OPTION(TempPrefix);
READ_CG_OPTION(MapPrefix);
READ_CG_OPTION(IterPrefix);
READ_CG_OPTION(InitPrefix);
READ_CG_OPTION(FFIFnPrefix);
READ_CG_OPTION(SystemFilePrefix);
READ_CG_OPTION(UserFilePrefix);
READ_CG_OPTION(ClassHeaderPrefix);
READ_CG_OPTION(ClusterPrefix);
READ_CG_OPTION(FFIFilePrefix);
}
int count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
++count;
}
SepExtensions.resize(count);
count = 0;
for (Hdf hdf = config["SepExtensions"].firstChild(); hdf.exists();
hdf = hdf.next()) {
SepExtensionOptions &options = SepExtensions[count++];
options.name = hdf.getName();
options.soname = hdf["soname"].getString();
options.include_path = hdf["include"].getString();
options.lib_path = hdf["libpath"].getString();
options.shared = hdf["shared"].getBool();
}
config["DynamicFunctionPrefix"].get(DynamicFunctionPrefixes);
config["DynamicFunctionPostfix"].get(DynamicFunctionPostfixes);
config["DynamicMethodPrefix"].get(DynamicMethodPrefixes);
config["DynamicInvokeFunctions"].get(DynamicInvokeFunctions);
config["VolatileClasses"].get(VolatileClasses);
// build map from function names to sections
for (Hdf hdf = config["FunctionSections"].firstChild(); hdf.exists();
hdf = hdf.next()) {
for (Hdf hdfFunc = hdf.firstChild(); hdfFunc.exists();
hdfFunc = hdfFunc.next()) {
FunctionSections[hdfFunc.getString()] = hdf.getName();
}
}
ScalarArrayFileCount = config["ScalarArrayFileCount"].getByte(1);
//.........这里部分代码省略.........