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


C++ Hdf::write方法代码示例

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


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

示例1: recordInput

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

示例2: recordInput

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

  Hdf hdf;

  char buf[32];
  snprintf(buf, sizeof(buf), "%u", Process::GetProcessId());
  hdf["pid"] = std::string(buf);
#ifdef _MSC_VER
  snprintf(buf, sizeof(buf), "%" PRIx64,
    (int64_t)pthread_getw32threadid_np(Process::GetThreadId()));
#else
  snprintf(buf, sizeof(buf), "%" PRIx64, (int64_t)Process::GetThreadId());
#endif
  hdf["tid"] = std::string(buf);
  snprintf(buf, sizeof(buf), "%u", Process::GetThreadPid());
  hdf["tpid"] = std::string(buf);

  hdf["cmd"] = static_cast<int>(transport->getMethod());
  hdf["url"] = transport->getUrl();
  hdf["remote_host"] = transport->getRemoteHost();
  hdf["remote_port"] = transport->getRemotePort();

  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) {
    String encoded = string_uuencode((const char *)data, size);
    hdf["post"] = encoded.get()->data();
  } else {
    hdf["post"] = "";
  }

  hdf.write(filename);
}
开发者ID:Orvid,项目名称:hhvm,代码行数:45,代码来源:replay-transport.cpp

示例3: recordInput

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

  Hdf hdf;

  char buf[32];
  snprintf(buf, sizeof(buf), "%u", Process::GetProcessId());
  hdf["pid"] = string(buf);
  snprintf(buf, sizeof(buf), "%llx", (int64)Process::GetThreadId());
  hdf["tid"] = string(buf);
  snprintf(buf, sizeof(buf), "%u", Process::GetThreadPid());
  hdf["tpid"] = string(buf);

  hdf["cmd"] = transport->getMethod();
  hdf["url"] = transport->getUrl();
  hdf["remote_host"] = transport->getRemoteHost();
  hdf["remote_port"] = transport->getRemotePort();

  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:DenisBazhan,项目名称:hiphop-php,代码行数:42,代码来源:replay_transport.cpp


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