diff options
author | Brad King <brad.king@kitware.com> | 2013-11-25 16:19:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-25 16:19:42 (GMT) |
commit | f668112039798f5ebc955e127f9c3e4e7cdb5cc4 (patch) | |
tree | c08b9117d4d6288c7dd34af6cbffd7e0314188a7 /Source/kwsys/Encoding.hxx.in | |
parent | da6b86f4f031b189768dc474721145a1b99f71ea (diff) | |
parent | 704ab3d24827cfe5754a00028086f21503c2e08b (diff) | |
download | CMake-f668112039798f5ebc955e127f9c3e4e7cdb5cc4.zip CMake-f668112039798f5ebc955e127f9c3e4e7cdb5cc4.tar.gz CMake-f668112039798f5ebc955e127f9c3e4e7cdb5cc4.tar.bz2 |
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/Encoding.hxx.in')
-rw-r--r-- | Source/kwsys/Encoding.hxx.in | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in new file mode 100644 index 0000000..60a4a8e --- /dev/null +++ b/Source/kwsys/Encoding.hxx.in @@ -0,0 +1,56 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef @KWSYS_NAMESPACE@_Encoding_hxx +#define @KWSYS_NAMESPACE@_Encoding_hxx + +#include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <@KWSYS_NAMESPACE@/stl/string> + +/* Define these macros temporarily to keep the code readable. */ +#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# define kwsys_stl @KWSYS_NAMESPACE@_stl +#endif + +namespace @KWSYS_NAMESPACE@ +{ +class @KWSYS_NAMESPACE@_EXPORT Encoding +{ +public: + /** + * Convert between char and wchar_t + */ + +#if @KWSYS_NAMESPACE@_STL_HAS_WSTRING + + // Convert a narrow string to a wide string. + // On Windows, UTF-8 is assumed, and on other platforms, + // the current locale is assumed. + static kwsys_stl::wstring ToWide(const kwsys_stl::string& str); + static kwsys_stl::wstring ToWide(const char* str); + + // Convert a wide string to a narrow string. + // On Windows, UTF-8 is assumed, and on other platforms, + // the current locale is assumed. + static kwsys_stl::string ToNarrow(const kwsys_stl::wstring& str); + static kwsys_stl::string ToNarrow(const wchar_t* str); + +#endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING + +}; // class Encoding +} // namespace @KWSYS_NAMESPACE@ + +/* Undefine temporary macros. */ +#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsys_stl +#endif + +#endif |