From c1e90feb0a0de125ac6e3e267f6cedf39743ab1a Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 26 Apr 2013 17:07:18 +0200 Subject: [PATCH] Add utility functions to convert between string/wstring --- src/Base/Tools.cpp | 20 ++++++++++++++++++++ src/Base/Tools.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/Base/Tools.cpp b/src/Base/Tools.cpp index 43f845f0c..4cbab7b9d 100644 --- a/src/Base/Tools.cpp +++ b/src/Base/Tools.cpp @@ -24,6 +24,8 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include +# include #endif # include @@ -122,6 +124,24 @@ std::string Base::Tools::getIdentifier(const std::string& name) return CleanName; } +std::wstring Base::Tools::widen(const std::string& str) +{ + std::wostringstream wstm; + const std::ctype& ctfacet = std::use_facet< std::ctype >(wstm.getloc()); + for (size_t i=0; i& ctfacet = std::use_facet< std::ctype >(stm.getloc()); + for (size_t i=0; i&,int d=0); static std::string addNumber(const std::string&, unsigned int, int d=0); static std::string getIdentifier(const std::string&); + static std::wstring widen(const std::string& str); + static std::string narrow(const std::wstring& str); }; } // namespace Base