| 5125 | } |
| 5126 | |
| 5127 | asCDataType 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 | |
| 5162 | asCObjectType *asCScriptEngine::GetObjectTypeFromTypeId(int typeId) const |
| 5163 | { |
no test coverage detected