diff --git a/code/AssetLib/3DS/3DSLoader.cpp b/code/AssetLib/3DS/3DSLoader.cpp index e1a6d0f89..4c24394fb 100644 --- a/code/AssetLib/3DS/3DSLoader.cpp +++ b/code/AssetLib/3DS/3DSLoader.cpp @@ -147,7 +147,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile, // We should have at least one chunk if (theStream.GetRemainingSize() < 16) { - throw DeadlyImportError("3DS file is either empty or corrupt: " + pFile); + throw DeadlyImportError("3DS file is either empty or corrupt: ", pFile); } this->stream = &theStream; @@ -178,7 +178,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile, // file. for (auto &mesh : mScene->mMeshes) { if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0) { - throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile); + throw DeadlyImportError("3DS file contains faces but no vertices: ", pFile); } CheckIndices(mesh); MakeUnique(mesh); diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index e8e1e2f5e..7094ea3ae 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -118,7 +118,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) : mRootStream(nullptr), mZipArchive() { mZipArchive.reset(new ZipArchiveIOSystem(pIOHandler, rFile)); if (!mZipArchive->isOpen()) { - throw DeadlyImportError("Failed to open file " + rFile + "."); + throw DeadlyImportError("Failed to open file ", rFile, "."); } std::vector fileList; @@ -192,7 +192,7 @@ std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) { }); if (itr == reader.m_relationShips.end()) { - throw DeadlyImportError("Cannot find " + XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE); + throw DeadlyImportError("Cannot find ", XmlTag::PACKAGE_START_PART_RELATIONSHIP_TYPE); } return (*itr)->target; diff --git a/code/AssetLib/AC/ACLoader.cpp b/code/AssetLib/AC/ACLoader.cpp index 4291ce8d1..bf2828655 100644 --- a/code/AssetLib/AC/ACLoader.cpp +++ b/code/AssetLib/AC/ACLoader.cpp @@ -762,7 +762,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open AC3D file " + pFile + "."); + throw DeadlyImportError("Failed to open AC3D file ", pFile, "."); } // allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/AMF/AMFImporter.cpp b/code/AssetLib/AMF/AMFImporter.cpp index 0b76b2652..fed259a9b 100644 --- a/code/AssetLib/AMF/AMFImporter.cpp +++ b/code/AssetLib/AMF/AMFImporter.cpp @@ -143,23 +143,23 @@ bool AMFImporter::Find_ConvertedMaterial(const std::string &pID, const SPP_Mater /*********************************************************************************************************************************************/ void AMFImporter::Throw_CloseNotFound(const std::string &pNode) { - throw DeadlyImportError("Close tag for node <" + pNode + "> not found. Seems file is corrupt."); + throw DeadlyImportError("Close tag for node <", pNode, "> not found. Seems file is corrupt."); } void AMFImporter::Throw_IncorrectAttr(const std::string &pAttrName) { - throw DeadlyImportError("Node <" + std::string(mReader->getNodeName()) + "> has incorrect attribute \"" + pAttrName + "\"."); + throw DeadlyImportError("Node <", std::string(mReader->getNodeName()), "> has incorrect attribute \"", pAttrName, "\"."); } void AMFImporter::Throw_IncorrectAttrValue(const std::string &pAttrName) { - throw DeadlyImportError("Attribute \"" + pAttrName + "\" in node <" + std::string(mReader->getNodeName()) + "> has incorrect value."); + throw DeadlyImportError("Attribute \"", pAttrName, "\" in node <", std::string(mReader->getNodeName()), "> has incorrect value."); } void AMFImporter::Throw_MoreThanOnceDefined(const std::string &pNodeType, const std::string &pDescription) { - throw DeadlyImportError("\"" + pNodeType + "\" node can be used only once in " + mReader->getNodeName() + ". Description: " + pDescription); + throw DeadlyImportError("\"", pNodeType, "\" node can be used only once in ", mReader->getNodeName(), ". Description: ", pDescription); } void AMFImporter::Throw_ID_NotFound(const std::string &pID) const { - throw DeadlyImportError("Not found node with name \"" + pID + "\"."); + throw DeadlyImportError("Not found node with name \"", pID, "\"."); } /*********************************************************************************************************************************************/ @@ -167,7 +167,7 @@ void AMFImporter::Throw_ID_NotFound(const std::string &pID) const { /*********************************************************************************************************************************************/ void AMFImporter::XML_CheckNode_MustHaveChildren() { - if (mReader->isEmptyElement()) throw DeadlyImportError(std::string("Node <") + mReader->getNodeName() + "> must have children."); + if (mReader->isEmptyElement()) throw DeadlyImportError("Node <", mReader->getNodeName(), "> must have children."); } void AMFImporter::XML_CheckNode_SkipUnsupported(const std::string &pParentNodeName) { @@ -202,7 +202,7 @@ void AMFImporter::XML_CheckNode_SkipUnsupported(const std::string &pParentNodeNa casu_cres: - if (!found) throw DeadlyImportError("Unknown node \"" + nn + "\" in " + pParentNodeName + "."); + if (!found) throw DeadlyImportError("Unknown node \"", nn, "\" in ", pParentNodeName, "."); if (!close_found) Throw_CloseNotFound(nn); if (!skipped_before[sk_idx]) { @@ -227,7 +227,7 @@ bool AMFImporter::XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx) { else if ((val == "true") || (val == "1")) return true; else - throw DeadlyImportError("Bool attribute value can contain \"false\"/\"0\" or \"true\"/\"1\" not the \"" + val + "\""); + throw DeadlyImportError("Bool attribute value can contain \"false\"/\"0\" or \"true\"/\"1\" not the \"", val, "\""); } float AMFImporter::XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx) { @@ -367,13 +367,13 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) { // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open AMF file " + pFile + "."); + throw DeadlyImportError("Failed to open AMF file ", pFile, "."); } // generate a XML reader for it std::unique_ptr mIOWrapper(new CIrrXML_IOStreamReader(file.get())); mReader = irr::io::createIrrXMLReader(mIOWrapper.get()); - if (!mReader) throw DeadlyImportError("Failed to create XML reader for file" + pFile + "."); + if (!mReader) throw DeadlyImportError("Failed to create XML reader for file", pFile, "."); // // start reading // search for root tag diff --git a/code/AssetLib/ASE/ASELoader.cpp b/code/AssetLib/ASE/ASELoader.cpp index a27767229..057272c91 100644 --- a/code/AssetLib/ASE/ASELoader.cpp +++ b/code/AssetLib/ASE/ASELoader.cpp @@ -137,7 +137,7 @@ void ASEImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open ASE file " + pFile + "."); + throw DeadlyImportError("Failed to open ASE file ", pFile, "."); } // Allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/B3D/B3DImporter.cpp b/code/AssetLib/B3D/B3DImporter.cpp index ff595aaf1..25e484e02 100644 --- a/code/AssetLib/B3D/B3DImporter.cpp +++ b/code/AssetLib/B3D/B3DImporter.cpp @@ -119,7 +119,7 @@ void B3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open B3D file " + pFile + "."); + throw DeadlyImportError("Failed to open B3D file ", pFile, "."); } // check whether the .b3d file is large enough to contain @@ -147,7 +147,7 @@ AI_WONT_RETURN void B3DImporter::Fail(string str) { #ifdef DEBUG_B3D ASSIMP_LOG_ERROR_F("Error in B3D file data: ", str); #endif - throw DeadlyImportError("B3D Importer - error in B3D file data: " + str); + throw DeadlyImportError("B3D Importer - error in B3D file data: ", str); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/BVH/BVHLoader.cpp b/code/AssetLib/BVH/BVHLoader.cpp index 94fb0b2d1..3bea70c95 100644 --- a/code/AssetLib/BVH/BVHLoader.cpp +++ b/code/AssetLib/BVH/BVHLoader.cpp @@ -125,7 +125,7 @@ void BVHLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IOSyst // read file into memory std::unique_ptr file(pIOHandler->Open(pFile)); if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open file " + pFile + "."); + throw DeadlyImportError("Failed to open file ", pFile, "."); } size_t fileSize = file->FileSize(); @@ -454,7 +454,7 @@ void BVHLoader::CreateAnimation(aiScene *pScene) { std::map::iterator mapIter = channelMap.find(channel); if (mapIter == channelMap.end()) - throw DeadlyImportError("Missing position channel in node " + nodeName); + throw DeadlyImportError("Missing position channel in node ", nodeName); else { int channelIdx = mapIter->second; switch (channel) { diff --git a/code/AssetLib/COB/COBLoader.cpp b/code/AssetLib/COB/COBLoader.cpp index 86550e776..80b41143e 100644 --- a/code/AssetLib/COB/COBLoader.cpp +++ b/code/AssetLib/COB/COBLoader.cpp @@ -125,7 +125,7 @@ void COBImporter::SetupProperties(const Importer * /*pImp*/) { // ------------------------------------------------------------------------------------------------ /*static*/ AI_WONT_RETURN void COBImporter::ThrowException(const std::string &msg) { - throw DeadlyImportError("COB: " + msg); + throw DeadlyImportError("COB: ", msg); } // ------------------------------------------------------------------------------------------------ diff --git a/code/AssetLib/CSM/CSMLoader.cpp b/code/AssetLib/CSM/CSMLoader.cpp index c455bb3a4..a90bc4b89 100644 --- a/code/AssetLib/CSM/CSMLoader.cpp +++ b/code/AssetLib/CSM/CSMLoader.cpp @@ -128,7 +128,7 @@ void CSMImporter::InternReadFile( const std::string& pFile, // Check whether we can read from the file if( file.get() == nullptr) { - throw DeadlyImportError( "Failed to open CSM file " + pFile + "."); + throw DeadlyImportError( "Failed to open CSM file ", pFile, "."); } // allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/Collada/ColladaParser.cpp b/code/AssetLib/Collada/ColladaParser.cpp index 54f63b8dd..90157f63c 100644 --- a/code/AssetLib/Collada/ColladaParser.cpp +++ b/code/AssetLib/Collada/ColladaParser.cpp @@ -123,7 +123,7 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) : // attempt to open the file directly daefile.reset(pIOHandler->Open(pFile)); if (daefile.get() == nullptr) { - throw DeadlyImportError("Failed to open file '" + pFile + "'."); + throw DeadlyImportError("Failed to open file '", pFile, "'."); } } diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp index 97b0d19dd..cda391fb8 100644 --- a/code/AssetLib/DXF/DXFLoader.cpp +++ b/code/AssetLib/DXF/DXFLoader.cpp @@ -152,7 +152,7 @@ void DXFImporter::InternReadFile( const std::string& filename, aiScene* pScene, // Check whether we can read the file if( file.get() == nullptr ) { - throw DeadlyImportError( "Failed to open DXF file " + filename + ""); + throw DeadlyImportError( "Failed to open DXF file ", filename, ""); } // Check whether this is a binary DXF file - we can't read binary DXF files :-( diff --git a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp index 78f02ff96..2ed41ccdb 100644 --- a/code/AssetLib/FBX/FBXBinaryTokenizer.cpp +++ b/code/AssetLib/FBX/FBXBinaryTokenizer.cpp @@ -468,7 +468,7 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, size_t length) catch (const DeadlyImportError& e) { if (!is64bits && (length > std::numeric_limits::max())) { - throw DeadlyImportError("The FBX file is invalid. This may be because the content is too big for this older version (" + to_string(version) + ") of the FBX format. (" + e.what() + ")"); + throw DeadlyImportError("The FBX file is invalid. This may be because the content is too big for this older version (", to_string(version), ") of the FBX format. (", e.what(), ")"); } throw; } diff --git a/code/AssetLib/FBX/FBXDocumentUtil.cpp b/code/AssetLib/FBX/FBXDocumentUtil.cpp index 16235645c..9bbc39e00 100644 --- a/code/AssetLib/FBX/FBXDocumentUtil.cpp +++ b/code/AssetLib/FBX/FBXDocumentUtil.cpp @@ -70,7 +70,7 @@ void DOMError(const std::string& message, const Element* element /*= nullptr*/) if(element) { DOMError(message,element->KeyToken()); } - throw DeadlyImportError("FBX-DOM " + message); + throw DeadlyImportError("FBX-DOM ", message); } diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp index 3c9137ccc..cfd2a5830 100644 --- a/code/AssetLib/FBX/FBXParser.cpp +++ b/code/AssetLib/FBX/FBXParser.cpp @@ -83,7 +83,7 @@ namespace { if(element) { ParseError(message,element->KeyToken()); } - throw DeadlyImportError("FBX-Parser " + message); + throw DeadlyImportError("FBX-Parser ", message); } diff --git a/code/AssetLib/HMP/HMPLoader.cpp b/code/AssetLib/HMP/HMPLoader.cpp index 33460cc73..8ccba2ea4 100644 --- a/code/AssetLib/HMP/HMPLoader.cpp +++ b/code/AssetLib/HMP/HMPLoader.cpp @@ -115,7 +115,7 @@ void HMPImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open HMP file " + pFile + "."); + throw DeadlyImportError("Failed to open HMP file ", pFile, "."); } // Check whether the HMP file is large enough to contain @@ -159,8 +159,8 @@ void HMPImporter::InternReadFile(const std::string &pFile, szBuffer[4] = '\0'; // We're definitely unable to load this file - throw DeadlyImportError("Unknown HMP subformat " + pFile + - ". Magic word (" + szBuffer + ") is not known"); + throw DeadlyImportError("Unknown HMP subformat ", pFile, + ". Magic word (", szBuffer, ") is not known"); } // Set the AI_SCENE_FLAGS_TERRAIN bit diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index 5d5253516..c26ee40ba 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -867,7 +867,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open IRR file " + pFile + ""); + throw DeadlyImportError("Failed to open IRR file ", pFile, ""); } // Construct the irrXML parser diff --git a/code/AssetLib/Irr/IRRMeshLoader.cpp b/code/AssetLib/Irr/IRRMeshLoader.cpp index d07ff87ea..48bd06b3e 100644 --- a/code/AssetLib/Irr/IRRMeshLoader.cpp +++ b/code/AssetLib/Irr/IRRMeshLoader.cpp @@ -140,7 +140,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open IRRMESH file " + pFile + "."); + throw DeadlyImportError("Failed to open IRRMESH file ", pFile, "."); } // Construct the irrXML parser diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp index ef11f2d15..149360559 100644 --- a/code/AssetLib/LWO/LWOLoader.cpp +++ b/code/AssetLib/LWO/LWOLoader.cpp @@ -145,7 +145,7 @@ void LWOImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open LWO file " + pFile + "."); + throw DeadlyImportError("Failed to open LWO file ", pFile, "."); } if ((this->fileSize = (unsigned int)file->FileSize()) < 12) { @@ -212,7 +212,7 @@ void LWOImporter::InternReadFile(const std::string &pFile, szBuff[2] = (char)(fileType >> 8u); szBuff[3] = (char)(fileType); szBuff[4] = '\0'; - throw DeadlyImportError(std::string("Unknown LWO sub format: ") + szBuff); + throw DeadlyImportError("Unknown LWO sub format: ", szBuff); } if (AI_LWO_FOURCC_LWOB != fileType) { @@ -232,7 +232,7 @@ void LWOImporter::InternReadFile(const std::string &pFile, } if (configLayerName.length() && !hasNamedLayer) { - throw DeadlyImportError("LWO2: Unable to find the requested layer: " + configLayerName); + throw DeadlyImportError("LWO2: Unable to find the requested layer: ", configLayerName); } } diff --git a/code/AssetLib/LWS/LWSLoader.cpp b/code/AssetLib/LWS/LWSLoader.cpp index 38b44f842..7d67c86d6 100644 --- a/code/AssetLib/LWS/LWSLoader.cpp +++ b/code/AssetLib/LWS/LWSLoader.cpp @@ -502,7 +502,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open LWS file " + pFile + "."); + throw DeadlyImportError("Failed to open LWS file ", pFile, "."); } // Allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp index d6fe678ec..05b75148b 100644 --- a/code/AssetLib/M3D/M3DImporter.cpp +++ b/code/AssetLib/M3D/M3DImporter.cpp @@ -160,21 +160,21 @@ void M3DImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSys // Read file into memory std::unique_ptr pStream(pIOHandler->Open(file, "rb")); if (!pStream.get()) { - throw DeadlyImportError("Failed to open file " + file + "."); + throw DeadlyImportError("Failed to open file ", file, "."); } // Get the file-size and validate it, throwing an exception when fails size_t fileSize = pStream->FileSize(); if (fileSize < 8) { - throw DeadlyImportError("M3D-file " + file + " is too small."); + throw DeadlyImportError("M3D-file ", file, " is too small."); } std::vector buffer(fileSize); if (fileSize != pStream->Read(buffer.data(), 1, fileSize)) { - throw DeadlyImportError("Failed to read the file " + file + "."); + throw DeadlyImportError("Failed to read the file ", file, "."); } // extra check for binary format's first 8 bytes. Not done for the ASCII variant if (!memcmp(buffer.data(), "3DMO", 4) && memcmp(buffer.data() + 4, &fileSize, 4)) { - throw DeadlyImportError("Bad binary header in file " + file + "."); + throw DeadlyImportError("Bad binary header in file ", file, "."); } #ifdef M3D_ASCII // make sure there's a terminator zero character, as input must be ASCIIZ @@ -200,7 +200,7 @@ void M3DImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSys M3DWrapper m3d(pIOHandler, buffer); if (!m3d) { - throw DeadlyImportError("Unable to parse " + file + " as M3D."); + throw DeadlyImportError("Unable to parse ", file, " as M3D."); } // create the root node diff --git a/code/AssetLib/MD2/MD2Loader.cpp b/code/AssetLib/MD2/MD2Loader.cpp index abc5f06ff..87b7a5609 100644 --- a/code/AssetLib/MD2/MD2Loader.cpp +++ b/code/AssetLib/MD2/MD2Loader.cpp @@ -222,7 +222,7 @@ void MD2Importer::InternReadFile( const std::string& pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open MD2 file " + pFile + ""); + throw DeadlyImportError("Failed to open MD2 file ", pFile, ""); } // check whether the md3 file is large enough to contain diff --git a/code/AssetLib/MD3/MD3Loader.cpp b/code/AssetLib/MD3/MD3Loader.cpp index 92d567801..9c31a7b20 100644 --- a/code/AssetLib/MD3/MD3Loader.cpp +++ b/code/AssetLib/MD3/MD3Loader.cpp @@ -715,7 +715,7 @@ void MD3Importer::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open MD3 file " + pFile + "."); + throw DeadlyImportError("Failed to open MD3 file ", pFile, "."); } // Check whether the md3 file is large enough to contain the header diff --git a/code/AssetLib/MD5/MD5Loader.cpp b/code/AssetLib/MD5/MD5Loader.cpp index 5428a9c74..1741f4472 100644 --- a/code/AssetLib/MD5/MD5Loader.cpp +++ b/code/AssetLib/MD5/MD5Loader.cpp @@ -675,7 +675,7 @@ void MD5Importer::LoadMD5CameraFile() { // Check whether we can read from the file if (!file.get() || !file->FileSize()) { - throw DeadlyImportError("Failed to read MD5CAMERA file: " + pFile); + throw DeadlyImportError("Failed to read MD5CAMERA file: ", pFile); } mHadMD5Camera = true; LoadFileIntoMemory(file.get()); diff --git a/code/AssetLib/MDC/MDCLoader.cpp b/code/AssetLib/MDC/MDCLoader.cpp index 5748fba0b..0e917171c 100644 --- a/code/AssetLib/MDC/MDCLoader.cpp +++ b/code/AssetLib/MDC/MDCLoader.cpp @@ -219,7 +219,7 @@ void MDCImporter::InternReadFile( // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open MDC file " + pFile + "."); + throw DeadlyImportError("Failed to open MDC file ", pFile, "."); } // check whether the mdc file is large enough to contain the file header diff --git a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h index 2891ddb1e..2fa1fd0e4 100644 --- a/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h +++ b/code/AssetLib/MDL/HalfLife/HL1MDLLoader.h @@ -218,12 +218,12 @@ private: template void HL1MDLLoader::load_file_into_buffer(const std::string &file_path, unsigned char *&buffer) { if (!io_->Exists(file_path)) - throw DeadlyImportError("Missing file " + DefaultIOSystem::fileName(file_path) + "."); + throw DeadlyImportError("Missing file ", DefaultIOSystem::fileName(file_path), "."); std::unique_ptr file(io_->Open(file_path)); if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open MDL file " + DefaultIOSystem::fileName(file_path) + "."); + throw DeadlyImportError("Failed to open MDL file ", DefaultIOSystem::fileName(file_path), "."); } const size_t file_size = file->FileSize(); diff --git a/code/AssetLib/MDL/MDLLoader.cpp b/code/AssetLib/MDL/MDLLoader.cpp index e917e3b5e..4e28f1a2f 100644 --- a/code/AssetLib/MDL/MDLLoader.cpp +++ b/code/AssetLib/MDL/MDLLoader.cpp @@ -167,7 +167,7 @@ void MDLImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open MDL file " + pFile + "."); + throw DeadlyImportError("Failed to open MDL file ", pFile, "."); } // This should work for all other types of MDL files, too ... @@ -251,8 +251,8 @@ void MDLImporter::InternReadFile(const std::string &pFile, } } else { // print the magic word to the log file - throw DeadlyImportError("Unknown MDL subformat " + pFile + - ". Magic word (" + std::string((char *)&iMagicWord, 4) + ") is not known"); + throw DeadlyImportError("Unknown MDL subformat ", pFile, + ". Magic word (", std::string((char *)&iMagicWord, 4), ") is not known"); } // Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system diff --git a/code/AssetLib/MMD/MMDImporter.cpp b/code/AssetLib/MMD/MMDImporter.cpp index 0814f4813..d1912d2fe 100644 --- a/code/AssetLib/MMD/MMDImporter.cpp +++ b/code/AssetLib/MMD/MMDImporter.cpp @@ -111,7 +111,7 @@ void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene, // Read file by istream std::filebuf fb; if (!fb.open(file, std::ios::in | std::ios::binary)) { - throw DeadlyImportError("Failed to open file " + file + "."); + throw DeadlyImportError("Failed to open file ", file, "."); } std::istream fileStream(&fb); @@ -122,7 +122,7 @@ void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene, fileStream.seekg(0, fileStream.beg); if (fileSize < sizeof(pmx::PmxModel)) { - throw DeadlyImportError(file + " is too small."); + throw DeadlyImportError(file, " is too small."); } pmx::PmxModel model; diff --git a/code/AssetLib/MMD/MMDPmxParser.cpp b/code/AssetLib/MMD/MMDPmxParser.cpp index 7ac5ac399..bbeeef4b8 100644 --- a/code/AssetLib/MMD/MMDPmxParser.cpp +++ b/code/AssetLib/MMD/MMDPmxParser.cpp @@ -524,7 +524,7 @@ namespace pmx if (version != 2.0f && version != 2.1f) { std::cerr << "this is not ver2.0 or ver2.1 but " << version << "." << std::endl; - throw DeadlyImportError("MMD: this is not ver2.0 or ver2.1 but " + to_string(version)); + throw DeadlyImportError("MMD: this is not ver2.0 or ver2.1 but ", to_string(version)); } this->setting.Read(stream); diff --git a/code/AssetLib/MS3D/MS3DLoader.cpp b/code/AssetLib/MS3D/MS3DLoader.cpp index b5b6673f3..7edbd91f2 100644 --- a/code/AssetLib/MS3D/MS3DLoader.cpp +++ b/code/AssetLib/MS3D/MS3DLoader.cpp @@ -229,7 +229,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile, stream.CopyAndAdvance(head,10); stream >> version; if (strncmp(head,"MS3D000000",10)) { - throw DeadlyImportError("Not a MS3D file, magic string MS3D000000 not found: "+pFile); + throw DeadlyImportError("Not a MS3D file, magic string MS3D000000 not found: ", pFile); } if (version != 4) { diff --git a/code/AssetLib/NFF/NFFLoader.cpp b/code/AssetLib/NFF/NFFLoader.cpp index a5e6c8c7a..1a4a65982 100644 --- a/code/AssetLib/NFF/NFFLoader.cpp +++ b/code/AssetLib/NFF/NFFLoader.cpp @@ -214,7 +214,7 @@ void NFFImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (!file.get()) - throw DeadlyImportError("Failed to open NFF file " + pFile + "."); + throw DeadlyImportError("Failed to open NFF file ", pFile, "."); // allocate storage and copy the contents of the file to a memory buffer // (terminate it with zero) diff --git a/code/AssetLib/OFF/OFFLoader.cpp b/code/AssetLib/OFF/OFFLoader.cpp index 79f006fca..fa981e439 100644 --- a/code/AssetLib/OFF/OFFLoader.cpp +++ b/code/AssetLib/OFF/OFFLoader.cpp @@ -123,7 +123,7 @@ void OFFImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS // Check whether we can read from the file if( file.get() == nullptr) { - throw DeadlyImportError( "Failed to open OFF file " + pFile + "."); + throw DeadlyImportError( "Failed to open OFF file ", pFile, "."); } // allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/Obj/ObjFileImporter.cpp b/code/AssetLib/Obj/ObjFileImporter.cpp index b6e1f9061..fafc7a6c8 100644 --- a/code/AssetLib/Obj/ObjFileImporter.cpp +++ b/code/AssetLib/Obj/ObjFileImporter.cpp @@ -109,7 +109,7 @@ void ObjFileImporter::InternReadFile(const std::string &file, aiScene *pScene, I static const std::string mode = "rb"; std::unique_ptr fileStream(pIOHandler->Open(file, mode)); if (!fileStream.get()) { - throw DeadlyImportError("Failed to open file " + file + "."); + throw DeadlyImportError("Failed to open file ", file, "."); } // Get the file-size and validate it, throwing an exception when fails diff --git a/code/AssetLib/Ogre/OgreBinarySerializer.cpp b/code/AssetLib/Ogre/OgreBinarySerializer.cpp index 7ce00471f..6f6a19bd9 100644 --- a/code/AssetLib/Ogre/OgreBinarySerializer.cpp +++ b/code/AssetLib/Ogre/OgreBinarySerializer.cpp @@ -788,7 +788,7 @@ MemoryStreamReaderPtr OgreBinarySerializer::OpenReader(Assimp::IOSystem *pIOHand IOStream *f = pIOHandler->Open(filename, "rb"); if (!f) { - throw DeadlyImportError("Failed to open skeleton file " + filename); + throw DeadlyImportError("Failed to open skeleton file ", filename); } return MemoryStreamReaderPtr(new MemoryStreamReader(f)); diff --git a/code/AssetLib/Ogre/OgreImporter.cpp b/code/AssetLib/Ogre/OgreImporter.cpp index 9d85a0a96..636c903d5 100644 --- a/code/AssetLib/Ogre/OgreImporter.cpp +++ b/code/AssetLib/Ogre/OgreImporter.cpp @@ -100,7 +100,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass // Open source file IOStream *f = pIOHandler->Open(pFile, "rb"); if (!f) { - throw DeadlyImportError("Failed to open file " + pFile); + throw DeadlyImportError("Failed to open file ", pFile); } // Binary .mesh import diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index 880303065..ff6af63f6 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -302,7 +302,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce // open source file IOStream *file = pIOHandler->Open( filename, "rb" ); if( !file ) { - throw DeadlyImportError( "Failed to open file " + filename ); + throw DeadlyImportError( "Failed to open file ", filename ); } std::vector buffer; diff --git a/code/AssetLib/Ply/PlyLoader.cpp b/code/AssetLib/Ply/PlyLoader.cpp index b8dbf2598..4a8aaf17b 100644 --- a/code/AssetLib/Ply/PlyLoader.cpp +++ b/code/AssetLib/Ply/PlyLoader.cpp @@ -151,13 +151,13 @@ void PLYImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy const std::string mode = "rb"; std::unique_ptr fileStream(pIOHandler->Open(pFile, mode)); if (!fileStream.get()) { - throw DeadlyImportError("Failed to open file " + pFile + "."); + throw DeadlyImportError("Failed to open file ", pFile, "."); } // Get the file-size const size_t fileSize(fileStream->FileSize()); if (0 == fileSize) { - throw DeadlyImportError("File " + pFile + " is empty."); + throw DeadlyImportError("File ", pFile, " is empty."); } IOStreamBuffer streamedBuffer(1024 * 1024); diff --git a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp index 52a2b7503..e9de3f5b3 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp +++ b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp @@ -180,7 +180,7 @@ const aiImporterDesc *Q3BSPFileImporter::GetInfo() const { void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene, IOSystem *ioHandler) { ZipArchiveIOSystem Archive(ioHandler, rFile); if (!Archive.isOpen()) { - throw DeadlyImportError("Failed to open file " + rFile + "."); + throw DeadlyImportError("Failed to open file ", rFile, "."); } std::string archiveName(""), mapName(""); diff --git a/code/AssetLib/Q3D/Q3DLoader.cpp b/code/AssetLib/Q3D/Q3DLoader.cpp index 717b5702e..786f96e8a 100644 --- a/code/AssetLib/Q3D/Q3DLoader.cpp +++ b/code/AssetLib/Q3D/Q3DLoader.cpp @@ -110,13 +110,12 @@ void Q3DImporter::InternReadFile(const std::string &pFile, // The header is 22 bytes large if (stream.GetRemainingSize() < 22) - throw DeadlyImportError("File is either empty or corrupt: " + pFile); + throw DeadlyImportError("File is either empty or corrupt: ", pFile); // Check the file's signature if (ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Do", 8) && ASSIMP_strincmp((const char *)stream.GetPtr(), "quick3Ds", 8)) { - throw DeadlyImportError("Not a Quick3D file. Signature string is: " + - std::string((const char *)stream.GetPtr(), 8)); + throw DeadlyImportError("Not a Quick3D file. Signature string is: ", std::string((const char *)stream.GetPtr(), 8)); } // Print the file format version diff --git a/code/AssetLib/Raw/RawLoader.cpp b/code/AssetLib/Raw/RawLoader.cpp index 1363e29c1..f9812bfe5 100644 --- a/code/AssetLib/Raw/RawLoader.cpp +++ b/code/AssetLib/Raw/RawLoader.cpp @@ -101,7 +101,7 @@ void RAWImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open RAW file " + pFile + "."); + throw DeadlyImportError("Failed to open RAW file ", pFile, "."); } // allocate storage and copy the contents of the file to a memory buffer diff --git a/code/AssetLib/SIB/SIBImporter.cpp b/code/AssetLib/SIB/SIBImporter.cpp index 33beb0087..8edcd50fa 100644 --- a/code/AssetLib/SIB/SIBImporter.cpp +++ b/code/AssetLib/SIB/SIBImporter.cpp @@ -808,7 +808,7 @@ void SIBImporter::InternReadFile(const std::string &pFile, // We should have at least one chunk if (stream.GetRemainingSize() < 16) - throw DeadlyImportError("SIB file is either empty or corrupt: " + pFile); + throw DeadlyImportError("SIB file is either empty or corrupt: ", pFile); SIB sib; diff --git a/code/AssetLib/SMD/SMDLoader.cpp b/code/AssetLib/SMD/SMDLoader.cpp index 8a7625f93..ea6135fd2 100644 --- a/code/AssetLib/SMD/SMDLoader.cpp +++ b/code/AssetLib/SMD/SMDLoader.cpp @@ -695,7 +695,7 @@ void SMDImporter::ReadSmd(const std::string &pFile, IOSystem* pIOHandler) { // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open SMD/VTA file " + pFile + "."); + throw DeadlyImportError("Failed to open SMD/VTA file ", pFile, "."); } iFileSize = (unsigned int)file->FileSize(); diff --git a/code/AssetLib/STL/STLLoader.cpp b/code/AssetLib/STL/STLLoader.cpp index 2d710b084..592ec6b77 100644 --- a/code/AssetLib/STL/STLLoader.cpp +++ b/code/AssetLib/STL/STLLoader.cpp @@ -181,7 +181,7 @@ void STLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Check whether we can read from the file if (file.get() == nullptr) { - throw DeadlyImportError("Failed to open STL file " + pFile + "."); + throw DeadlyImportError("Failed to open STL file ", pFile, "."); } mFileSize = (unsigned int)file->FileSize(); @@ -207,7 +207,7 @@ void STLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy } else if (IsAsciiSTL(mBuffer, mFileSize)) { LoadASCIIFile(mScene->mRootNode); } else { - throw DeadlyImportError("Failed to determine STL storage representation for " + pFile + "."); + throw DeadlyImportError("Failed to determine STL storage representation for ", pFile, "."); } // create a single default material, using a white diffuse color for consistency with diff --git a/code/AssetLib/Terragen/TerragenLoader.cpp b/code/AssetLib/Terragen/TerragenLoader.cpp index 0d0a140c3..3c57de4fb 100644 --- a/code/AssetLib/Terragen/TerragenLoader.cpp +++ b/code/AssetLib/Terragen/TerragenLoader.cpp @@ -121,7 +121,7 @@ void TerragenImporter::InternReadFile(const std::string &pFile, // Check whether we can read from the file if (file == nullptr) - throw DeadlyImportError("Failed to open TERRAGEN TERRAIN file " + pFile + "."); + throw DeadlyImportError("Failed to open TERRAGEN TERRAIN file ", pFile, "."); // Construct a stream reader to read all data in the correct endianness StreamReaderLE reader(file); diff --git a/code/AssetLib/X/XFileImporter.cpp b/code/AssetLib/X/XFileImporter.cpp index 6c57c9dd2..44c3b375d 100644 --- a/code/AssetLib/X/XFileImporter.cpp +++ b/code/AssetLib/X/XFileImporter.cpp @@ -114,7 +114,7 @@ void XFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene, I // read file into memory std::unique_ptr file( pIOHandler->Open( pFile)); if ( file.get() == nullptr ) { - throw DeadlyImportError( "Failed to open file " + pFile + "." ); + throw DeadlyImportError( "Failed to open file ", pFile, "." ); } static const size_t MinSize = 16; diff --git a/code/AssetLib/X3D/FIReader.cpp b/code/AssetLib/X3D/FIReader.cpp index c1b439bda..2bee9789e 100644 --- a/code/AssetLib/X3D/FIReader.cpp +++ b/code/AssetLib/X3D/FIReader.cpp @@ -997,18 +997,18 @@ private: if (index < 32) { FIDecoder *decoder = defaultDecoder[index]; if (!decoder) { - throw DeadlyImportError("Invalid encoding algorithm index " + to_string(index)); + throw DeadlyImportError("Invalid encoding algorithm index ", to_string(index)); } return decoder->decode(dataP, len); } else { if (index - 32 >= vocabulary.encodingAlgorithmTable.size()) { - throw DeadlyImportError("Invalid encoding algorithm index " + to_string(index)); + throw DeadlyImportError("Invalid encoding algorithm index ", to_string(index)); } std::string uri = vocabulary.encodingAlgorithmTable[index - 32]; auto it = decoderMap.find(uri); if (it == decoderMap.end()) { - throw DeadlyImportError("Unsupported encoding algorithm " + uri); + throw DeadlyImportError("Unsupported encoding algorithm ", uri); } else { return it->second->decode(dataP, len); @@ -1027,12 +1027,12 @@ private: alphabet = "0123456789-:TZ "; break; default: - throw DeadlyImportError("Invalid restricted alphabet index " + to_string(index)); + throw DeadlyImportError("Invalid restricted alphabet index ", to_string(index)); } } else { if (index - 16 >= vocabulary.restrictedAlphabetTable.size()) { - throw DeadlyImportError("Invalid restricted alphabet index " + to_string(index)); + throw DeadlyImportError("Invalid restricted alphabet index ", to_string(index)); } alphabet = vocabulary.restrictedAlphabetTable[index - 16]; } @@ -1040,7 +1040,7 @@ private: utf8::utf8to32(alphabet.begin(), alphabet.end(), back_inserter(alphabetUTF32)); std::string::size_type alphabetLength = alphabetUTF32.size(); if (alphabetLength < 2) { - throw DeadlyImportError("Invalid restricted alphabet length " + to_string(alphabetLength)); + throw DeadlyImportError("Invalid restricted alphabet length ", to_string(alphabetLength)); } std::string::size_type bitsPerCharacter = 1; while ((1ull << bitsPerCharacter) <= alphabetLength) { @@ -1442,7 +1442,7 @@ private: std::string uri = parseNonEmptyOctetString2(); auto it = vocabularyMap.find(uri); if (it == vocabularyMap.end()) { - throw DeadlyImportError("Unknown vocabulary " + uri); + throw DeadlyImportError("Unknown vocabulary ", uri); } const FIVocabulary *externalVocabulary = it->second; if (externalVocabulary->restrictedAlphabetTable) { diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index c9f9a6b6d..94b11dee2 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -233,48 +233,48 @@ bool X3DImporter::FindNodeElement(const std::string& pID, const CX3DImporter_Nod void X3DImporter::Throw_ArgOutOfRange(const std::string& pArgument) { - throw DeadlyImportError("Argument value is out of range for: \"" + pArgument + "\"."); + throw DeadlyImportError("Argument value is out of range for: \"", pArgument, "\"."); } void X3DImporter::Throw_CloseNotFound(const std::string& pNode) { - throw DeadlyImportError("Close tag for node <" + pNode + "> not found. Seems file is corrupt."); + throw DeadlyImportError("Close tag for node <", pNode, "> not found. Seems file is corrupt."); } void X3DImporter::Throw_ConvertFail_Str2ArrF(const std::string& pAttrValue) { - throw DeadlyImportError("In <" + std::string(mReader->getNodeName()) + "> failed to convert attribute value \"" + pAttrValue + + throw DeadlyImportError("In <", std::string(mReader->getNodeName()), "> failed to convert attribute value \"", pAttrValue, "\" from string to array of floats."); } void X3DImporter::Throw_DEF_And_USE() { - throw DeadlyImportError("\"DEF\" and \"USE\" can not be defined both in <" + std::string(mReader->getNodeName()) + ">."); + throw DeadlyImportError("\"DEF\" and \"USE\" can not be defined both in <", std::string(mReader->getNodeName()), ">."); } void X3DImporter::Throw_IncorrectAttr(const std::string& pAttrName) { - throw DeadlyImportError("Node <" + std::string(mReader->getNodeName()) + "> has incorrect attribute \"" + pAttrName + "\"."); + throw DeadlyImportError("Node <", std::string(mReader->getNodeName()), "> has incorrect attribute \"", pAttrName, "\"."); } void X3DImporter::Throw_IncorrectAttrValue(const std::string& pAttrName) { - throw DeadlyImportError("Attribute \"" + pAttrName + "\" in node <" + std::string(mReader->getNodeName()) + "> has incorrect value."); + throw DeadlyImportError("Attribute \"", pAttrName, "\" in node <", std::string(mReader->getNodeName()), "> has incorrect value."); } void X3DImporter::Throw_MoreThanOnceDefined(const std::string& pNodeType, const std::string& pDescription) { - throw DeadlyImportError("\"" + pNodeType + "\" node can be used only once in " + mReader->getNodeName() + ". Description: " + pDescription); + throw DeadlyImportError("\"", pNodeType, "\" node can be used only once in ", mReader->getNodeName(), ". Description: ", pDescription); } void X3DImporter::Throw_TagCountIncorrect(const std::string& pNode) { - throw DeadlyImportError("Count of open and close tags for node <" + pNode + "> are not equivalent. Seems file is corrupt."); + throw DeadlyImportError("Count of open and close tags for node <", pNode, "> are not equivalent. Seems file is corrupt."); } void X3DImporter::Throw_USE_NotFound(const std::string& pAttrValue) { - throw DeadlyImportError("Not found node with name \"" + pAttrValue + "\" in <" + std::string(mReader->getNodeName()) + ">."); + throw DeadlyImportError("Not found node with name \"", pAttrValue, "\" in <", std::string(mReader->getNodeName()), ">."); } /*********************************************************************************************************************************************/ @@ -283,7 +283,7 @@ void X3DImporter::Throw_USE_NotFound(const std::string& pAttrValue) void X3DImporter::XML_CheckNode_MustBeEmpty() { - if(!mReader->isEmptyElement()) throw DeadlyImportError(std::string("Node <") + mReader->getNodeName() + "> must be empty."); + if(!mReader->isEmptyElement()) throw DeadlyImportError("Node <", mReader->getNodeName(), "> must be empty."); } void X3DImporter::XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName) @@ -395,7 +395,7 @@ void X3DImporter::XML_CheckNode_SkipUnsupported(const std::string& pParentNodeNa casu_cres: - if(!found) throw DeadlyImportError("Unknown node \"" + nn + "\" in " + pParentNodeName + "."); + if(!found) throw DeadlyImportError("Unknown node \"", nn, "\" in ", pParentNodeName, "."); if(close_found) LogInfo("Skipping node \"" + nn + "\" in " + pParentNodeName + "."); @@ -430,7 +430,7 @@ bool X3DImporter::XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx) else if(val == "true") return true; else - throw DeadlyImportError("Bool attribute value can contain \"false\" or \"true\" not the \"" + val + "\""); + throw DeadlyImportError("Bool attribute value can contain \"false\" or \"true\" not the \"", val, "\""); } } @@ -971,8 +971,8 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list= norm_arr_copy.size()) - throw DeadlyImportError("MeshGeometry_AddNormal. Normal index(" + to_string(tind[i]) + - ") is out of range. Normals count: " + to_string(norm_arr_copy.size()) + "."); + throw DeadlyImportError("MeshGeometry_AddNormal. Normal index(", to_string(tind[i]), + ") is out of range. Normals count: ", to_string(norm_arr_copy.size()), "."); pMesh.mNormals[i] = norm_arr_copy[tind[i]]; } @@ -1268,7 +1268,7 @@ void X3DImporter::MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::vectorregisterVocabulary("urn:web3d:x3d:fi-vocabulary-3.2", &X3D_vocabulary_3_2); mReader->registerVocabulary("urn:web3d:x3d:fi-vocabulary-3.3", &X3D_vocabulary_3_3); @@ -1519,7 +1519,7 @@ void X3DImporter::ParseNode_Scene() auto GroupCounter_Increase = [](size_t& pCounter, const char* pGroupName) -> void { pCounter++; - if(pCounter == 0) throw DeadlyImportError("Group counter overflow. Too much groups with type: " + std::string(pGroupName) + "."); + if(pCounter == 0) throw DeadlyImportError("Group counter overflow. Too much groups with type: ", std::string(pGroupName), "."); }; auto GroupCounter_Decrease = [&](size_t& pCounter, const char* pGroupName) -> void diff --git a/code/AssetLib/X3D/X3DImporter_Postprocess.cpp b/code/AssetLib/X3D/X3DImporter_Postprocess.cpp index 993aff02c..a8bf332e5 100644 --- a/code/AssetLib/X3D/X3DImporter_Postprocess.cpp +++ b/code/AssetLib/X3D/X3DImporter_Postprocess.cpp @@ -178,7 +178,7 @@ void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeEl break; default: - throw DeadlyImportError("Postprocess_BuildLight. Unknown type of light: " + to_string(pNodeElement.Type) + "."); + throw DeadlyImportError("Postprocess_BuildLight. Unknown type of light: ", to_string(pNodeElement.Type), "."); } pSceneLightList.push_back(new_light); @@ -300,7 +300,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate) MeshGeometry_AddTexCoord(**pMesh, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value); else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of ElevationGrid: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of ElevationGrid: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -337,7 +337,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate) MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value); else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedFaceSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedFaceSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -368,7 +368,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate) {} // skip because already read when mesh created. else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedLineSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedLineSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -458,7 +458,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate) {} // skip because already read when mesh created. else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of PointSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of PointSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -488,7 +488,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate) {} // skip because already read when mesh created. else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of LineSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of LineSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -525,7 +525,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate) MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value); else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TrianlgeFanSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TriangleFanSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -569,7 +569,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate) MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value); else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TrianlgeSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TrianlgeSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. @@ -604,13 +604,13 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate) MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value); else - throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TriangleStripSet: " + to_string((*ch_it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TriangleStripSet: ", to_string((*ch_it)->Type), "."); }// for(std::list::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it) return;// mesh is build, nothing to do anymore. }// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleStripSet) - throw DeadlyImportError("Postprocess_BuildMesh. Unknown mesh type: " + to_string(pNodeElement.Type) + "."); + throw DeadlyImportError("Postprocess_BuildMesh. Unknown mesh type: ", to_string(pNodeElement.Type), "."); } void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list& pSceneMeshList, @@ -672,7 +672,7 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle } else if(!PostprocessHelper_ElementIsMetadata((*it)->Type))// skip metadata { - throw DeadlyImportError("Postprocess_BuildNode. Unknown type: " + to_string((*it)->Type) + "."); + throw DeadlyImportError("Postprocess_BuildNode. Unknown type: ", to_string((*it)->Type), "."); } }// for(std::list::const_iterator it = chit_begin; it != chit_end; it++) diff --git a/code/AssetLib/XGL/XGLLoader.cpp b/code/AssetLib/XGL/XGLLoader.cpp index 938f2a321..7af5aab94 100644 --- a/code/AssetLib/XGL/XGLLoader.cpp +++ b/code/AssetLib/XGL/XGLLoader.cpp @@ -144,7 +144,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, // check whether we can read from the file if (stream.get() == nullptr) { - throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile + ""); + throw DeadlyImportError("Failed to open XGL/ZGL file ", pFile, ""); } // see if its compressed, if so uncompress it diff --git a/code/AssetLib/glTF/glTFAsset.inl b/code/AssetLib/glTF/glTFAsset.inl index 472be41cf..217bc8d47 100644 --- a/code/AssetLib/glTF/glTFAsset.inl +++ b/code/AssetLib/glTF/glTFAsset.inl @@ -235,15 +235,15 @@ Ref LazyDict::Get(const char *id) { // read it from the JSON object if (!mDict) { - throw DeadlyImportError("GLTF: Missing section \"" + std::string(mDictId) + "\""); + throw DeadlyImportError("GLTF: Missing section \"", std::string(mDictId), "\""); } Value::MemberIterator obj = mDict->FindMember(id); if (obj == mDict->MemberEnd()) { - throw DeadlyImportError("GLTF: Missing object with id \"" + std::string(id) + "\" in \"" + mDictId + "\""); + throw DeadlyImportError("GLTF: Missing object with id \"", std::string(id), "\" in \"", mDictId, "\""); } if (!obj->value.IsObject()) { - throw DeadlyImportError("GLTF: Object with id \"" + std::string(id) + "\" is not a JSON object"); + throw DeadlyImportError("GLTF: Object with id \"", std::string(id), "\" is not a JSON object"); } // create an instance of the given type @@ -317,13 +317,13 @@ inline void Buffer::Read(Value &obj, Asset &r) { this->mData.reset(data, std::default_delete()); if (statedLength > 0 && this->byteLength != statedLength) { - throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) + - " bytes, but found " + to_string(dataURI.dataLength)); + throw DeadlyImportError("GLTF: buffer \"", id, "\", expected ", to_string(statedLength), + " bytes, but found ", to_string(dataURI.dataLength)); } } else { // assume raw data if (statedLength != dataURI.dataLength) { - throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) + - " bytes, but found " + to_string(dataURI.dataLength)); + throw DeadlyImportError("GLTF: buffer \"", id, "\", expected ", to_string(statedLength), + " bytes, but found ", to_string(dataURI.dataLength)); } this->mData.reset(new uint8_t[dataURI.dataLength], std::default_delete()); @@ -339,9 +339,9 @@ inline void Buffer::Read(Value &obj, Asset &r) { delete file; if (!ok) - throw DeadlyImportError("GLTF: error while reading referenced file \"" + std::string(uri) + "\""); + throw DeadlyImportError("GLTF: error while reading referenced file \"", std::string(uri), "\""); } else { - throw DeadlyImportError("GLTF: could not open referenced file \"" + std::string(uri) + "\""); + throw DeadlyImportError("GLTF: could not open referenced file \"", std::string(uri), "\""); } } } @@ -373,7 +373,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; ai_snprintf(val, val_size, AI_SIZEFMT, pOffset); - throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region."); + throw DeadlyImportError("GLTF: incorrect offset value (", val, ") for marking encoded region."); } // Check length @@ -383,7 +383,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; ai_snprintf(val, val_size, AI_SIZEFMT "/" AI_SIZEFMT, pOffset, pEncodedData_Length); - throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range."); + throw DeadlyImportError("GLTF: encoded region with offset/length (", val, ") is out of range."); } // Add new region @@ -403,7 +403,7 @@ inline void Buffer::EncodedRegion_SetCurrent(const std::string &pID) { } } - throw DeadlyImportError("GLTF: EncodedRegion with ID: \"" + pID + "\" not found."); + throw DeadlyImportError("GLTF: EncodedRegion with ID: \"", pID, "\" not found."); } inline bool Buffer::ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t *pReplace_Data, const size_t pReplace_Count) { @@ -851,7 +851,7 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) { /************** Read data from JSON-document **************/ #define MESH_READ_COMPRESSEDDATA_MEMBER(pFieldName, pOut) \ if (!ReadMember(*comp_data, pFieldName, pOut)) { \ - throw DeadlyImportError(std::string("GLTF: \"compressedData\" must has \"") + pFieldName + "\"."); \ + throw DeadlyImportError("GLTF: \"compressedData\" must has \"", pFieldName, "\"."); \ } const char *mode_str; @@ -880,7 +880,7 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) { else if (strcmp(mode_str, "ascii") == 0) ext_o3dgc->Binary = false; else - throw DeadlyImportError(std::string("GLTF: for compressed data supported modes is: \"ascii\", \"binary\". Not the: \"") + mode_str + "\"."); + throw DeadlyImportError("GLTF: for compressed data supported modes is: \"ascii\", \"binary\". Not the: \"", mode_str, "\"."); /************************ Decoding ************************/ Decode_O3DGC(*ext_o3dgc, pAsset_Root); @@ -888,7 +888,7 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) { } // if(it_memb->name.GetString() == "Open3DGC-compression") else { - throw DeadlyImportError(std::string("GLTF: Unknown mesh extension: \"") + it_memb->name.GetString() + "\"."); + throw DeadlyImportError("GLTF: Unknown mesh extension: \"", it_memb->name.GetString(), "\"."); } } // for(Value::MemberIterator it_memb = json_extensions->MemberBegin(); it_memb != json_extensions->MemberEnd(); json_extensions++) #endif @@ -923,24 +923,24 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG size_t size_coordindex = ifs.GetNCoordIndex() * 3; // See float attributes note. if (primitives[0].indices->count != size_coordindex) - throw DeadlyImportError("GLTF: Open3DGC. Compressed indices count (" + to_string(size_coordindex) + - ") not equal to uncompressed (" + to_string(primitives[0].indices->count) + ")."); + throw DeadlyImportError("GLTF: Open3DGC. Compressed indices count (", to_string(size_coordindex), + ") not equal to uncompressed (", to_string(primitives[0].indices->count), ")."); size_coordindex *= sizeof(IndicesType); // Coordinates size_t size_coord = ifs.GetNCoord(); // See float attributes note. if (primitives[0].attributes.position[0]->count != size_coord) - throw DeadlyImportError("GLTF: Open3DGC. Compressed positions count (" + to_string(size_coord) + - ") not equal to uncompressed (" + to_string(primitives[0].attributes.position[0]->count) + ")."); + throw DeadlyImportError("GLTF: Open3DGC. Compressed positions count (", to_string(size_coord), + ") not equal to uncompressed (", to_string(primitives[0].attributes.position[0]->count), ")."); size_coord *= 3 * sizeof(float); // Normals size_t size_normal = ifs.GetNNormal(); // See float attributes note. if (primitives[0].attributes.normal[0]->count != size_normal) - throw DeadlyImportError("GLTF: Open3DGC. Compressed normals count (" + to_string(size_normal) + - ") not equal to uncompressed (" + to_string(primitives[0].attributes.normal[0]->count) + ")."); + throw DeadlyImportError("GLTF: Open3DGC. Compressed normals count (", to_string(size_normal), + ") not equal to uncompressed (", to_string(primitives[0].attributes.normal[0]->count), ")."); size_normal *= 3 * sizeof(float); // Additional attributes. @@ -961,8 +961,8 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG // Check situation when encoded data contain texture coordinates but primitive not. if (idx_texcoord < primitives[0].attributes.texcoord.size()) { if (primitives[0].attributes.texcoord[idx]->count != tval) - throw DeadlyImportError("GLTF: Open3DGC. Compressed texture coordinates count (" + to_string(tval) + - ") not equal to uncompressed (" + to_string(primitives[0].attributes.texcoord[idx]->count) + ")."); + throw DeadlyImportError("GLTF: Open3DGC. Compressed texture coordinates count (", to_string(tval), + ") not equal to uncompressed (", to_string(primitives[0].attributes.texcoord[idx]->count), ")."); idx_texcoord++; } else { @@ -971,7 +971,7 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG break; default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast(idx)))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: ", to_string(ifs.GetFloatAttributeType(static_cast(idx)))); } tval *= ifs.GetFloatAttributeDim(static_cast(idx)) * sizeof(o3dgc::Real); // After checking count of objects we can get size of array. @@ -990,7 +990,7 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG break; default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast(idx)))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: ", to_string(ifs.GetIntAttributeType(static_cast(idx)))); } tval *= ifs.GetIntAttributeDim(static_cast(idx)) * sizeof(long); // See float attributes note. @@ -1025,7 +1025,7 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG break; default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(static_cast(idx)))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: ", to_string(ifs.GetFloatAttributeType(static_cast(idx)))); } } @@ -1039,7 +1039,7 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG // ifs.SetIntAttribute(idx, (long* const)(decoded_data + get_buf_offset(primitives[0].attributes.joint))); default: - throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(static_cast(idx)))); + throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: ", to_string(ifs.GetIntAttributeType(static_cast(idx)))); } } @@ -1231,7 +1231,7 @@ inline void AssetMetadata::Read(Document &doc) { } if (version.empty() || version[0] != '1') { - throw DeadlyImportError("GLTF: Unsupported glTF version: " + version); + throw DeadlyImportError("GLTF: Unsupported glTF version: ", version); } } @@ -1309,7 +1309,7 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) { if (doc.HasParseError()) { char buffer[32]; ai_snprintf(buffer, 32, "%d", static_cast(doc.GetErrorOffset())); - throw DeadlyImportError(std::string("GLTF: JSON parse error, offset ") + buffer + ": " + GetParseError_En(doc.GetParseError())); + throw DeadlyImportError("GLTF: JSON parse error, offset ", buffer, ": ", GetParseError_En(doc.GetParseError())); } if (!doc.IsObject()) { diff --git a/code/AssetLib/glTF/glTFImporter.cpp b/code/AssetLib/glTF/glTFImporter.cpp index c106acf21..512a4334b 100644 --- a/code/AssetLib/glTF/glTFImporter.cpp +++ b/code/AssetLib/glTF/glTFImporter.cpp @@ -234,7 +234,7 @@ void glTFImporter::ImportMeshes(glTF::Asset &r) { buf->EncodedRegion_SetCurrent(mesh.id); } else { - throw DeadlyImportError("GLTF: Can not import mesh: unknown mesh extension (code: \"" + to_string(cur_ext->Type) + + throw DeadlyImportError("GLTF: Can not import mesh: unknown mesh extension (code: \"", to_string(cur_ext->Type), "\"), only Open3DGC is supported."); } } diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 763a6ac37..403ac8174 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -202,7 +202,7 @@ inline unsigned int ComponentTypeSize(ComponentType t) { case ComponentType_UNSIGNED_BYTE: return 1; default: - throw DeadlyImportError("GLTF: Unsupported Component Type " + to_string(t)); + throw DeadlyImportError("GLTF: Unsupported Component Type ", to_string(t)); } } diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index 2dfe2f41e..be23673ad 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -269,21 +269,21 @@ Ref LazyDict::Retrieve(unsigned int i) { // read it from the JSON object if (!mDict) { - throw DeadlyImportError("GLTF: Missing section \"" + std::string(mDictId) + "\""); + throw DeadlyImportError("GLTF: Missing section \"", std::string(mDictId), "\""); } if (!mDict->IsArray()) { - throw DeadlyImportError("GLTF: Field is not an array \"" + std::string(mDictId) + "\""); + throw DeadlyImportError("GLTF: Field is not an array \"", std::string(mDictId), "\""); } Value &obj = (*mDict)[i]; if (!obj.IsObject()) { - throw DeadlyImportError("GLTF: Object at index \"" + to_string(i) + "\" is not a JSON object"); + throw DeadlyImportError("GLTF: Object at index \"", to_string(i), "\" is not a JSON object"); } if (mRecursiveReferenceCheck.find(i) != mRecursiveReferenceCheck.end()) { - throw DeadlyImportError("GLTF: Object at index \"" + to_string(i) + "\" has recursive reference to itself"); + throw DeadlyImportError("GLTF: Object at index \"", to_string(i), "\" has recursive reference to itself"); } mRecursiveReferenceCheck.insert(i); @@ -381,13 +381,13 @@ inline void Buffer::Read(Value &obj, Asset &r) { this->mData.reset(data, std::default_delete()); if (statedLength > 0 && this->byteLength != statedLength) { - throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) + - " bytes, but found " + to_string(dataURI.dataLength)); + throw DeadlyImportError("GLTF: buffer \"", id, "\", expected ", to_string(statedLength), + " bytes, but found ", to_string(dataURI.dataLength)); } } else { // assume raw data if (statedLength != dataURI.dataLength) { - throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) + - " bytes, but found " + to_string(dataURI.dataLength)); + throw DeadlyImportError("GLTF: buffer \"", id, "\", expected ", to_string(statedLength), + " bytes, but found ", to_string(dataURI.dataLength)); } this->mData.reset(new uint8_t[dataURI.dataLength], std::default_delete()); @@ -403,9 +403,9 @@ inline void Buffer::Read(Value &obj, Asset &r) { delete file; if (!ok) - throw DeadlyImportError("GLTF: error while reading referenced file \"" + std::string(uri) + "\""); + throw DeadlyImportError("GLTF: error while reading referenced file \"", std::string(uri), "\""); } else { - throw DeadlyImportError("GLTF: could not open referenced file \"" + std::string(uri) + "\""); + throw DeadlyImportError("GLTF: could not open referenced file \"", std::string(uri), "\""); } } } @@ -437,7 +437,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; ai_snprintf(val, val_size, AI_SIZEFMT, pOffset); - throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region."); + throw DeadlyImportError("GLTF: incorrect offset value (", val, ") for marking encoded region."); } // Check length @@ -447,7 +447,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; ai_snprintf(val, val_size, AI_SIZEFMT "/" AI_SIZEFMT, pOffset, pEncodedData_Length); - throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range."); + throw DeadlyImportError("GLTF: encoded region with offset/length (", val, ") is out of range."); } // Add new region @@ -467,7 +467,7 @@ inline void Buffer::EncodedRegion_SetCurrent(const std::string &pID) { } } - throw DeadlyImportError("GLTF: EncodedRegion with ID: \"" + pID + "\" not found."); + throw DeadlyImportError("GLTF: EncodedRegion with ID: \"", pID, "\" not found."); } inline bool Buffer::ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t *pReplace_Data, const size_t pReplace_Count) { @@ -1458,7 +1458,7 @@ inline void AssetMetadata::Read(Document &doc) { } if (version.empty() || version[0] != '2') { - throw DeadlyImportError("GLTF: Unsupported glTF version: " + version); + throw DeadlyImportError("GLTF: Unsupported glTF version: ", version); } } @@ -1570,7 +1570,7 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) { if (doc.HasParseError()) { char buffer[32]; ai_snprintf(buffer, 32, "%d", static_cast(doc.GetErrorOffset())); - throw DeadlyImportError(std::string("GLTF: JSON parse error, offset ") + buffer + ": " + GetParseError_En(doc.GetParseError())); + throw DeadlyImportError("GLTF: JSON parse error, offset ", buffer, ": ", GetParseError_En(doc.GetParseError())); } if (!doc.IsObject()) { diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 00c647ed2..972154b5f 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -668,7 +668,7 @@ void glTF2Importer::ImportMeshes(glTF2::Asset &r) { } if (actualNumFaces == 0) { - throw DeadlyImportError(std::string("Mesh \"") + aim->mName.C_Str() + "\" has no faces"); + throw DeadlyImportError("Mesh \"", aim->mName.C_Str(), "\" has no faces"); } aim->mNumFaces = actualNumFaces; ai_assert(CheckValidFacesIndices(faces, actualNumFaces, aim->mNumVertices)); diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index a288e397d..e7392d9e5 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -85,7 +85,7 @@ AI_WONT_RETURN void ValidateDSProcess::ReportError(const char *msg, ...) { va_end(args); - throw DeadlyImportError("Validation failed: " + std::string(szBuffer, iLen)); + throw DeadlyImportError("Validation failed: ", std::string(szBuffer, iLen)); } // ------------------------------------------------------------------------------------------------ void ValidateDSProcess::ReportWarning(const char *msg, ...) { diff --git a/doc/dox.h b/doc/dox.h index 910e77eae..a4516dc7a 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -1626,7 +1626,7 @@ void xxxxImporter::InternReadFile( const std::string& pFile, // Check whether we can read from the file if( file.get() == NULL) { - throw DeadlyImportError( "Failed to open xxxx file " + pFile + "."); + throw DeadlyImportError( "Failed to open xxxx file ", pFile, "."); } // Your task: fill pScene diff --git a/include/assimp/irrXMLWrapper.h b/include/assimp/irrXMLWrapper.h index 52c174791..ef2b336ac 100644 --- a/include/assimp/irrXMLWrapper.h +++ b/include/assimp/irrXMLWrapper.h @@ -64,7 +64,7 @@ namespace Assimp { * // open the file * std::unique_ptr file( pIOHandler->Open( pFile)); * if( file.get() == nullptr ) { - * throw DeadlyImportError( "Failed to open file " + pFile + "."); + * throw DeadlyImportError( "Failed to open file ", pFile, "."); * } * * // generate a XML reader for it