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


C++ VRefParam::toString方法代码示例

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


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

示例1: f_settype

bool f_settype(VRefParam var, CStrRef type) {
  if      (type == "boolean") var = var.toBoolean();
  else if (type == "bool"   ) var = var.toBoolean();
  else if (type == "integer") var = var.toInt64();
  else if (type == "int"    ) var = var.toInt64();
  else if (type == "float"  ) var = var.toDouble();
  else if (type == "string" ) var = var.toString();
  else if (type == "array"  ) var = var.toArray();
  else if (type == "object" ) var = var.toObject();
  else if (type == "null"   ) var = null;
  else return false;
  return true;
}
开发者ID:devmario,项目名称:hiphop-php,代码行数:13,代码来源:ext_variable.cpp

示例2: f_settype

bool f_settype(VRefParam var, CStrRef type) {
  if      (type == s_boolean) var = var.toBoolean();
  else if (type == s_bool   ) var = var.toBoolean();
  else if (type == s_integer) var = var.toInt64();
  else if (type == s_int    ) var = var.toInt64();
  else if (type == s_float  ) var = var.toDouble();
  else if (type == s_string ) var = var.toString();
  else if (type == s_array  ) var = var.toArray();
  else if (type == s_object ) var = var.toObject();
  else if (type == s_null   ) var = uninit_null();
  else return false;
  return true;
}
开发者ID:Halfnhav,项目名称:hiphop-php,代码行数:13,代码来源:ext_variable.cpp

示例3: HHVM_FUNCTION

bool HHVM_FUNCTION(settype, VRefParam var, const String& type) {
  if      (type == s_boolean) var = var.toBoolean();
  else if (type == s_bool   ) var = var.toBoolean();
  else if (type == s_integer) var = var.toInt64();
  else if (type == s_int    ) var = var.toInt64();
  else if (type == s_float  ) var = var.toDouble();
  else if (type == s_string ) var = var.toString();
  else if (type == s_array  ) var = var.toArray();
  else if (type == s_object ) var = var.toObject();
  else if (type == s_null   ) var = uninit_null();
  else return false;
  return true;
}
开发者ID:vlajos,项目名称:hhvm,代码行数:13,代码来源:ext_std_variable.cpp

示例4: f_socket_recvfrom

Variant f_socket_recvfrom(CObjRef socket, VRefParam buf, int len, int flags,
                      VRefParam name, VRefParam port /* = 0 */) {
  if (len <= 0) {
    return false;
  }

  Socket *sock = socket.getTyped<Socket>();

  char *recv_buf = (char *)malloc(len + 2);
  socklen_t slen;
  int retval;

  switch (sock->getType()) {
  case AF_UNIX:
    {
      struct sockaddr_un s_un;
      slen = sizeof(s_un);
      memset(&s_un, 0, slen);
      s_un.sun_family = AF_UNIX;
      retval = recvfrom(sock->fd(), recv_buf, len, flags,
                        (struct sockaddr *)&s_un, (socklen_t *)&slen);
      if (retval < 0) {
        free(recv_buf);
        SOCKET_ERROR(sock, "unable to recvfrom", errno);
        return false;
      }

      recv_buf[retval] = 0;
      buf = String(recv_buf, retval, AttachString);
      name = String(s_un.sun_path, CopyString);
    }
    break;
  case AF_INET:
    {
      struct sockaddr_in sin;
      slen = sizeof(sin);
      memset(&sin, 0, slen);
      sin.sin_family = AF_INET;

      retval = recvfrom(sock->fd(), recv_buf, len, flags,
                        (struct sockaddr *)&sin, (socklen_t *)&slen);
      if (retval < 0) {
        free(recv_buf);
        SOCKET_ERROR(sock, "unable to recvfrom", errno);
        return false;
      }
      recv_buf[retval] = 0;
      buf = String(recv_buf, retval, AttachString);

      name = String(Util::safe_inet_ntoa(sin.sin_addr));
      if (name.toString().empty()) {
        name = s_0_0_0_0;
      }
      port = ntohs(sin.sin_port);
    }
    break;
  case AF_INET6:
    {
      struct sockaddr_in6 sin6;
      slen = sizeof(sin6);
      memset(&sin6, 0, slen);
      sin6.sin6_family = AF_INET6;

      retval = recvfrom(sock->fd(), recv_buf, len, flags,
                        (struct sockaddr *)&sin6, (socklen_t *)&slen);
      if (retval < 0) {
        free(recv_buf);
        SOCKET_ERROR(sock, "unable to recvfrom", errno);
        return false;
      }

      char addr6[INET6_ADDRSTRLEN];
      const char* succ =
        inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN);

      recv_buf[retval] = 0;
      buf = String(recv_buf, retval, AttachString);
      if (succ) {
        name = String(addr6, CopyString);
      } else {
        name = s_2colons;
      }
      port = ntohs(sin6.sin6_port);
    }
    break;
  default:
    raise_warning("Unsupported socket type %d", sock->getType());
    return false;
  }

  return retval;
}
开发者ID:hakanertug,项目名称:hiphop-php,代码行数:92,代码来源:ext_socket.cpp


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