MCPcopy Create free account
hub / github.com/anjo76/angelscript / GetDataTypeFromTypeId

Method GetDataTypeFromTypeId

sdk/angelscript/source/as_scriptengine.cpp:5127–5160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5125}
5126
5127asCDataType asCScriptEngine::GetDataTypeFromTypeId(int typeId) const
5128{
5129 if (typeId < 0)
5130 return asCDataType();
5131
5132 int baseId = typeId & (asTYPEID_MASK_OBJECT | asTYPEID_MASK_SEQNBR);
5133
5134 if( typeId <= asTYPEID_DOUBLE )
5135 {
5136 eTokenType type[] = {ttVoid, ttBool, ttInt8, ttInt16, ttInt, ttInt64, ttUInt8, ttUInt16, ttUInt, ttUInt64, ttFloat, ttDouble};
5137 return asCDataType::CreatePrimitive(type[typeId], false);
5138 }
5139
5140 // First check if the typeId is an object type
5141 asCTypeInfo *ot = 0;
5142 ACQUIRESHARED(engineRWLock);
5143 asSMapNode<int,asCTypeInfo*> *cursor = 0;
5144 if( mapTypeIdToTypeInfo.MoveTo(&cursor, baseId) )
5145 ot = mapTypeIdToTypeInfo.GetValue(cursor);
5146 RELEASESHARED(engineRWLock);
5147
5148 if( ot )
5149 {
5150 asCDataType dt = asCDataType::CreateType(ot, false);
5151 if( typeId & asTYPEID_OBJHANDLE )
5152 dt.MakeHandle(true, true);
5153 if( typeId & asTYPEID_HANDLETOCONST )
5154 dt.MakeHandleToConst(true);
5155
5156 return dt;
5157 }
5158
5159 return asCDataType();
5160}
5161
5162asCObjectType *asCScriptEngine::GetObjectTypeFromTypeId(int typeId) const
5163{

Callers 4

TranslateFunctionMethod · 0.80
AdjustOffsetMethod · 0.80
WriteUsedTypeIdsMethod · 0.80

Calls 5

asCDataTypeClass · 0.85
MoveToMethod · 0.80
MakeHandleMethod · 0.80
MakeHandleToConstMethod · 0.80
GetValueMethod · 0.45

Tested by

no test coverage detected