| 1 |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| 2 |
file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ |
| 3 |
#ifndef @KWSYS_NAMESPACE@_Encoding_h |
| 4 |
#define @KWSYS_NAMESPACE@_Encoding_h |
| 5 |
|
| 6 |
#include <@KWSYS_NAMESPACE@/Configure.h> |
| 7 |
|
| 8 |
#include <wchar.h> |
| 9 |
|
| 10 |
/* Redefine all public interface symbol names to be in the proper |
| 11 |
namespace. These macros are used internally to kwsys only, and are |
| 12 |
not visible to user code. Use kwsysHeaderDump.pl to reproduce |
| 13 |
these macros after making changes to the interface. */ |
| 14 |
#if !defined(KWSYS_NAMESPACE) |
| 15 |
# define kwsys_ns(x) @KWSYS_NAMESPACE@##x |
| 16 |
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT |
| 17 |
#endif |
| 18 |
#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS |
| 19 |
# define kwsysEncoding kwsys_ns(Encoding) |
| 20 |
# define kwsysEncoding_mbstowcs kwsys_ns(Encoding_mbstowcs) |
| 21 |
# define kwsysEncoding_DupToWide kwsys_ns(Encoding_DupToWide) |
| 22 |
# define kwsysEncoding_wcstombs kwsys_ns(Encoding_wcstombs) |
| 23 |
# define kwsysEncoding_DupToNarrow kwsys_ns(Encoding_DupToNarrow) |
| 24 |
#endif |
| 25 |
|
| 26 |
#if defined(__cplusplus) |
| 27 |
extern "C" { |
| 28 |
#endif |
| 29 |
|
| 30 |
/* Convert a narrow string to a wide string. |
| 31 |
On Windows, UTF-8 is assumed, and on other platforms, |
| 32 |
the current locale is assumed. |
| 33 |
*/ |
| 34 |
kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* src, |
| 35 |
size_t n); |
| 36 |
|
| 37 |
/* Convert a narrow string to a wide string. |
| 38 |
This can return NULL if the conversion fails. */ |
| 39 |
kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(const char* src); |
| 40 |
|
| 41 |
/* Convert a wide string to a narrow string. |
| 42 |
On Windows, UTF-8 is assumed, and on other platforms, |
| 43 |
the current locale is assumed. */ |
| 44 |
kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* src, |
| 45 |
size_t n); |
| 46 |
|
| 47 |
/* Convert a wide string to a narrow string. |
| 48 |
This can return NULL if the conversion fails. */ |
| 49 |
kwsysEXPORT char* kwsysEncoding_DupToNarrow(const wchar_t* str); |
| 50 |
|
| 51 |
#if defined(__cplusplus) |
| 52 |
} /* extern "C" */ |
| 53 |
#endif |
| 54 |
|
| 55 |
/* If we are building a kwsys .c or .cxx file, let it use these macros. |
| 56 |
Otherwise, undefine them to keep the namespace clean. */ |
| 57 |
#if !defined(KWSYS_NAMESPACE) |
| 58 |
# undef kwsys_ns |
| 59 |
# undef kwsysEXPORT |
| 60 |
# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS |
| 61 |
# undef kwsysEncoding |
| 62 |
# undef kwsysEncoding_mbstowcs |
| 63 |
# undef kwsysEncoding_DupToWide |
| 64 |
# undef kwsysEncoding_wcstombs |
| 65 |
# undef kwsysEncoding_DupToNarrow |
| 66 |
# endif |
| 67 |
#endif |
| 68 |
|
| 69 |
#endif |