本文整理汇总了C++中AsArray函数的典型用法代码示例。如果您正苦于以下问题:C++ AsArray函数的具体用法?C++ AsArray怎么用?C++ AsArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AsArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AsArray
bool
nsSmallVoidArray::SizeTo(int32_t aMin)
{
if (!HasSingle()) {
return AsArray()->SizeTo(aMin);
}
if (aMin <= 0) {
mImpl = nullptr;
return true;
}
if (aMin == 1) {
return true;
}
void* single = GetSingle();
mImpl = nullptr;
if (!AsArray()->SizeTo(aMin)) {
SetSingle(single);
return false;
}
AsArray()->AppendElement(single);
return true;
}
示例2: AsArray
PRBool
nsSmallVoidArray::SizeTo(PRInt32 aMin)
{
if (!HasSingle()) {
return AsArray()->SizeTo(aMin);
}
if (aMin <= 0) {
mImpl = nsnull;
return PR_TRUE;
}
if (aMin == 1) {
return PR_TRUE;
}
void* single = GetSingle();
mImpl = nsnull;
if (!AsArray()->SizeTo(aMin)) {
SetSingle(single);
return PR_FALSE;
}
AsArray()->AppendElement(single);
return PR_TRUE;
}
示例3: Push
CP CLispEng::CopyVector(CP p) {
Push(p);
CArrayValue *oav = AsArray(p);
size_t size = oav->DataLength;
CArrayValue *av = CreateVector(size, oav->GetElementType());
oav = AsArray(Pop());
memcpy(av->m_pData, oav->m_pData, oav->GetByteLength());
return FromSValue(av);
}
示例4: GetDirect
FX_BOOL CPDF_Object::IsIdentical(CPDF_Object* pOther) const {
if (this == pOther)
return TRUE;
if (!pOther)
return FALSE;
if (pOther->m_Type != m_Type) {
if (IsReference() && GetDirect())
return GetDirect()->IsIdentical(pOther);
if (pOther->IsReference())
return IsIdentical(pOther->GetDirect());
return FALSE;
}
switch (m_Type) {
case PDFOBJ_BOOLEAN:
return AsBoolean()->Identical(pOther->AsBoolean());
case PDFOBJ_NUMBER:
return AsNumber()->Identical(pOther->AsNumber());
case PDFOBJ_STRING:
return AsString()->Identical(pOther->AsString());
case PDFOBJ_NAME:
return AsName()->Identical(pOther->AsName());
case PDFOBJ_ARRAY:
return AsArray()->Identical(pOther->AsArray());
case PDFOBJ_DICTIONARY:
return AsDictionary()->Identical(pOther->AsDictionary());
case PDFOBJ_NULL:
return TRUE;
case PDFOBJ_STREAM:
return AsStream()->Identical(pOther->AsStream());
case PDFOBJ_REFERENCE:
return AsReference()->Identical(pOther->AsReference());
}
return FALSE;
}
示例5: AsArray
CArrayValue *CLispEng::ToVector(CP p) {
if (Type(p) == TS_ARRAY) {
CArrayValue *av = AsArray(p);
if (Type(av->m_dims) == TS_FIXNUM)
return av;
}
E_TypeErr(p, S(L_VECTOR));
}
示例6: return
PRBool
nsSmallVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
{
if (HasSingle()) {
return (*aFunc)(GetSingle(), aData);
}
return AsArray()->EnumerateBackwards(aFunc,aData);
}
示例7: Find
inline std::vector<std::string> Object::Get<std::vector<std::string>>(const std::string &key) const
{
auto value = Find(key);
std::vector<std::string> result;
for(auto &entry : value->AsArray())
result.push_back(entry->AsString());
return result;
}
示例8: ToCClosure
CClosure *CLispEng::CopyClosure(CP oldClos) {
CClosure *oc = ToCClosure(oldClos);
size_t len = AsArray(oldClos)->DataLength;
CClosure *nc = CreateClosure(len);
nc->NameOrClassVersion = oc->NameOrClassVersion;
nc->CodeVec = oc->CodeVec;
memcpy(nc->Consts, oc->Consts, len*sizeof(CP));
return nc;
}
示例9: GetSingle
PRInt32
nsSmallVoidArray::IndexOf(void* aPossibleElement) const
{
if (HasSingle()) {
return aPossibleElement == GetSingle() ? 0 : -1;
}
return AsArray()->IndexOf(aPossibleElement);
}
示例10: switch
bool CLispEng::StringP(CP p) {
if (!VectorP(p))
return false;
switch (AsArray(p)->GetElementType()) {
case ELTYPE_CHARACTER:
case ELTYPE_BASECHAR:
return true;
}
return false;
}
示例11: NS_ASSERTION
void*
nsSmallVoidArray::FastElementAt(PRInt32 aIndex) const
{
NS_ASSERTION(0 <= aIndex && aIndex < Count(), "nsSmallVoidArray::FastElementAt: index out of range");
if (HasSingle()) {
return GetSingle();
}
return AsArray()->FastElementAt(aIndex);
}
示例12: AsArray
bool
nsSmallVoidArray::RemoveElementAt(PRInt32 aIndex)
{
if (HasSingle()) {
if (aIndex == 0) {
mImpl = nsnull;
return true;
}
return false;
}
return AsArray()->RemoveElementAt(aIndex);
}
示例13: GetSingle
bool
nsSmallVoidArray::EnsureArray()
{
if (!HasSingle()) {
return true;
}
void* single = GetSingle();
mImpl = nullptr;
if (!AsArray()->AppendElement(single)) {
SetSingle(single);
return false;
}
return true;
}
示例14: NS_ASSERTION
bool
nsSmallVoidArray::InsertElementAt(void* aElement, int32_t aIndex)
{
NS_ASSERTION(!(NS_PTR_TO_INT32(aElement) & 0x1),
"Attempt to add element with 0x1 bit set to nsSmallVoidArray");
if (aIndex == 0 && IsEmpty()) {
SetSingle(aElement);
return true;
}
if (!EnsureArray()) {
return false;
}
return AsArray()->InsertElementAt(aElement, aIndex);
}
示例15: switch
nsSmallVoidArray&
nsSmallVoidArray::operator=(nsSmallVoidArray& other)
{
PRInt32 count = other.Count();
switch (count) {
case 0:
Clear();
break;
case 1:
Clear();
AppendElement(other.ElementAt(0));
break;
default:
if (GetArraySize() >= count || SizeTo(count)) {
*AsArray() = *other.AsArray();
}
}
return *this;
}