aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/unicode/punycode/punycode.h
diff options
context:
space:
mode:
authormowgli <mowgli@yandex-team.ru>2022-02-10 16:49:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:25 +0300
commit89afbbe4ca0e02e386dd4df08f7945f190dc1b84 (patch)
treec4772201af6215d48734691b8796e4cfc77c2ac8 /library/cpp/unicode/punycode/punycode.h
parent7510cec1516d17cbc8d7749974e36aa45f547a26 (diff)
downloadydb-89afbbe4ca0e02e386dd4df08f7945f190dc1b84.tar.gz
Restoring authorship annotation for <mowgli@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/unicode/punycode/punycode.h')
-rw-r--r--library/cpp/unicode/punycode/punycode.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/unicode/punycode/punycode.h b/library/cpp/unicode/punycode/punycode.h
index af4acc25c1..9d4517fede 100644
--- a/library/cpp/unicode/punycode/punycode.h
+++ b/library/cpp/unicode/punycode/punycode.h
@@ -1,46 +1,46 @@
-#pragma once
+#pragma once
#include <util/generic/string.h>
-#include <util/generic/strbuf.h>
-#include <util/generic/yexception.h>
-
-// Simplified arcadia wrappers for contrib/libs/libidn/
-
-// Raw strings encoder/decoder: does not prepend with ACE prefix ("xn--"),
-// does not limit input length. Throws TPunycodeError on any internal error.
-// Returned strbuf points to @out data.
+#include <util/generic/strbuf.h>
+#include <util/generic/yexception.h>
+
+// Simplified arcadia wrappers for contrib/libs/libidn/
+
+// Raw strings encoder/decoder: does not prepend with ACE prefix ("xn--"),
+// does not limit input length. Throws TPunycodeError on any internal error.
+// Returned strbuf points to @out data.
TStringBuf WideToPunycode(const TWtringBuf& in, TString& out);
TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out);
-
+
inline TString WideToPunycode(const TWtringBuf& in) {
TString out;
- WideToPunycode(in, out);
- return out;
-}
-
+ WideToPunycode(in, out);
+ return out;
+}
+
inline TUtf16String PunycodeToWide(const TStringBuf& in) {
TUtf16String out;
- PunycodeToWide(in, out);
- return out;
-}
-
-// Encode a sequence of point-separated domain labels
-// into a sequence of corresponding punycode labels.
-// Labels containing non-ASCII characters are prefixed with ACE prefix ("xn--").
-// Limits maximal encoded domain label length to IDNA_LABEL_MAX_LENGTH (255 by default).
-// Throws TPunycodeError on failure.
+ PunycodeToWide(in, out);
+ return out;
+}
+
+// Encode a sequence of point-separated domain labels
+// into a sequence of corresponding punycode labels.
+// Labels containing non-ASCII characters are prefixed with ACE prefix ("xn--").
+// Limits maximal encoded domain label length to IDNA_LABEL_MAX_LENGTH (255 by default).
+// Throws TPunycodeError on failure.
TString HostNameToPunycode(const TWtringBuf& unicodeHost);
TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost);
-
-// Robust versions: on failure return original input, converted to/from UTF8
+
+// Robust versions: on failure return original input, converted to/from UTF8
TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost);
TUtf16String ForcePunycodeToHostName(const TStringBuf& punycodeHost);
-
-// True if @host looks like punycode domain label sequence,
-// containing at least one ACE-prefixed label.
-// Note that this function does not check all requied IDNA constraints
-// (max label length, empty non-root domains, etc.)
-bool CanBePunycodeHostName(const TStringBuf& host);
-
-class TPunycodeError: public yexception {
-};
+
+// True if @host looks like punycode domain label sequence,
+// containing at least one ACE-prefixed label.
+// Note that this function does not check all requied IDNA constraints
+// (max label length, empty non-root domains, etc.)
+bool CanBePunycodeHostName(const TStringBuf& host);
+
+class TPunycodeError: public yexception {
+};