aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/string_transform.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/protobuf/json/string_transform.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/protobuf/json/string_transform.h')
-rw-r--r--library/cpp/protobuf/json/string_transform.h156
1 files changed, 78 insertions, 78 deletions
diff --git a/library/cpp/protobuf/json/string_transform.h b/library/cpp/protobuf/json/string_transform.h
index e4b296bc01..76042ddc23 100644
--- a/library/cpp/protobuf/json/string_transform.h
+++ b/library/cpp/protobuf/json/string_transform.h
@@ -5,83 +5,83 @@
#include <util/generic/refcount.h>
namespace NProtobufJson {
- class IStringTransform: public TSimpleRefCount<IStringTransform> {
- public:
- virtual ~IStringTransform() {
- }
-
- /// Some transforms have special meaning.
- /// For example, escape transforms cause generic JSON escaping to be turned off.
- enum Type {
- EscapeTransform = 0x1,
- };
-
- virtual int GetType() const = 0;
-
- /// This method is called for each string field in proto
- virtual void Transform(TString& str) const = 0;
-
- /// This method is called for each bytes field in proto
- virtual void TransformBytes(TString& str) const {
- // Default behaviour is to apply string transform
- return Transform(str);
- }
- };
-
- using TStringTransformPtr = TIntrusivePtr<IStringTransform>;
-
- template <bool quote, bool tounicode>
- class TEscapeJTransform: public IStringTransform {
- public:
- int GetType() const override {
- return EscapeTransform;
- }
-
- void Transform(TString& str) const override {
- TString newStr;
- NEscJ::EscapeJ<quote, tounicode>(str, newStr);
- str = newStr;
- }
- };
-
- class TCEscapeTransform: public IStringTransform {
- public:
- int GetType() const override {
- return EscapeTransform;
- }
-
- void Transform(TString& str) const override;
- };
-
- class TSafeUtf8CEscapeTransform: public IStringTransform {
- public:
- int GetType() const override {
- return EscapeTransform;
- }
-
- void Transform(TString& str) const override;
- };
-
- class TDoubleEscapeTransform: public IStringTransform {
- public:
- int GetType() const override {
- return EscapeTransform;
- }
-
- void Transform(TString& str) const override;
- };
-
- class TDoubleUnescapeTransform: public NProtobufJson::IStringTransform {
- public:
- int GetType() const override {
- return NProtobufJson::IStringTransform::EscapeTransform;
- }
-
- void Transform(TString& str) const override;
-
- private:
- TString Unescape(const TString& str) const;
- };
+ class IStringTransform: public TSimpleRefCount<IStringTransform> {
+ public:
+ virtual ~IStringTransform() {
+ }
+
+ /// Some transforms have special meaning.
+ /// For example, escape transforms cause generic JSON escaping to be turned off.
+ enum Type {
+ EscapeTransform = 0x1,
+ };
+
+ virtual int GetType() const = 0;
+
+ /// This method is called for each string field in proto
+ virtual void Transform(TString& str) const = 0;
+
+ /// This method is called for each bytes field in proto
+ virtual void TransformBytes(TString& str) const {
+ // Default behaviour is to apply string transform
+ return Transform(str);
+ }
+ };
+
+ using TStringTransformPtr = TIntrusivePtr<IStringTransform>;
+
+ template <bool quote, bool tounicode>
+ class TEscapeJTransform: public IStringTransform {
+ public:
+ int GetType() const override {
+ return EscapeTransform;
+ }
+
+ void Transform(TString& str) const override {
+ TString newStr;
+ NEscJ::EscapeJ<quote, tounicode>(str, newStr);
+ str = newStr;
+ }
+ };
+
+ class TCEscapeTransform: public IStringTransform {
+ public:
+ int GetType() const override {
+ return EscapeTransform;
+ }
+
+ void Transform(TString& str) const override;
+ };
+
+ class TSafeUtf8CEscapeTransform: public IStringTransform {
+ public:
+ int GetType() const override {
+ return EscapeTransform;
+ }
+
+ void Transform(TString& str) const override;
+ };
+
+ class TDoubleEscapeTransform: public IStringTransform {
+ public:
+ int GetType() const override {
+ return EscapeTransform;
+ }
+
+ void Transform(TString& str) const override;
+ };
+
+ class TDoubleUnescapeTransform: public NProtobufJson::IStringTransform {
+ public:
+ int GetType() const override {
+ return NProtobufJson::IStringTransform::EscapeTransform;
+ }
+
+ void Transform(TString& str) const override;
+
+ private:
+ TString Unescape(const TString& str) const;
+ };
class TBase64EncodeBytesTransform: public NProtobufJson::IStringTransform {
public:
@@ -108,4 +108,4 @@ namespace NProtobufJson {
void TransformBytes(TString &str) const override;
};
-}
+}