std::shared_ptr< ITypeCaster > ComponentRegistration::getTypeCaster(const std::type_info& typeInfo) { std::type_index typeIndex(typeInfo); if (typeCasters_.count(typeIndex) == 0) return std::shared_ptr< ITypeCaster >(std::make_shared< ForwardTypeCaster >(typeInfo)); return typeCasters_[typeIndex]; }
std::shared_ptr< void > ComponentRegistration::castOrForward(const std::type_info& typeInfo, std::shared_ptr< void > instance) { std::type_index typeIndex(typeInfo); if (instance == nullptr || typeCasters_.count(typeIndex) == 0) return instance; auto& typeCaster = typeCasters_[typeIndex]; return typeCaster->cast(instance); }
std::pair<spt::db::DataType, StdString> TypeString::itemAt(ssize_t nIndex) const { std::pair<spt::db::DataType, StdString>p; if(nIndex == -1 || nIndex >= (size_t)mTypeStrings.size()) nIndex = typeIndex(spt::db::DataType::type_unknown); p = mTypeStrings.at(nIndex); return p; }
StdString TypeString::toString(spt::db::DataType nDataType) const { return itemAt(typeIndex(nDataType)).second; }
const VertexDataManager::FormatConverter &VertexDataManager::formatConverter(const VertexAttribute &attribute) const { return mAttributeTypes[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1]; }
D3DDECLTYPE Dx9BackEnd::mapAttributeType(GLenum type, std::size_t size, bool normalize) const { return mAttributeTypes[typeIndex(type)][normalize][size-1].d3dDeclType; }
FormatConverter Dx9BackEnd::getFormatConverter(GLenum type, std::size_t size, bool normalize) { return mAttributeTypes[typeIndex(type)][normalize][size-1].formatConverter; }