aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/charset/iconv.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/charset/iconv.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset/iconv.h')
-rw-r--r--library/cpp/charset/iconv.h82
1 files changed, 41 insertions, 41 deletions
diff --git a/library/cpp/charset/iconv.h b/library/cpp/charset/iconv.h
index ac13539347..58188bb33d 100644
--- a/library/cpp/charset/iconv.h
+++ b/library/cpp/charset/iconv.h
@@ -10,66 +10,66 @@ namespace NICONVPrivate {
inline const char* CharsetName(ECharset code) {
return NameByCharset(code);
}
-
+
inline const char* CharsetName(const char* code) {
return code;
}
- template <int size>
+ template <int size>
inline const char* UnicodeNameBySize();
- template <>
+ template <>
inline const char* UnicodeNameBySize<1>() {
return "UTF-8";
}
-
- template <>
+
+ template <>
inline const char* UnicodeNameBySize<2>() {
return "UTF-16LE";
}
-
- template <>
+
+ template <>
inline const char* UnicodeNameBySize<4>() {
return "UCS-4LE";
}
- template <class C>
+ template <class C>
inline const char* UnicodeName() {
return UnicodeNameBySize<sizeof(C)>();
}
class TDescriptor : NNonCopyable::TNonCopyable {
private:
- void* Descriptor_;
- const char* From_;
- const char* To_;
+ void* Descriptor_;
+ const char* From_;
+ const char* To_;
public:
template <class TFrom, class TTo>
inline TDescriptor(TFrom from, TTo to)
- : TDescriptor(CharsetName(from), CharsetName(to))
+ : TDescriptor(CharsetName(from), CharsetName(to))
{
}
- TDescriptor(const char* from, const char* to);
-
- ~TDescriptor();
-
- inline void* Get() const {
- return Descriptor_;
- }
-
- inline bool Invalid() const {
- return Descriptor_ == (void*)(-1);
+ TDescriptor(const char* from, const char* to);
+
+ ~TDescriptor();
+
+ inline void* Get() const {
+ return Descriptor_;
}
- inline const char* From() const noexcept {
- return From_;
+ inline bool Invalid() const {
+ return Descriptor_ == (void*)(-1);
}
- inline const char* To() const noexcept {
- return To_;
+ inline const char* From() const noexcept {
+ return From_;
}
+
+ inline const char* To() const noexcept {
+ return To_;
+ }
};
template <class TFrom, class TTo>
@@ -79,43 +79,43 @@ namespace NICONVPrivate {
return !descriptor.Invalid();
}
- size_t RecodeImpl(const TDescriptor& descriptor, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
- void DoRecode(const TDescriptor& descriptor, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
+ size_t RecodeImpl(const TDescriptor& descriptor, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
+ void DoRecode(const TDescriptor& descriptor, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
template <class TFrom, class TTo>
inline void Recode(TFrom from, TTo to, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
TDescriptor descriptor(from, to);
- DoRecode(descriptor, in, out, inSize, outSize, read, written);
+ DoRecode(descriptor, in, out, inSize, outSize, read, written);
}
- template <class TCharType>
- inline void RecodeToUnicode(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
+ template <class TCharType>
+ inline void RecodeToUnicode(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
const size_t charSize = sizeof(TCharType);
Recode(from, UnicodeName<TCharType>(), in, reinterpret_cast<char*>(out), inSize, outSize * charSize, read, written);
written /= charSize;
}
- template <class TCharType>
- inline void RecodeFromUnicode(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
+ template <class TCharType>
+ inline void RecodeFromUnicode(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
const size_t charSize = sizeof(TCharType);
Recode(UnicodeName<TCharType>(), to, reinterpret_cast<const char*>(in), out, inSize * charSize, outSize, read, written);
read /= charSize;
}
- RECODE_RESULT DoRecodeNoThrow(const TDescriptor& d, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
-
+ RECODE_RESULT DoRecodeNoThrow(const TDescriptor& d, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written);
+
template <class TFrom, class TTo>
inline RECODE_RESULT RecodeNoThrow(TFrom from, TTo to, const char* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
TDescriptor descriptor(from, to);
- return DoRecodeNoThrow(descriptor, in, out, inSize, outSize, read, written);
+ return DoRecodeNoThrow(descriptor, in, out, inSize, outSize, read, written);
}
- template <class TCharType>
- inline RECODE_RESULT RecodeToUnicodeNoThrow(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
+ template <class TCharType>
+ inline RECODE_RESULT RecodeToUnicodeNoThrow(ECharset from, const char* in, TCharType* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
const size_t charSize = sizeof(TCharType);
RECODE_RESULT res = RecodeNoThrow(from, UnicodeName<TCharType>(), in, reinterpret_cast<char*>(out), inSize, outSize * charSize, read, written);
@@ -124,8 +124,8 @@ namespace NICONVPrivate {
return res;
}
- template <class TCharType>
- inline RECODE_RESULT RecodeFromUnicodeNoThrow(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
+ template <class TCharType>
+ inline RECODE_RESULT RecodeFromUnicodeNoThrow(ECharset to, const TCharType* in, char* out, size_t inSize, size_t outSize, size_t& read, size_t& written) {
const size_t charSize = sizeof(TCharType);
RECODE_RESULT res = RecodeNoThrow(UnicodeName<TCharType>(), to, reinterpret_cast<const char*>(in), out, inSize * charSize, outSize, read, written);
@@ -133,4 +133,4 @@ namespace NICONVPrivate {
return res;
}
-}
+}