ECode CObjInfoList::AcquireCarArrayElementTypeInfo( /* [in] */ CClsModule* clsModule, /* [in] */ TypeDescriptor* typeDesc, /* [out] */ IDataTypeInfo** elementTypeInfo) { CarDataType type; switch (typeDesc->mType) { case Type_ArrayOf: return AcquireDataTypeInfo(clsModule, adjustNestedTypeAddr(clsModule->mBase, typeDesc->mNestedType), elementTypeInfo); default: return E_INVALID_OPERATION; } return AcquireIntrinsicInfo(type, elementTypeInfo); }
UInt32 GetDataTypeSize( /* [in] */ const CClsModule* clsModule, /* [in] */ TypeDescriptor* typeDesc) { UInt32 size = 0; CLSModule* module = clsModule->mClsMod; if (typeDesc->mType == Type_alias) { TypeDescriptor orgTypeDesc; _GetOriginalType(clsModule, typeDesc, &orgTypeDesc); typeDesc = &orgTypeDesc; } if (typeDesc->mPointer) { return sizeof(void *); } ArrayDirEntry* arrayDir = NULL; StructDirEntry* structDir = NULL; Int32 base = clsModule->mBase; switch (typeDesc->mType) { case Type_Char16: size = sizeof(Char16); break; case Type_Char32: size = sizeof(Char32); break; case Type_Int8: size = sizeof(Int8); break; case Type_Int16: size = sizeof(Int16); break; case Type_Int32: size = sizeof(Int32); break; case Type_Int64: size = sizeof(Int64); break; case Type_UInt16: size = sizeof(UInt16); break; case Type_UInt32: size = sizeof(UInt32); break; case Type_UInt64: size = sizeof(UInt64); break; case Type_Byte: size = sizeof(Byte); break; case Type_Boolean: size = sizeof(Boolean); break; case Type_EMuid: size = sizeof(EMuid); break; case Type_Float: size = sizeof(float); break; case Type_Double: size = sizeof(double); break; case Type_PVoid: size = 4; break; case Type_ECode: size = sizeof(ECode); break; case Type_EGuid: size = sizeof(ClassID); break; case Type_EventHandler: size = sizeof(EventHandler); break; case Type_String: // [in] String (in car) --> /* [in] */ const String& (in c++), so should be sizeof(String*) size = sizeof(String*); break; case Type_interface: size = sizeof(PInterface); break; case Type_struct: structDir = getStructDirAddr(base, module->mStructDirs, typeDesc->mIndex); size = adjustStructDescAddr(base, structDir->mDesc)->nAlignSize; break; case Type_Array: arrayDir = getArrayDirAddr(base, module->mArrayDirs, typeDesc->mIndex); size = GetDataTypeSize(clsModule, &arrayDir->type) * arrayDir->nElements; break; case Type_enum: size = sizeof(int); break; case Type_ArrayOf: size = GetDataTypeSize(clsModule, adjustNestedTypeAddr(base, typeDesc->mNestedType)); break; // case Type_EzEnum: // size = sizeof(EzEnum); // break; case Type_alias: case Type_const: default: size = 0; } return size; }