diff options
| author | levysotsky <[email protected]> | 2022-02-10 16:47:29 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:29 +0300 | 
| commit | 32b231c8474a1ade4bdf776ade6a20341691d9d7 (patch) | |
| tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/yt/yson_string | |
| parent | 57f874ffc2a75047c1c4fea7a9fc86cb0f56ed50 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yt/yson_string')
| -rw-r--r-- | library/cpp/yt/yson_string/string.cpp | 38 | ||||
| -rw-r--r-- | library/cpp/yt/yson_string/string.h | 38 | 
2 files changed, 38 insertions, 38 deletions
diff --git a/library/cpp/yt/yson_string/string.cpp b/library/cpp/yt/yson_string/string.cpp index c00aa98a501..99d45e86169 100644 --- a/library/cpp/yt/yson_string/string.cpp +++ b/library/cpp/yt/yson_string/string.cpp @@ -99,8 +99,8 @@ TYsonString::TYsonString(      TStringBuf data,      EYsonType type)      : TYsonString(TYsonStringBuf(data, type)) -{ }  -  +{ } +  #ifdef TSTRING_IS_STD_STRING  TYsonString::TYsonString(      const TString& data, @@ -120,7 +120,7 @@ TYsonString::TYsonString(      Type_ = type;  }  #endif -  +  TYsonString::TYsonString(      const TSharedRef& data,      EYsonType type) @@ -134,22 +134,22 @@ TYsonString::TYsonString(  TYsonString::operator bool() const  {      return !std::holds_alternative<TNullPayload>(Payload_); -}  -  +} +  EYsonType TYsonString::GetType() const -{  +{      YT_VERIFY(*this);      return Type_;  }  TStringBuf TYsonString::AsStringBuf() const -{  +{      YT_VERIFY(*this);      return TStringBuf(Begin_, Begin_ + Size_); -}  -  +} +  TString TYsonString::ToString() const -{  +{      return Visit(          Payload_,          [] (const TNullPayload&) -> TString { @@ -161,13 +161,13 @@ TString TYsonString::ToString() const          [] (const TString& payload) {              return payload;          }); -}  -  +} +  size_t TYsonString::ComputeHash() const -{  +{      return THash<TStringBuf>()(TStringBuf(Begin_, Begin_ + Size_)); -}  -  +} +  ////////////////////////////////////////////////////////////////////////////////  TString ToString(const TYsonString& yson) @@ -175,11 +175,11 @@ TString ToString(const TYsonString& yson)      return yson.ToString();  } -TString ToString(const TYsonStringBuf& yson)  -{  +TString ToString(const TYsonStringBuf& yson) +{      return TString(yson.AsStringBuf()); -}  -  +} +  ////////////////////////////////////////////////////////////////////////////////  } // namespace NYT::NYson diff --git a/library/cpp/yt/yson_string/string.h b/library/cpp/yt/yson_string/string.h index b25223aa6c9..e13af37a6df 100644 --- a/library/cpp/yt/yson_string/string.h +++ b/library/cpp/yt/yson_string/string.h @@ -47,28 +47,28 @@ public:      //! Returns type of YSON contained here. The instance must be non-null.      EYsonType GetType() const; -protected:  +protected:      TStringBuf Data_;      EYsonType Type_; -    bool Null_;  -};  -  +    bool Null_; +}; +  ////////////////////////////////////////////////////////////////////////////////  //! An owning version of TYsonStringBuf.  /*!   *  Internally captures the data either via TString or a polymorphic ref-counted holder.   */ -class TYsonString  -{  -public:  +class TYsonString +{ +public:      //! Constructs a null instance.      TYsonString(); -  +      //! Constructs an instance from TYsonStringBuf.      //! Copies the data into a ref-counted payload. -    explicit TYsonString(const TYsonStringBuf& ysonStringBuf);  -  +    explicit TYsonString(const TYsonStringBuf& ysonStringBuf); +      //! Constructs an instance from TStringBuf.      //! Copies the data into a ref-counted payload.      explicit TYsonString( @@ -108,7 +108,7 @@ private:      { };      using THolder = TRefCountedPtr; -  +      std::variant<TNullPayload, THolder, TString> Payload_;      const char* Begin_; @@ -119,17 +119,17 @@ private:  ////////////////////////////////////////////////////////////////////////////////  bool operator == (const TYsonString& lhs, const TYsonString& rhs); -bool operator == (const TYsonString& lhs, const TYsonStringBuf& rhs);  -bool operator == (const TYsonStringBuf& lhs, const TYsonString& rhs);  -bool operator == (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs);  -  +bool operator == (const TYsonString& lhs, const TYsonStringBuf& rhs); +bool operator == (const TYsonStringBuf& lhs, const TYsonString& rhs); +bool operator == (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs); +  bool operator != (const TYsonString& lhs, const TYsonString& rhs); -bool operator != (const TYsonString& lhs, const TYsonStringBuf& rhs);  -bool operator != (const TYsonStringBuf& lhs, const TYsonString& rhs);  -bool operator != (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs);  +bool operator != (const TYsonString& lhs, const TYsonStringBuf& rhs); +bool operator != (const TYsonStringBuf& lhs, const TYsonString& rhs); +bool operator != (const TYsonStringBuf& lhs, const TYsonStringBuf& rhs);  TString ToString(const TYsonString& yson); -TString ToString(const TYsonStringBuf& yson);  +TString ToString(const TYsonStringBuf& yson);  ////////////////////////////////////////////////////////////////////////////////  | 
