diff options
Diffstat (limited to 'contrib/replxx/src/conversion.hxx')
-rw-r--r-- | contrib/replxx/src/conversion.hxx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/contrib/replxx/src/conversion.hxx b/contrib/replxx/src/conversion.hxx index 1cb2d450d..6587ad0e2 100644 --- a/contrib/replxx/src/conversion.hxx +++ b/contrib/replxx/src/conversion.hxx @@ -1,20 +1,25 @@ #ifndef REPLXX_CONVERSION_HXX_INCLUDED #define REPLXX_CONVERSION_HXX_INCLUDED 1 -namespace replxx { +#include "ConvertUTF.h" + +#ifdef __has_include +#if __has_include( <version> ) +#include <version> +#endif +#endif +#if ! ( defined( __cpp_lib_char8_t ) || ( defined( __clang_major__ ) && ( __clang_major__ >= 8 ) && ( __cplusplus > 201703L ) ) ) +namespace replxx { typedef unsigned char char8_t; +} +#endif -typedef enum { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ -} ConversionResult; +namespace replxx { ConversionResult copyString8to32( char32_t* dst, int dstSize, int& dstCount, char const* src ); ConversionResult copyString8to32( char32_t* dst, int dstSize, int& dstCount, char8_t const* src ); -void copyString32to8( char* dst, int dstSize, char32_t const* src, int srcSize, int* dstCount = nullptr ); +int copyString32to8( char* dst, int dstSize, char32_t const* src, int srcSize ); namespace locale { extern bool is8BitEncoding; |