當前位置: 首頁>>代碼示例>>C++>>正文


C++ AsArray函數代碼示例

本文整理匯總了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;
}
開發者ID:hibrium,項目名稱:Pale-Moon,代碼行數:29,代碼來源:nsVoidArray.cpp

示例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;
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:29,代碼來源:nsVoidArray.cpp

示例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);
}
開發者ID:ufasoft,項目名稱:lisp,代碼行數:9,代碼來源:svalue.cpp

示例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;
}
開發者ID:primiano,項目名稱:pdfium-merge,代碼行數:34,代碼來源:fpdf_parser_objects.cpp

示例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));
}
開發者ID:ufasoft,項目名稱:lisp,代碼行數:8,代碼來源:svalue.cpp

示例6: return

PRBool
nsSmallVoidArray::EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData)
{
  if (HasSingle()) {
    return (*aFunc)(GetSingle(), aData);
  }
  return AsArray()->EnumerateBackwards(aFunc,aData);
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:8,代碼來源:nsVoidArray.cpp

示例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;
}
開發者ID:jbruce2112,項目名稱:cpp-client-library,代碼行數:8,代碼來源:Object.hpp

示例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;
}
開發者ID:ufasoft,項目名稱:lisp,代碼行數:9,代碼來源:svalue.cpp

示例9: GetSingle

PRInt32
nsSmallVoidArray::IndexOf(void* aPossibleElement) const
{
  if (HasSingle()) {
    return aPossibleElement == GetSingle() ? 0 : -1;
  }

  return AsArray()->IndexOf(aPossibleElement);
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:9,代碼來源:nsVoidArray.cpp

示例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;
}
開發者ID:ufasoft,項目名稱:lisp,代碼行數:10,代碼來源:svalue.cpp

示例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);
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:11,代碼來源:nsVoidArray.cpp

示例12: AsArray

bool
nsSmallVoidArray::RemoveElementAt(PRInt32 aIndex)
{
  if (HasSingle()) {
    if (aIndex == 0) {
      mImpl = nsnull;

      return true;
    }
    
    return false;
  }

  return AsArray()->RemoveElementAt(aIndex);
}
開發者ID:lofter2011,項目名稱:Icefox,代碼行數:15,代碼來源:nsVoidArray.cpp

示例13: GetSingle

bool
nsSmallVoidArray::EnsureArray()
{
  if (!HasSingle()) {
    return true;
  }

  void* single = GetSingle();
  mImpl = nullptr;
  if (!AsArray()->AppendElement(single)) {
    SetSingle(single);

    return false;
  }

  return true;
}
開發者ID:hibrium,項目名稱:Pale-Moon,代碼行數:17,代碼來源:nsVoidArray.cpp

示例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);
}
開發者ID:hibrium,項目名稱:Pale-Moon,代碼行數:18,代碼來源:nsVoidArray.cpp

示例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;
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:20,代碼來源:nsVoidArray.cpp


注:本文中的AsArray函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。