X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Tools.cpp;h=1baf30d0c5ef0fc806789b4158acc57b6ca87227;hb=08a991619fbd4f803d52e698dd48f0f7f46d118e;hp=8922813f0e401fc32c4ab68b3d481b80fd022611;hpb=d5d78920316491975a67f76578982b401cdfe71d;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 8922813f0..1baf30d0c 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -38,20 +38,8 @@ #include #include -// To support old types of GCC (less than 5.0), check the wide-string conversion is working -#if (__cplusplus >= 201103L || _MSVC_LANG >= 201103L) && \ - (__cplusplus >= 201402L || !defined(__GLIBCXX__) || \ - (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4)) -#define HAVE_WORKING_WIDESTRING 1 -#else -#define HAVE_WORKING_WIDESTRING 0 -#endif - -#if HAVE_WORKING_WIDESTRING -#include -#endif - #include +#include #include #include @@ -185,7 +173,7 @@ std::string getFeatureError(const FeaturePtr& theFeature) ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, const std::string& theName) { - std::wstring aName = toWString(theName); + std::wstring aName = Locale::Convert::toWString(theName); for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) { ObjectPtr anObject = theDocument->object(theGroup, anIndex); if (anObject->data()->name() == aName) @@ -1117,41 +1105,5 @@ std::list referencedFeatures( } // LCOV_EXCL_STOP -std::string toString(const std::wstring& theWStr) -{ -#if HAVE_WORKING_WIDESTRING - static std::wstring_convert > aConvertor; - return aConvertor.to_bytes(theWStr); -#else - char* aBuf = new char[2 * (theWStr.size() + 1)]; - size_t aNbChars = std::wcstombs(aBuf, theWStr.c_str(), theWStr.size()); - if (aNbChars != (size_t)-1) - aBuf[aNbChars] = '\0'; - std::string aStr(aBuf); - delete[] aBuf; - return aStr; -#endif -} - -/*! Converts a byte string to an extended string -* \param theStr a byte string -*/ -std::wstring toWString(const std::string& theStr) -{ -#if HAVE_WORKING_WIDESTRING - static std::wstring_convert > aConvertor; - return aConvertor.from_bytes(theStr); -#else - wchar_t* aBuf = new wchar_t[theStr.size() + 1]; - size_t aNbWChars = std::mbstowcs(aBuf, theStr.c_str(), theStr.size()); - if (aNbWChars != (size_t)-1) - aBuf[aNbWChars] = L'\0'; - std::wstring aWStr(aBuf); - delete[] aBuf; - return aWStr; -#endif -} - - } // namespace ModelAPI_Tools