• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BaseType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: IsPointer

OGLPLUS_LIB_FUNC
std::size_t BlendFileStructField::Size(void) const
{
	bool is_ptr = IsPointer() || IsPointerToFunc();

	if(IsArray())
	{
		std::size_t ec = ElementCount();
		if(is_ptr) return _sdna->_ptr_size * ec;
		else return BaseType().Size() * ec;
	}
	if(is_ptr) return _sdna->_ptr_size;
	return BaseType().Size();
}
开发者ID:GLDRorg,项目名称:oglplus,代码行数:14,代码来源:structure.hpp


示例2: Equals

PRBool
nsAttrValue::Equals(nsIAtom* aValue, nsCaseTreatment aCaseSensitive) const
{
  if (aCaseSensitive != eCaseMatters) {
    // Need a better way to handle this!
    nsAutoString value;
    aValue->ToString(value);
    return Equals(value, aCaseSensitive);
  }
  
  switch (BaseType()) {
    case eStringBase:
    {
      nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
      if (str) {
        nsDependentString dep(static_cast<PRUnichar*>(str->Data()),
                              str->StorageSize()/sizeof(PRUnichar) - 1);
        return aValue->Equals(dep);
      }
      return aValue == nsGkAtoms::_empty;
    }
    case eAtomBase:
    {
      return static_cast<nsIAtom*>(GetPtr()) == aValue;
    }
    default:
      break;
  }

  nsAutoString val;
  ToString(val);
  return aValue->Equals(val);
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:33,代码来源:nsAttrValue.cpp


示例3: switch

void
nsAttrValue::Reset()
{
  switch(BaseType()) {
    case eStringBase:
    {
      nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
      if (str) {
        str->Release();
      }

      break;
    }
    case eOtherBase:
    {
      EnsureEmptyMiscContainer();
      delete GetMiscContainer();

      break;
    }
    case eAtomBase:
    {
      nsIAtom* atom = GetAtomValue();
      NS_RELEASE(atom);

      break;
    }
    case eIntegerBase:
    {
      break;
    }
  }

  mBits = 0;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:35,代码来源:nsAttrValue.cpp


示例4: NS_PRECONDITION

void
nsAttrValue::GetEnumString(nsAString& aResult, PRBool aRealTag) const
{
  NS_PRECONDITION(Type() == eEnum, "wrong type");

  PRUint32 allEnumBits =
    (BaseType() == eIntegerBase) ? static_cast<PRUint32>(GetIntInternal())
                                   : GetMiscContainer()->mEnumValue;
  PRInt16 val = allEnumBits >> NS_ATTRVALUE_ENUMTABLEINDEX_BITS;
  const EnumTable* table = sEnumTableArray->
    ElementAt(allEnumBits & NS_ATTRVALUE_ENUMTABLEINDEX_MASK);

  while (table->tag) {
    if (table->value == val) {
      aResult.AssignASCII(table->tag);
      if (!aRealTag && allEnumBits & NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER) {
        ToUpperCase(aResult);
      }
      return;
    }
    table++;
  }

  NS_NOTREACHED("couldn't find value in EnumTable");
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:25,代码来源:nsAttrValue.cpp


示例5: RecType

void RecType()
{
  /*
    RecType -> RECORD [ '(' BaseType ')' ] [ FieldListSeq ] END
  */

  if ( debugMode) printf( "In RecType\n");
  accept( RECORD_SYM, 159);
  if ( sym == lparen)
  {
    writesym();
    nextsym();
    BaseType();
    accept( rparen, 142);
  }

  if ( sym != END_SYM)
  {
    FieldListSeq();
  }

  accept( END_SYM, 155);

  if ( debugMode) printf( "Out RecType\n");
}
开发者ID:emarteca,项目名称:Compiler,代码行数:25,代码来源:parser.c


示例6: BaseType

OMType* ImplAAFTypeDefRename::renamedType(void) const
{
  // Should be properly implemented
  ImplAAFTypeDef* type = BaseType();

  return type->type();
}
开发者ID:UIKit0,项目名称:aaf,代码行数:7,代码来源:ImplAAFTypeDefRename.cpp


示例7: switch

PRUint32
nsAttrValue::HashValue() const
{
  switch(BaseType()) {
    case eStringBase:
    {
      nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
      if (str) {
        PRUint32 len = str->StorageSize()/sizeof(PRUnichar) - 1;
        return nsCRT::BufferHashCode(static_cast<PRUnichar*>(str->Data()), len);
      }

      return 0;
    }
    case eOtherBase:
    {
      break;
    }
    case eAtomBase:
    case eIntegerBase:
    {
      // mBits and PRUint32 might have different size. This should silence
      // any warnings or compile-errors. This is what the implementation of
      // NS_PTR_TO_INT32 does to take care of the same problem.
      return mBits - 0;
    }
  }

  MiscContainer* cont = GetMiscContainer();
  switch (cont->mType) {
    case eColor:
    {
      return cont->mColor;
    }
    case eCSSStyleRule:
    {
      return NS_PTR_TO_INT32(cont->mCSSStyleRule);
    }
    case eAtomArray:
    {
      PRUint32 retval = 0;
      PRInt32 i, count = cont->mAtomArray->Count();
      for (i = 0; i < count; ++i) {
        retval ^= NS_PTR_TO_INT32(cont->mAtomArray->ObjectAt(i));
      }
      return retval;
    }
#ifdef MOZ_SVG
    case eSVGValue:
    {
      return NS_PTR_TO_INT32(cont->mSVGValue);
    }
#endif
    default:
    {
      NS_NOTREACHED("unknown type stored in MiscContainer");
      return 0;
    }
  }
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:60,代码来源:nsAttrValue.cpp


示例8: NS_PRECONDITION

PRBool
nsAttrValue::GetColorValue(nscolor& aColor) const
{
  NS_PRECONDITION(Type() == eColor || Type() == eString, "wrong type");
  switch (BaseType()) {
    case eString:
    {
      return GetPtr() && NS_ColorNameToRGB(GetStringValue(), &aColor);
    }
    case eOtherBase:
    {
      aColor = GetMiscContainer()->mColor;
      
      break;
    }
    case eIntegerBase:
    {
      aColor = static_cast<nscolor>(GetIntInternal());
      
      break;
    }
    default:
    {
      NS_NOTREACHED("unexpected basetype");
      
      break;
    }
  }

  return PR_TRUE;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:31,代码来源:nsAttrValue.cpp


示例9: sizeof

PRInt64
nsAttrValue::SizeOf() const
{
  PRInt64 size = sizeof(*this);

  switch (BaseType()) {
    case eStringBase:
    {
      // TODO: we might be counting the string size more than once.
      // This should be fixed with bug 677487.
      nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
      size += str ? str->StorageSize() : 0;
      break;
    }
    case eOtherBase:
    {
      MiscContainer* container = GetMiscContainer();

      if (!container) {
        break;
      }

      size += sizeof(*container);

      void* otherPtr = MISC_STR_PTR(container);
      // We only count the size of the object pointed by otherPtr if it's a
      // string. When it's an atom, it's counted separatly.
      if (otherPtr &&
          static_cast<ValueBaseType>(container->mStringBits & NS_ATTRVALUE_BASETYPE_MASK) == eStringBase) {
        // TODO: we might be counting the string size more than once.
        // This should be fixed with bug 677487.
        nsStringBuffer* str = static_cast<nsStringBuffer*>(otherPtr);
        size += str ? str->StorageSize() : 0;
      }

      // TODO: mCSSStyleRule and mSVGValue might be owned by another object
      // which would make us count them twice, bug 677493.
      if (Type() == eCSSStyleRule && container->mCSSStyleRule) {
        // TODO: Add SizeOf() to StyleRule, bug 677503.
        size += sizeof(*container->mCSSStyleRule);
      } else if (Type() == eSVGValue && container->mSVGValue) {
        // TODO: Add SizeOf() to nsSVGValue, bug 677504.
        size += sizeof(*container->mSVGValue);
      } else if (Type() == eAtomArray && container->mAtomArray) {
        size += sizeof(container->mAtomArray) + sizeof(nsTArrayHeader);
        size += container->mAtomArray->Capacity() * sizeof(nsCOMPtr<nsIAtom>);
        // Don't count the size of each nsIAtom, they are counted separatly.
      }

      break;
    }
    case eAtomBase:    // Atoms are counted separatly.
    case eIntegerBase: // The value is in mBits, nothing to do.
      break;
  }

  return size;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:58,代码来源:nsAttrValue.cpp


示例10: ResetMiscAtomOrString

PRBool
nsAttrValue::EnsureEmptyMiscContainer()
{
  MiscContainer* cont;
  if (BaseType() == eOtherBase) {
    ResetMiscAtomOrString();
    cont = GetMiscContainer();
    switch (cont->mType) {
      case eCSSStyleRule:
      {
        NS_RELEASE(cont->mCSSStyleRule);
        break;
      }
      case eAtomArray:
      {
        delete cont->mAtomArray;
        break;
      }
      case eSVGValue:
      {
        NS_RELEASE(cont->mSVGValue);
        break;
      }
      case eIntMarginValue:
      {
        delete cont->mIntMargin;
        break;
      }
      default:
      {
        break;
      }
    }
  }
  else {
    ResetIfSet();

    cont = new MiscContainer;
    NS_ENSURE_TRUE(cont, PR_FALSE);

    SetPtrValueAndType(cont, eOtherBase);
  }

  cont->mType = eColor;
  cont->mStringBits = 0;
  cont->mColor = 0;

  return PR_TRUE;
}
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:49,代码来源:nsAttrValue.cpp


示例11: REFLECTIVE_ASSERT

	void Type::set_base_types(const ArrayView<const BaseType> & i_base_types)
	{
		if (i_base_types.size() >= 1)
		{
			m_single_base = i_base_types[0];
			#if REFLECTIVE_ENABLE_MULTIPLE_INHERITANCE
				m_other_base_types.resize(i_base_types.size() - 1);
				for (size_t base_type_index = 1; base_type_index < i_base_types.size(); base_type_index++)
				{
					m_other_base_types[base_type_index - 1] = i_base_types[base_type_index];
				}
			#else
				REFLECTIVE_ASSERT(i_base_types.size() == 1, "More than one base type provided, but multiple inheritance is disabled (REFLECTIVE_ENABLE_MULTIPLE_INHERITANCE si false)");
			#endif
		}
		else
		{
			m_single_base = BaseType();
			#if REFLECTIVE_ENABLE_MULTIPLE_INHERITANCE
				m_other_base_types.clear();
			#endif
		}
	}
开发者ID:giucamp,项目名称:rreflective,代码行数:23,代码来源:type.cpp


示例12: TypeContext

status_t
DwarfArrayType::ResolveElementLocation(const ArrayIndexPath& indexPath,
	const ValueLocation& parentLocation, ValueLocation*& _location)
{
	if (indexPath.CountIndices() != CountDimensions())
		return B_BAD_VALUE;
	DwarfTypeContext* typeContext = TypeContext();

	// If the array entry has a bit stride, get it. Otherwise fall back to the
	// element type size.
	int64 bitStride;
	DIEArrayType* bitStrideOwnerEntry = NULL;
	if (fEntry != NULL && (bitStrideOwnerEntry = DwarfUtils::GetDIEByPredicate(
			fEntry, HasBitStridePredicate<DIEArrayType>()))) {
		BVariant value;
		status_t error = typeContext->File()->EvaluateDynamicValue(
			typeContext->GetCompilationUnit(), typeContext->AddressSize(),
			typeContext->SubprogramEntry(), bitStrideOwnerEntry->BitStride(),
			typeContext->TargetInterface(), typeContext->InstructionPointer(),
			typeContext->FramePointer(), value);
		if (error != B_OK)
			return error;
		if (!value.IsInteger())
			return B_BAD_VALUE;
		bitStride = value.ToInt64();
	} else
		bitStride = BaseType()->ByteSize() * 8;

	// Iterate backward through the dimensions and compute the total offset of
	// the element.
	int64 elementOffset = 0;
	DwarfArrayDimension* previousDimension = NULL;
	int64 previousDimensionStride = 0;
	for (int32 dimensionIndex = CountDimensions() - 1;
			dimensionIndex >= 0; dimensionIndex--) {
		DwarfArrayDimension* dimension = DwarfDimensionAt(dimensionIndex);
		int64 index = indexPath.IndexAt(dimensionIndex);

		// If the dimension has a special bit/byte stride, get it.
		int64 dimensionStride = 0;
		DwarfType* dimensionType = dimension->GetDwarfType();
		DIEArrayIndexType* dimensionTypeEntry = dimensionType != NULL
			? dynamic_cast<DIEArrayIndexType*>(dimensionType->GetDIEType())
			: NULL;
		if (dimensionTypeEntry != NULL) {
			DIEArrayIndexType* bitStrideOwnerEntry
				= DwarfUtils::GetDIEByPredicate(dimensionTypeEntry,
					HasBitStridePredicate<DIEArrayIndexType>());
			if (bitStrideOwnerEntry != NULL) {
				BVariant value;
				status_t error = typeContext->File()->EvaluateDynamicValue(
					typeContext->GetCompilationUnit(),
					typeContext->AddressSize(),
					typeContext->SubprogramEntry(),
					bitStrideOwnerEntry->BitStride(),
					typeContext->TargetInterface(),
					typeContext->InstructionPointer(),
					typeContext->FramePointer(), value);
				if (error != B_OK)
					return error;
				if (!value.IsInteger())
					return B_BAD_VALUE;
				dimensionStride = value.ToInt64();
			} else {
				DIEArrayIndexType* byteStrideOwnerEntry
					= DwarfUtils::GetDIEByPredicate(dimensionTypeEntry,
						HasByteStridePredicate<DIEArrayIndexType>());
				if (byteStrideOwnerEntry != NULL) {
					BVariant value;
					status_t error = typeContext->File()->EvaluateDynamicValue(
						typeContext->GetCompilationUnit(),
						typeContext->AddressSize(),
						typeContext->SubprogramEntry(),
						byteStrideOwnerEntry->ByteStride(),
						typeContext->TargetInterface(),
						typeContext->InstructionPointer(),
						typeContext->FramePointer(), value);
					if (error != B_OK)
						return error;
					if (!value.IsInteger())
						return B_BAD_VALUE;
					dimensionStride = value.ToInt64() * 8;
				}
			}
		}

		// If we don't have a stride for the dimension yet, use the stride of
		// the previous dimension multiplied by the size of the dimension.
		if (dimensionStride == 0) {
			if (previousDimension != NULL) {
				dimensionStride = previousDimensionStride
					* previousDimension->CountElements();
			} else {
				// the last dimension -- use the element bit stride
				dimensionStride = bitStride;
			}
		}

		// If the dimension stride is still 0 (that can happen, if the dimension
		// doesn't have a stride and the previous dimension's element count is
//.........这里部分代码省略.........
开发者ID:RAZVOR,项目名称:haiku,代码行数:101,代码来源:DwarfTypes.cpp


示例13: IsExportedStruct

bool IsExportedStruct(Type *type)
{
	return IsStruct(BaseType(type)) && type->sptr->exported;
}
开发者ID:4aiman,项目名称:HexEdit,代码行数:4,代码来源:type_utils.cpp


示例14: IsStruct

bool IsStruct(Type *type)
{
	return IsStruct(BaseType(type));
}
开发者ID:avplayer,项目名称:avdbg,代码行数:4,代码来源:type_utils.cpp


示例15: GetMiscContainer

void
nsAttrValue::ToString(nsAString& aResult) const
{
  MiscContainer* cont = nsnull;
  if (BaseType() == eOtherBase) {
    cont = GetMiscContainer();
    void* ptr = MISC_STR_PTR(cont);
    if (ptr) {
      if (static_cast<ValueBaseType>(cont->mStringBits & NS_ATTRVALUE_BASETYPE_MASK) ==
          eStringBase) {
        nsStringBuffer* str = static_cast<nsStringBuffer*>(ptr);
        if (str) {
          str->ToString(str->StorageSize()/sizeof(PRUnichar) - 1, aResult);
          return;
        }
      } else {
        nsIAtom *atom = static_cast<nsIAtom*>(ptr);
        atom->ToString(aResult);
        return;
      }
    }
  }

  switch(Type()) {
    case eString:
    {
      nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
      if (str) {
        str->ToString(str->StorageSize()/sizeof(PRUnichar) - 1, aResult);
      }
      else {
        aResult.Truncate();
      }
      break;
    }
    case eAtom:
    {
      nsIAtom *atom = static_cast<nsIAtom*>(GetPtr());
      atom->ToString(aResult);

      break;
    }
    case eInteger:
    {
      nsAutoString intStr;
      intStr.AppendInt(GetIntegerValue());
      aResult = intStr;

      break;
    }
#ifdef DEBUG
    case eColor:
    {
      NS_NOTREACHED("color attribute without string data");
      aResult.Truncate();
      break;
    }
#endif
    case eEnum:
    {
      GetEnumString(aResult, PR_FALSE);
      break;
    }
    case ePercent:
    {
      nsAutoString intStr;
      intStr.AppendInt(cont ? cont->mPercent : GetIntInternal());
      aResult = intStr + NS_LITERAL_STRING("%");

      break;
    }
    case eCSSStyleRule:
    {
      aResult.Truncate();
      MiscContainer *container = GetMiscContainer();
      css::Declaration *decl = container->mCSSStyleRule->GetDeclaration();
      if (decl) {
        decl->ToString(aResult);
      }
      const_cast<nsAttrValue*>(this)->SetMiscAtomOrString(&aResult);

      break;
    }
    case eSVGValue:
    {
      GetMiscContainer()->mSVGValue->GetValueString(aResult);
      break;
    }
    case eDoubleValue:
    {
      aResult.Truncate();
      aResult.AppendFloat(GetDoubleValue());
      break;
    }
    default:
    {
      aResult.Truncate();
      break;
    }
  }
//.........这里部分代码省略.........
开发者ID:Egyptghost1,项目名称:DOMinator,代码行数:101,代码来源:nsAttrValue.cpp


示例16: base

inline BaseType base(Type t)
{
    return BaseType(toNative(t) & 0xFF00);
}
开发者ID:abellgithub,项目名称:laz-perf,代码行数:4,代码来源:PyLazperfTypes.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BaseWindingForPlane函数代码示例发布时间:2022-05-30
下一篇:
C++ BaseSetLastNTError函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap