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


C++ CArrRef类代码示例

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


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

示例1: more

bool Array::more(CArrRef v2, bool flip /* = true */) const {
  if (m_px == nullptr || v2.get() == nullptr) {
    return HPHP::more(toBoolean(), v2.toBoolean());
  }
  if (flip) {
    return v2.get()->compare(m_px) < 0;
  }
  return m_px->compare(v2.get()) > 0;
}
开发者ID:jobin-sun,项目名称:hiphop-php,代码行数:9,代码来源:type_array.cpp

示例2: f_print_arr

/* SRC: ../../util/helper.php line 3 */
void f_print_arr(CVarRef v_the_arr) {
    FUNCTION_INJECTION(print_arr);
    INTERCEPT_INJECTION("print_arr", (Array(ArrayInit(1, true).set(0, v_the_arr).create())), r);
    String v_to_print;
    Variant v_element;

    v_to_print = NAMSTR(s_ss00000000, "");
    {
        LOOP_COUNTER(1);
        for (ArrayIterPtr iter3 = v_the_arr.begin(null_string, true); !iter3->end(); iter3->next()) {
            LOOP_COUNTER_CHECK(1);
            iter3->second(v_element);
            {
                v_to_print = concat3(v_to_print, toString(v_element), NAMSTR(s_ss00000000_1, " "));
            }
        }
    }
    v_to_print = concat(v_to_print, NAMSTR(s_ss66d2232c, "\n"));
    print(v_to_print);
} /* function */
Variant i_print_arr(void *extra, CArrRef params) {
    int count __attribute__((__unused__)) = params.size();
    if (count < 1) throw_missing_arguments("print_arr", count+1);
    {
        ArrayData *ad(params.get());
        ssize_t pos = ad ? ad->iter_begin() : ArrayData::invalid_index;
        CVarRef arg0(count <= 0 ? null_variant : (ad->getValue(pos)));
        return (f_print_arr(arg0), null);
    }
}
开发者ID:mjacobsz,项目名称:Scriptie,代码行数:31,代码来源:helper.cpp

示例3: InvokeImpl

Variant EvalFunctionExists::InvokeImpl(VariableEnvironment &env,
                                       CArrRef params) {

  if (params.size() != 1) {
    return invalid_function_call("function_exists");
  }
  String fn = params.rvalAt(0).toString();
  if (s_blacklist.find(fn.data()) != s_blacklist.end()) return false;
  return f_function_exists(fn);
}
开发者ID:ckwalsh,项目名称:hiphop-php,代码行数:10,代码来源:ext.cpp

示例4: url_encode_array

static void url_encode_array(StringBuffer &ret, CArrRef arr,
                             std::set<void*> &seen_arrs,
                             CStrRef num_prefix, CStrRef key_prefix,
                             CStrRef key_suffix, CStrRef arg_sep) {
  if (seen_arrs.find((void*)arr.get()) != seen_arrs.end()) {
    return; // recursive
  }
  seen_arrs.insert((void*)arr.get());

  for (ArrayIter iter(arr); iter; ++iter) {
    Variant data = iter.second();
    if (data.isNull() || data.isResource()) continue;

    String key = iter.first();
    bool numeric = key.isNumeric();

    if (data.is(KindOfArray) || data.is(KindOfObject)) {
      String encoded;
      if (numeric) {
        encoded = key;
      } else {
        encoded = StringUtil::UrlEncode(key);
      }
      StringBuffer new_prefix(key_prefix.size() + num_prefix.size() +
                              encoded.size() + key_suffix.size() + 4);
      new_prefix += key_prefix;
      if (numeric) new_prefix += num_prefix;
      new_prefix += encoded;
      new_prefix += key_suffix;
      new_prefix += "%5B";
      url_encode_array(ret, data.toArray(), seen_arrs, String(), new_prefix,
                       String("%5D", AttachLiteral), arg_sep);
    } else {
      if (!ret.empty()) {
        ret += arg_sep;
      }
      ret += key_prefix;
      if (numeric) {
        ret += num_prefix;
        ret += key;
      } else {
        ret += StringUtil::UrlEncode(key);
      }
      ret += key_suffix;
      ret += "=";
      if (data.isInteger() || data.is(KindOfBoolean)) {
        ret += String(data.toInt64());
      } else if (data.is(KindOfDouble)) {
        ret += String(data.toDouble());
      } else {
        ret += StringUtil::UrlEncode(data.toString());
      }
    }
  }
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:55,代码来源:ext_url.cpp

示例5: InvokeImpl

Variant EvalExtract::InvokeImpl(VariableEnvironment &env,
                                CArrRef params) {
  int size = params.size();
  switch (size) {
  case 1: return extract(&env,params.rvalAt(0));
  case 2: return extract(&env,params.rvalAt(0), params.rvalAt(1));
  case 3: return extract(&env,params.rvalAt(0), params.rvalAt(1),
                         params.rvalAt(2));
  default: throw InvalidFunctionCallException("extract");
  }
}
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:11,代码来源:ext.cpp

示例6: Invoke

Variant EvalInterfaceExists::Invoke(CArrRef params) {
  String cname = params.rvalAt(0);
  if (!f_interface_exists(cname, false)) {
    if ((params.size() == 1 || params.rvalAt(1).toBoolean()) &&
        !f_class_exists(cname, false) &&
        eval_try_autoload(cname.data())) {
      return f_interface_exists(cname, false);
    }
    return false;
  }
  return true;
}
开发者ID:dipjyotighosh,项目名称:hiphop-php,代码行数:12,代码来源:ext.cpp

示例7: Combine

Array ArrayUtil::Combine(CArrRef keys, CArrRef values) {
  if (keys.size() != values.size()) {
    throw InvalidArgumentException("keys and values", "(not same count)");
  }
  if (keys.empty()) {
    throw InvalidArgumentException("keys and values", "(empty)");
  }

  Array ret = Array::Create();
  for (ArrayIter iter1(keys), iter2(values); iter1; ++iter1, ++iter2) {
    ret.set(iter1.second(), iter2.second());
  }
  return ret;
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:14,代码来源:array_util.cpp

示例8: i___construct

Variant c_Directory::i___construct(MethodCallPackage &mcp, CArrRef params) {
  if (UNLIKELY(mcp.obj == 0)) {
    return ObjectData::i_dummy(mcp, params, i___construct, coo_Directory);
  }
  c_Directory *self ATTRIBUTE_UNUSED (static_cast<c_Directory*>(mcp.obj));
  int count ATTRIBUTE_UNUSED = params.size();
  if (UNLIKELY(count != 1)) return throw_wrong_arguments("Directory::__construct", count, 1, 1, 2);
  {
    ArrayData *ad(params.get());
    ssize_t pos = ad ? ad->iter_begin() : ArrayData::invalid_index;
    CVarRef arg0((ad->getValue(pos)));
    return (self->t___construct(arg0), null);
  }
}
开发者ID:canerdogan,项目名称:hiphop-php,代码行数:14,代码来源:directory.cpp

示例9: write

void VariableSerializer::write(CArrRef v) {
  if (m_type == APCSerialize && !v.isNull() && v->isStatic()) {
    union {
      char buf[8];
      ArrayData *ad;
    } u;
    u.ad = v.get();
    m_buf->append("A:");
    m_buf->append(u.buf, 8);
    m_buf->append(';');
  } else {
    v.serialize(this);
  }
}
开发者ID:TitoAgudelo,项目名称:hiphop-php,代码行数:14,代码来源:variable_serializer.cpp

示例10: mergeParams

void StreamContext::mergeParams(CArrRef params) {
  if (m_params.isNull()) {
    m_params = Array::Create();
  }
  const String& notification_key = String::FromCStr("notification");
  if (params.exists(notification_key)) {
    m_params.set(notification_key, params[notification_key]);
  }
  const String& options_key = String::FromCStr("options");
  if (params.exists(options_key)) {
    assert(params[options_key].isArray());
    mergeOptions(params[options_key].toArray());
  }
}
开发者ID:Bluarggag,项目名称:hhvm,代码行数:14,代码来源:ext_stream.cpp

示例11: setObjAttempted

SharedVariant* SharedVariant::convertObj(CVarRef var) {
  if (!var.is(KindOfObject) || getObjAttempted()) {
    return NULL;
  }
  setObjAttempted();
  PointerSet seen;
  ObjectData *obj = var.getObjectData();
  CArrRef arr = obj->o_toArray();
  if (arr->hasInternalReference(seen, true)) {
    return NULL;
  }
  SharedVariant *tmp = new SharedVariant(var, false, true, true);
  tmp->setObjAttempted();
  return tmp;
}
开发者ID:jhockly,项目名称:RED-COLOR-IS-MY-FAVORITE-COLOR,代码行数:15,代码来源:shared_variant.cpp

示例12: f_var_dump

void f_var_dump(int _argc, CVarRef expression,
                CArrRef _argv /* = null_array */) {
  f_var_dump(expression);
  for (int i = 0; i < _argv.size(); i++) {
    f_var_dump(_argv[i]);
  }
}
开发者ID:devmario,项目名称:hiphop-php,代码行数:7,代码来源:ext_variable.cpp

示例13: Pad

Variant ArrayUtil::Pad(CArrRef input, CVarRef pad_value, int pad_size,
                       bool pad_right /* = true */) {
  int input_size = input.size();
  if (input_size >= pad_size) {
    return input;
  }

  Array ret = Array::Create();
  if (pad_right) {
    ret = input;
    for (int i = input_size; i < pad_size; i++) {
      ret.append(pad_value);
    }
  } else {
    for (int i = input_size; i < pad_size; i++) {
      ret.append(pad_value);
    }
    for (ArrayIter iter(input); iter; ++iter) {
      Variant key(iter.first());
      if (key.isNumeric()) {
        ret.appendWithRef(iter.secondRef());
      } else {
        ret.setWithRef(key, iter.secondRef(), true);
      }
    }
  }
  return ret;
}
开发者ID:RdeWilde,项目名称:hhvm,代码行数:28,代码来源:array-util.cpp

示例14: os_invoke

Variant c_stdClass::os_invoke(const char *c, MethodIndex methodIndex, const char *s,  CArrRef params, int64 hash, bool fatal) {
  int count __attribute__((__unused__)) = params.size();
  #ifndef NOFMCGEN
  #else
  #endif
  return c_ObjectData::os_invoke(c, methodIndex, s, params, hash, fatal);
}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:7,代码来源:stdclass.cpp

示例15: binary_deserialize_spec

void binary_deserialize_spec(CObjRef zthis, PHPInputTransport& transport,
                             CArrRef spec) {
  // SET and LIST have 'elem' => array('type', [optional] 'class')
  // MAP has 'val' => array('type', [optiona] 'class')
  while (true) {
    Variant val;

    int8_t ttype = transport.readI8();
    if (ttype == T_STOP) return;
    int16_t fieldno = transport.readI16();
    if (!(val = spec.rvalAt(fieldno)).isNull()) {
      Array fieldspec = val.toArray();
      // pull the field name
      // zend hash tables use the null at the end in the length... so strlen(hash key) + 1.
      String varname = fieldspec.rvalAt(PHPTransport::s_var).toString();

      // and the type
      int8_t expected_ttype = fieldspec.rvalAt(PHPTransport::s_type).toInt64();

      if (ttypes_are_compatible(ttype, expected_ttype)) {
        Variant rv = binary_deserialize(ttype, transport, fieldspec);
        zthis->o_set(varname, rv, zthis->o_getClassName());
      } else {
        skip_element(ttype, transport);
      }
    } else {
      skip_element(ttype, transport);
    }
  }
}
开发者ID:Halfnhav,项目名称:hiphop-php,代码行数:30,代码来源:binary.cpp


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