瀏覽代碼

Replace duplicated trim (#5613)

Kim Kulling 1 年之前
父節點
當前提交
75a10fedd0
共有 3 個文件被更改,包括 2 次插入18 次删除
  1. 1 1
      code/AssetLib/Obj/ObjFileMtlImporter.cpp
  2. 1 1
      code/AssetLib/Obj/ObjFileParser.cpp
  3. 0 16
      code/AssetLib/Obj/ObjTools.h

+ 1 - 1
code/AssetLib/Obj/ObjFileMtlImporter.cpp

@@ -343,7 +343,7 @@ void ObjFileMtlImporter::createMaterial() {
         }
     }
 
-    name = trim_whitespaces(name);
+    name = ai_trim(name);
 
     std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->mMaterialMap.find(name);
     if (m_pModel->mMaterialMap.end() == it) {

+ 1 - 1
code/AssetLib/Obj/ObjFileParser.cpp

@@ -577,7 +577,7 @@ void ObjFileParser::getMaterialDesc() {
 
     // Get name
     std::string strName(pStart, &(*m_DataIt));
-    strName = trim_whitespaces(strName);
+    strName = ai_trim(strName);
     if (strName.empty()) {
         skip = true;
     }

+ 0 - 16
code/AssetLib/Obj/ObjTools.h

@@ -247,22 +247,6 @@ inline char_t getFloat(char_t it, char_t end, ai_real &value) {
     return it;
 }
 
-/**
- *  @brief  Will remove white-spaces for a string.
- *  @param[in] str  The string to clean
- *  @return The trimmed string.
- */
-template <class string_type>
-inline string_type trim_whitespaces(string_type str) {
-    while (!str.empty() && IsSpace(str[0])) {
-        str.erase(0);
-    }
-    while (!str.empty() && IsSpace(str[str.length() - 1])) {
-        str.erase(str.length() - 1);
-    }
-    return str;
-}
-
 /**
  *  @brief  Checks for a line-end.
  *  @param[in] it   Current iterator in string.