1 #ifndef REPLXX_CONVERSION_HXX_INCLUDED 2 #define REPLXX_CONVERSION_HXX_INCLUDED 1 3 4 #ifdef __has_include 5 #if __has_include( <version> ) 6 #include <version> 7 #endif 8 #endif 9 10 typedef enum { 11 conversionOK, /* conversion successful */ 12 sourceExhausted, /* partial character in source, but hit end */ 13 targetExhausted, /* insuff. room in target for conversion */ 14 sourceIllegal /* source sequence is illegal/malformed */ 15 } ConversionResult; 16 17 #if ! ( defined( __cpp_lib_char8_t ) || ( defined( __clang_major__ ) && ( __clang_major__ >= 8 ) && ( __cplusplus > 201703L ) ) ) 18 namespace replxx { 19 typedef unsigned char char8_t; 20 } 21 #endif 22 23 namespace replxx { 24 25 ConversionResult copyString8to32( char32_t* dst, int dstSize, int& dstCount, char const* src ); 26 ConversionResult copyString8to32( char32_t* dst, int dstSize, int& dstCount, char8_t const* src ); 27 int copyString32to8( char* dst, int dstSize, char32_t const* src, int srcSize ); 28 29 namespace locale { 30 extern bool is8BitEncoding; 31 } 32 33 } 34 35 #endif 36