本文整理汇总了C++中CArrRef::get方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrRef::get方法的具体用法?C++ CArrRef::get怎么用?C++ CArrRef::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrRef
的用法示例。
在下文中一共展示了CArrRef::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: same
bool Array::same(CArrRef v2) const {
if (m_px == NULL && v2.get() == NULL) return true;
if (m_px && v2.get()) {
return m_px->equal(v2.get(), true);
}
return false;
}
示例2: less
bool Array::less(CArrRef v2, bool flip /* = false */) const {
if (m_px == NULL || v2.get() == NULL) {
return HPHP::less(toBoolean(), v2.toBoolean());
}
if (flip) {
return v2.get()->compare(m_px, false) > 0;
}
return m_px->compare(v2.get(), false) < 0;
}
示例3: more
bool Array::more(CArrRef v2, bool flip /* = true */) const {
if (m_px == NULL || v2.get() == NULL) {
return HPHP::more(toBoolean(), v2.toBoolean());
}
if (flip) {
return v2.get()->compare(m_px) < 0;
}
return m_px->compare(v2.get()) > 0;
}
示例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());
}
}
}
}
示例5: begin
void ArrayIter::begin(CArrRef map, CStrRef context) {
try {
new (this) ArrayIter(map.get());
} catch (...) {
m_data = NULL;
throw;
}
}
示例6: ak_exist_int_obj
HOT_FUNC_VM
int64_t ak_exist_int_obj(ObjectData* obj, int64_t key) {
if (obj->isCollection()) {
return collectionOffsetContains(obj, key);
}
CArrRef arr = obj->o_toArray();
bool res = arr.get()->exists(key);
return res;
}
示例7: ak_exist_string_obj
HOT_FUNC_VM
int64_t ak_exist_string_obj(ObjectData* obj, StringData* key) {
if (obj->isCollection()) {
return collectionOffsetContains(obj, key);
}
CArrRef arr = obj->o_toArray();
int64_t res = ak_exist_string_impl(arr.get(), key);
return res;
}
示例8: 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);
}
}
示例9: setArrayData
HOT_FUNC
ArrayIter::ArrayIter(CArrRef array) : m_pos(0) {
const ArrayData* ad = array.get();
setArrayData(ad);
if (ad) {
ad->incRefCount();
m_pos = ad->iter_begin();
} else {
m_pos = ArrayData::invalid_index;
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: equal
bool Array::equal(CArrRef v2) const {
if (m_px == NULL || v2.get() == NULL) {
return HPHP::equal(toBoolean(), v2.toBoolean());
}
return m_px->equal(v2.get(), false);
}
示例13: less
bool String::less(CArrRef v2) const {
if (m_px == NULL || v2.get() == NULL) {
return HPHP::less(toBoolean(), v2.toBoolean());
}
return true;
}
示例14: check_renamed_functions
void check_renamed_functions(CArrRef names) {
g_vmContext->addRenameableFunctions(names.get());
}
示例15: create
ArrayIter::ArrayIter(CArrRef array)
: m_data(array.get()), m_pos(0) {
create();
}