diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:55:24 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-07 18:55:24 +0000 |
commit | 1e582c4e99fe08c70c75fef7cd8ed22343253297 (patch) | |
tree | b0047c655d52e4e479ceb73c713414f8d0744c38 /zen/utf.h | |
parent | Merge branch 'b11.24' into 'master' (diff) | |
parent | add upstream 11.25 (diff) | |
download | FreeFileSync-1e582c4e99fe08c70c75fef7cd8ed22343253297.tar.gz FreeFileSync-1e582c4e99fe08c70c75fef7cd8ed22343253297.tar.bz2 FreeFileSync-1e582c4e99fe08c70c75fef7cd8ed22343253297.zip |
Merge branch 'b11.25' into 'master'11.25
add upstream 11.25
See merge request opensource-tracking/FreeFileSync!48
Diffstat (limited to 'zen/utf.h')
-rw-r--r-- | zen/utf.h | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -222,15 +222,9 @@ private: //---------------------------------------------------------------------------------------------------------------- -template <class Function> inline void codePointToUtf(CodePoint cp, Function writeOutput, std::integral_constant<int, 1>) { codePointToUtf8 (cp, writeOutput); } //UTF8-char -template <class Function> inline void codePointToUtf(CodePoint cp, Function writeOutput, std::integral_constant<int, 2>) { codePointToUtf16(cp, writeOutput); } //Windows: UTF16-wchar_t -template <class Function> inline void codePointToUtf(CodePoint cp, Function writeOutput, std::integral_constant<int, 4>) { writeOutput(cp); } //other OS: UTF32-wchar_t - -template <class CharType, class Function> inline -void codePointToUtf(CodePoint cp, Function writeOutput) //"writeOutput" is a unary function taking a CharType -{ - return codePointToUtf(cp, writeOutput, std::integral_constant<int, sizeof(CharType)>()); -} +template <class Function> inline void codePointToUtfImpl(CodePoint cp, Function writeOutput, std::integral_constant<int, 1>) { codePointToUtf8 (cp, writeOutput); } //UTF8-char +template <class Function> inline void codePointToUtfImpl(CodePoint cp, Function writeOutput, std::integral_constant<int, 2>) { codePointToUtf16(cp, writeOutput); } //Windows: UTF16-wchar_t +template <class Function> inline void codePointToUtfImpl(CodePoint cp, Function writeOutput, std::integral_constant<int, 4>) { writeOutput(cp); } //other OS: UTF32-wchar_t //---------------------------------------------------------------------------------------------------------------- @@ -277,9 +271,18 @@ private: }; } + template <class CharType> using UtfDecoder = impl::UtfDecoderImpl<CharType, sizeof(CharType)>; + +template <class CharType, class Function> inline +void codePointToUtf(impl::CodePoint cp, Function writeOutput) //"writeOutput" is a unary function taking a CharType +{ + return impl::codePointToUtfImpl(cp, writeOutput, std::integral_constant<int, sizeof(CharType)>()); +} + + //------------------------------------------------------------------------------------------- template <class UtfString> inline |