本文整理汇总了C++中ZendArray::add方法的典型用法代码示例。如果您正苦于以下问题:C++ ZendArray::add方法的具体用法?C++ ZendArray::add怎么用?C++ ZendArray::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZendArray
的用法示例。
在下文中一共展示了ZendArray::add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
ArrayData *VectorArray::add(int64 k, CVarRef v, bool copy) {
assert(!exists(k));
if (k == m_size) return VectorArray::append(v, copy);
ZendArray *a = escalateToZendArray();
a->add(k, v, false);
return a;
}
示例2: ASSERT
ArrayData *VectorArray::add(CVarRef k, CVarRef v, bool copy) {
ASSERT(!exists(k));
Variant::TypedValueAccessor tva = k.getTypedAccessor();
if (isIntKey(tva)) return VectorArray::add(getIntKey(tva), v, copy);
ASSERT(k.isString());
ZendArray *a = escalateToZendArray();
a->add(StrNR(getStringKey(tva)), v, false);
return a;
}
示例3: set
HOT_FUNC_HPHP
ArrayData *VectorArray::set(CVarRef k, CVarRef v, bool copy) {
Variant::TypedValueAccessor tva = k.getTypedAccessor();
if (isIntKey(tva)) {
return VectorArray::set(getIntKey(tva), v, copy);
}
ASSERT(k.isString());
ZendArray *a = escalateToZendArray();
a->add(StrNR(getStringKey(tva)), v, false);
return a;
}
示例4: NEW
HOT_FUNC_HPHP
ArrayData *VectorArray::set(int64 k, CVarRef v, bool copy) {
if (inRange(k, m_size)) {
if (copy) {
VectorArray *a = NEW(VectorArray)(this);
tvAsVariant(&a->m_elems[k]).assignVal(v);
return a;
}
tvAsVariant(&m_elems[k]).assignVal(v);
return nullptr;
}
if (k == m_size) return VectorArray::append(v, copy);
ZendArray *a = escalateToZendArray();
a->add(k, v, false);
return a;
}
示例5: ASSERT
HOT_FUNC_HPHP
ArrayData *ZendArray::add(CStrRef k, CVarRef v, bool copy) {
ASSERT(!exists(k));
if (UNLIKELY(copy)) {
ZendArray *result = copyImpl();
result->add(k, v, false);
return result;
}
int64 h = k->hash();
Bucket *p = NEW(Bucket)(v);
p->setStrKey(k.get(), h);
uint nIndex = (h & m_nTableMask);
CONNECT_TO_BUCKET_LIST(p, m_arBuckets[nIndex]);
SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p);
CONNECT_TO_GLOBAL_DLLIST(p);
if (++m_size > tableSize()) {
resize();
}
return NULL;
}
示例6: ASSERT
ArrayData *ZendArray::add(CStrRef k, CVarRef v, bool copy) {
ASSERT(!exists(k));
if (UNLIKELY(copy)) {
ZendArray *result = copyImpl();
result->add(k, v, false);
return result;
}
int64 h = k->hash();
Bucket *p = NEW(Bucket)(v);
p->key = k.get();
p->key->incRefCount();
p->h = h;
uint nIndex = (h & m_nTableMask);
CONNECT_TO_BUCKET_LIST(p, m_arBuckets[nIndex]);
SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p);
CONNECT_TO_GLOBAL_DLLIST(p);
if (++m_nNumOfElements > m_nTableSize) {
resize();
}
return NULL;
}
示例7: escalateToZendArray
ArrayData *VectorArray::add(StringData* k, CVarRef v, bool copy) {
ZendArray *a = escalateToZendArray();
a->add(k, v, false);
return a;
}
示例8: escalateToZendArray
HOT_FUNC_HPHP
ArrayData *VectorArray::set(CStrRef k, CVarRef v, bool copy) {
ZendArray *a = escalateToZendArray();
a->add(k, v, false);
return a;
}