当前位置: 首页>>代码示例>>C++>>正文


C++ Hdf类代码示例

本文整理汇总了C++中Hdf的典型用法代码示例。如果您正苦于以下问题:C++ Hdf类的具体用法?C++ Hdf怎么用?C++ Hdf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hdf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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,""));
    }
  }
}
开发者ID:Jasonudoo,项目名称:hhvm,代码行数:7,代码来源:option.cpp

示例2: TestCollectionHdf

bool TestCppBase::TestCollectionHdf() {
  IniSetting::Map ini = IniSetting::Map::object;
  Hdf hdf;
  hdf.fromString(
    "  Server {\n"
    "    AllowedDirectories.* = /var/www\n"
    "    AllowedDirectories.* = /usr/bin\n"
    "    HighPriorityEndPoints.* = /end\n"
    "    HighPriorityEndPoints.* = /point\n"
    "    HighPriorityEndPoints.* = /power\n"
    "  }\n"
  );
  RuntimeOption::AllowedDirectories.clear();

  Config::Bind(RuntimeOption::AllowedDirectories, ini,
               hdf, "Server.AllowedDirectories");
  VERIFY(RuntimeOption::AllowedDirectories.size() == 2);
  std::vector<std::string> ad =
    Config::GetVector(ini, hdf, "Server.AllowedDirectories",
                      RuntimeOption::AllowedDirectories);
  VERIFY(RuntimeOption::AllowedDirectories.size() == 2);
  VERIFY(ad.size() == 2);
  Config::Bind(RuntimeOption::ServerHighPriorityEndPoints, ini,
               hdf, "Server.HighPriorityEndPoints");
  VERIFY(RuntimeOption::ServerHighPriorityEndPoints.size() == 3);
  return Count(true);
}
开发者ID:mahanhaz,项目名称:hhvm,代码行数:27,代码来源:test_cpp_base.cpp

示例3: ASSERT

void ReplayTransport::recordInput(Transport* transport, const char *filename) {
  ASSERT(transport);

  Hdf hdf;
  hdf["thread"] = (int64)pthread_self();
  hdf["get"] = (transport->getMethod() == GET);
  hdf["url"] = transport->getUrl();
  hdf["remote_host"] = transport->getRemoteHost();

  transport->getHeaders(m_requestHeaders);
  int index = 0;
  for (HeaderMap::const_iterator iter = m_requestHeaders.begin();
       iter != m_requestHeaders.end(); ++iter) {
    for (unsigned int i = 0; i < iter->second.size(); i++) {
      Hdf header = hdf["headers"][index++];
      header["name"] = iter->first;
      header["value"] = iter->second[i];
    }
  }

  int size;
  const void *data = transport->getPostData(size);
  if (size) {
    int len;
    char *encoded = string_uuencode((const char *)data, size, len);
    hdf["post"] = encoded;
    free(encoded);
  } else {
    hdf["post"] = "";
  }

  hdf.write(filename);
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:33,代码来源:replay_transport.cpp

示例4: 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();
    }
  }
}
开发者ID:HendrikGrunstra,项目名称:hiphop-php,代码行数:7,代码来源:option.cpp

示例5: 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;
}
开发者ID:292388900,项目名称:hhvm,代码行数:33,代码来源:hdf.cpp

示例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("");
  }
}
开发者ID:292388900,项目名称:hhvm,代码行数:7,代码来源:hdf.cpp

示例7: string

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(""));
  }
}
开发者ID:HendrikGrunstra,项目名称:hiphop-php,代码行数:9,代码来源:replay_transport.cpp

示例8: 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;
  }
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:10,代码来源:ip_block_map.cpp

示例9: TestSatelliteServer

bool TestCppBase::TestSatelliteServer() {
  IniSetting::Map ini = IniSetting::Map::object;
  Hdf hdf;
  hdf.fromString(
    "Satellites {\n"
    "  rpc {\n"
    "    Type = RPCServer\n"
    "    Port = 9999\n"
    "    RequestInitDocument = my/rpc/rpc.php\n"
    "    RequestInitFunction = init_me\n"
    "    Password = abcd0987\n"
    "    Passwords {\n"
    "      * = abcd0987\n"
    "    }\n"
    "  }\n"
    "  ips {\n"
    "    Type = InternalPageServer\n"
    "    BlockMainServer = false\n"
    "  }\n"
    "}\n"
  );


  std::vector<std::shared_ptr<SatelliteServerInfo>> infos;
  RuntimeOption::ReadSatelliteInfo(ini, hdf, infos,
                                   RuntimeOption::XboxPassword,
                                   RuntimeOption::XboxPasswords);
  for (auto& info_ptr : infos) {
    auto info = info_ptr.get();
    auto name = info->getName();
    if (name == "rpc") {
      VERIFY(info->getType() == SatelliteServer::Type::KindOfRPCServer);
      VERIFY(info->getPort() == 9999);
      VERIFY(info->getThreadCount() == 5);
      VERIFY(info->getTimeoutSeconds() ==
        std::chrono::seconds(RuntimeOption::RequestTimeoutSeconds));
      VERIFY(info->getURLs().size() == 0);
      VERIFY(info->getMaxRequest() == 500);
      VERIFY(info->getMaxDuration() == 120);
      VERIFY(info->getReqInitFunc() == "init_me");
      VERIFY(info->getReqInitDoc() == "my/rpc/rpc.php");
      VERIFY(info->getPassword() == "abcd0987");
      VERIFY(info->getPasswords().size() == 1);
      VERIFY(info->getPasswords().find("abcd0987") !=
             info->getPasswords().end());
      VERIFY(info->alwaysReset() == false);
      VERIFY(RuntimeOption::XboxPassword == "abcd0987");
    } else if (name == "ips") {
      VERIFY(info->getType() ==
             SatelliteServer::Type::KindOfInternalPageServer);
      VERIFY(info->getURLs().size() == 0);
    }
  }
  return Count(true);
}
开发者ID:mahanhaz,项目名称:hhvm,代码行数:55,代码来源:test_cpp_base.cpp

示例10: 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);
    }
  }
}
开发者ID:nurulimamnotes,项目名称:hhvm,代码行数:11,代码来源:option.cpp

示例11: if

SatelliteServerInfo::SatelliteServerInfo(Hdf hdf) {
  m_name = hdf.getName();
  m_port = hdf["Port"].getUInt16(0);
  m_threadCount = hdf["ThreadCount"].getInt32(5);
  m_maxRequest = hdf["MaxRequest"].getInt32(500);
  m_maxDuration = hdf["MaxDuration"].getInt32(120);
  m_timeoutSeconds = std::chrono::seconds
    (hdf["TimeoutSeconds"].getInt32(RuntimeOption::RequestTimeoutSeconds));
  m_reqInitFunc = hdf["RequestInitFunction"].getString("");
  m_reqInitDoc = hdf["RequestInitDocument"].getString("");
  m_password = hdf["Password"].getString("");
  hdf["Passwords"].get(m_passwords);
  m_alwaysReset = hdf["AlwaysReset"].getBool(false);

  std::string type = hdf["Type"].getString();
  if (type == "InternalPageServer") {
    m_type = SatelliteServer::Type::KindOfInternalPageServer;
    std::vector<std::string> urls;
    hdf["URLs"].get(urls);
    for (unsigned int i = 0; i < urls.size(); i++) {
      m_urls.insert(format_pattern(urls[i], true));
    }
    if (hdf["BlockMainServer"].getBool(true)) {
      InternalURLs.insert(m_urls.begin(), m_urls.end());
    }
  } else if (type == "DanglingPageServer") {
    m_type = SatelliteServer::Type::KindOfDanglingPageServer;
    DanglingServerPort = m_port;
  } else if (type == "RPCServer") {
    m_type = SatelliteServer::Type::KindOfRPCServer;
  } else {
    m_type = SatelliteServer::Type::Unknown;
  }
}
开发者ID:2bj,项目名称:hhvm,代码行数:34,代码来源:satellite-server.cpp

示例12: 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);
}
开发者ID:292388900,项目名称:hhvm,代码行数:16,代码来源:hdf.cpp

示例13: 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);
  }
}
开发者ID:360buyliulei,项目名称:hiphop-php,代码行数:47,代码来源:extension.cpp

示例14: 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);
        }
      }
    }
  }
开发者ID:atdt,项目名称:hhvm,代码行数:18,代码来源:config.cpp

示例15: assert

// 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());
      }
    }
  }
}
开发者ID:stone54321277,项目名称:hhvm,代码行数:28,代码来源:config.cpp


注:本文中的Hdf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。