diff options
author | axc <axc@yandex-team.ru> | 2022-02-10 16:47:36 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:36 +0300 |
commit | 7b659037613268d5eac4a1b6a7c5eff3cd36d4bf (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /util | |
parent | 1f5217043ad70f25dc35e75b3bd261a1e23d045e (diff) | |
download | ydb-7b659037613268d5eac4a1b6a7c5eff3cd36d4bf.tar.gz |
Restoring authorship annotation for <axc@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/systime.cpp | 2 | ||||
-rw-r--r-- | util/generic/bitmap.h | 14 | ||||
-rw-r--r-- | util/generic/ptr.h | 42 | ||||
-rw-r--r-- | util/generic/ptr_ut.cpp | 22 | ||||
-rw-r--r-- | util/generic/singleton.h | 4 | ||||
-rw-r--r-- | util/generic/strbase.h | 42 | ||||
-rw-r--r-- | util/str_stl.h | 6 | ||||
-rw-r--r-- | util/string/cast.cpp | 16 | ||||
-rw-r--r-- | util/string/split.h | 6 | ||||
-rw-r--r-- | util/string/split_ut.cpp | 12 |
10 files changed, 83 insertions, 83 deletions
diff --git a/util/datetime/systime.cpp b/util/datetime/systime.cpp index 5db774dc56..6ee7e8fc6e 100644 --- a/util/datetime/systime.cpp +++ b/util/datetime/systime.cpp @@ -81,7 +81,7 @@ time_t TimeGM(const struct tm* t) { days += month_to_days[LEAPYEAR(1900 + t->tm_year)][t->tm_mon]; days += t->tm_mday - 1; - unsigned long secs = days * 86400ul + t->tm_hour * 3600 + t->tm_min * 60 + t->tm_sec; + unsigned long secs = days * 86400ul + t->tm_hour * 3600 + t->tm_min * 60 + t->tm_sec; return (time_t)secs; } diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index 6070ed939e..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -1000,14 +1000,14 @@ public: return hash; } - - inline const TChunk* GetChunks() const { - return Mask.Data; - } - + + inline const TChunk* GetChunks() const { + return Mask.Data; + } + constexpr size_t GetChunkCount() const noexcept { - return Mask.GetChunkCapacity(); - } + return Mask.GetChunkCapacity(); + } }; template <class X, class Y> diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 21c836ee20..19db0e3ec5 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -962,7 +962,7 @@ template <typename T, typename... Args> return MakeShared<T, TSimpleCounter>(std::forward<Args>(args)...); } -class TCopyClone { +class TCopyClone { public: template <class T> static inline T* Copy(T* t) { @@ -970,9 +970,9 @@ public: return t->Clone(); return nullptr; } -}; - -class TCopyNew { +}; + +class TCopyNew { public: template <class T> static inline T* Copy(T* t) { @@ -980,21 +980,21 @@ public: return new T(*t); return nullptr; } -}; - +}; + template <class T, class C, class D> -class TCopyPtr: public TPointerBase<TCopyPtr<T, C, D>, T> { +class TCopyPtr: public TPointerBase<TCopyPtr<T, C, D>, T> { public: inline TCopyPtr(T* t = nullptr) noexcept : T_(t) { } - + inline TCopyPtr(const TCopyPtr& t) : T_(C::Copy(t.Get())) { } - + inline TCopyPtr(TCopyPtr&& t) noexcept : T_(nullptr) { @@ -1004,24 +1004,24 @@ public: inline ~TCopyPtr() { DoDestroy(); } - + inline TCopyPtr& operator=(TCopyPtr t) noexcept { t.Swap(*this); - + return *this; } - + inline T* Release() noexcept Y_WARN_UNUSED_RESULT { return DoRelease(T_); } - + inline void Reset(T* t) noexcept { if (T_ != t) { DoDestroy(); T_ = t; - } + } } - + inline void Reset() noexcept { Destroy(); } @@ -1029,15 +1029,15 @@ public: inline void Destroy() noexcept { Reset(nullptr); } - + inline void Swap(TCopyPtr& r) noexcept { DoSwap(T_, r.T_); } - + inline T* Get() const noexcept { return T_; } - + #ifdef __cpp_impl_three_way_comparison template <class Other> inline bool operator==(const Other& p) const noexcept { @@ -1049,11 +1049,11 @@ private: if (T_) D::Destroy(T_); } - + private: T* T_; -}; - +}; + // Copy-on-write pointer template <class TPtr, class TCopy> class TCowPtr: public TPointerBase<TCowPtr<TPtr, TCopy>, const typename TPtr::TValueType> { diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp index ef98c7a5dc..c2dcff23f6 100644 --- a/util/generic/ptr_ut.cpp +++ b/util/generic/ptr_ut.cpp @@ -104,7 +104,7 @@ public: { ++cnt; } - + inline ~A() { --cnt; } @@ -248,7 +248,7 @@ void TPointerTest::TestTrulePtr() { UNIT_ASSERT_VALUES_EQUAL(cnt, 0); } - + void TPointerTest::TestAutoToHolder() { { TAutoPtr<A> a1(MakeA()); @@ -280,19 +280,19 @@ void TPointerTest::TestAutoToHolder() { void TPointerTest::TestCopyPtr() { TCopyPtr<A> a1(MakeA()); - { + { TCopyPtr<A> a2(MakeA()); - TCopyPtr<A> a3 = a2; + TCopyPtr<A> a3 = a2; UNIT_ASSERT_VALUES_EQUAL(cnt, 3); - - a1 = a2; - a2 = a3; - } + + a1 = a2; + a2 = a3; + } UNIT_ASSERT_VALUES_EQUAL(cnt, 1); - a1.Destroy(); - + a1.Destroy(); + UNIT_ASSERT_VALUES_EQUAL(cnt, 0); -} +} class TOp: public TSimpleRefCount<TOp>, public TNonCopyable { public: diff --git a/util/generic/singleton.h b/util/generic/singleton.h index dfff163b74..f5fa047f5c 100644 --- a/util/generic/singleton.h +++ b/util/generic/singleton.h @@ -113,8 +113,8 @@ namespace NPrivate { template <class T, class... TArgs> T* Singleton(TArgs&&... args) { return ::NPrivate::SingletonInt<T, TSingletonTraits<T>::Priority>(std::forward<TArgs>(args)...); -} - +} + template <class T, class... TArgs> T* HugeSingleton(TArgs&&... args) { return Singleton<::NPrivate::THeapStore<T>>(std::forward<TArgs>(args)...)->D; diff --git a/util/generic/strbase.h b/util/generic/strbase.h index 39becc9f93..ab39fc7537 100644 --- a/util/generic/strbase.h +++ b/util/generic/strbase.h @@ -251,49 +251,49 @@ public: inline int compare(size_t p, size_t n, const TStringView t, size_t n1) const noexcept { return compare(LegacySubString(*this, p, n), LegacySubString(t, 0, n1)); - } - + } + inline int compare(const TCharType* p, size_t len) const noexcept { return compare(*this, TStringView(p, len)); } static bool equal(const TSelf& s1, const TSelf& s2) noexcept { return s1.AsStringView() == s2.AsStringView(); - } - + } + static bool equal(const TSelf& s1, const TCharType* p) noexcept { if (p == nullptr) { return s1.Len() == 0; } return s1.AsStringView() == p; - } - + } + static bool equal(const TCharType* p, const TSelf& s2) noexcept { return equal(s2, p); - } - + } + static bool equal(const TStringView s1, const TStringView s2) noexcept { return TStringViewWithTraits{s1.data(), s1.size()} == TStringViewWithTraits{s2.data(), s2.size()}; - } - + } + template <class T> inline bool equal(const T& t) const noexcept { - return equal(*this, t); + return equal(*this, t); } inline bool equal(size_t p, size_t n, const TStringView t) const noexcept { return equal(LegacySubString(*this, p, n), t); - } - + } + inline bool equal(size_t p, size_t n, const TStringView t, size_t p1, size_t n1) const noexcept { return equal(LegacySubString(*this, p, n), LegacySubString(t, p1, n1)); - } - + } + inline bool equal(size_t p, size_t n, const TStringView t, size_t n1) const noexcept { return equal(LegacySubString(*this, p, n), LegacySubString(t, 0, n1)); - } - + } + static inline bool StartsWith(const TCharType* what, size_t whatLen, const TCharType* with, size_t withLen) noexcept { return withLen <= whatLen && TStringViewWithTraits(what, withLen) == TStringViewWithTraits(with, withLen); } @@ -341,12 +341,12 @@ public: #ifndef __cpp_impl_three_way_comparison friend bool operator==(const TCharType* pc, const TSelf& s) noexcept { - return equal(pc, s); + return equal(pc, s); } template <typename TDerived2, typename TTraits2> friend bool operator!=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { - return !(s1 == s2); + return !(s1 == s2); } friend bool operator!=(const TSelf& s1, TStringView s2) noexcept { @@ -354,11 +354,11 @@ public: } friend bool operator!=(const TSelf& s, const TCharType* pc) noexcept { - return !(s == pc); + return !(s == pc); } friend bool operator!=(const TCharType* pc, const TSelf& s) noexcept { - return !(pc == s); + return !(pc == s); } #endif diff --git a/util/str_stl.h b/util/str_stl.h index 4d29d71afc..f1e137181d 100644 --- a/util/str_stl.h +++ b/util/str_stl.h @@ -100,10 +100,10 @@ template <> struct THash<TUtf32StringBuf>: ::NHashPrivate::TStringHash<wchar32> { }; -template <class C, class T, class A> +template <class C, class T, class A> struct hash<std::basic_string<C, T, A>>: ::NHashPrivate::TStringHash<C> { -}; - +}; + template <> struct THash<std::type_index> { inline size_t operator()(const std::type_index& index) const { diff --git a/util/string/cast.cpp b/util/string/cast.cpp index 6f0ac738f7..aa1e65a8e9 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -529,9 +529,9 @@ TStringBuf FromStringImpl<TStringBuf>(const char* data, size_t len) { template <> std::string FromStringImpl<std::string>(const char* data, size_t len) { return std::string(data, len); -} - -template <> +} + +template <> TUtf16String FromStringImpl<TUtf16String>(const wchar16* data, size_t len) { return TUtf16String(data, len); } @@ -556,11 +556,11 @@ bool TryFromStringImpl<TString>(const char* data, size_t len, TString& result) { template <> bool TryFromStringImpl<std::string>(const char* data, size_t len, std::string& result) { - result.assign(data, len); - return true; -} - -template <> + result.assign(data, len); + return true; +} + +template <> bool TryFromStringImpl<TWtringBuf>(const wchar16* data, size_t len, TWtringBuf& result) { result = {data, len}; return true; diff --git a/util/string/split.h b/util/string/split.h index 079912c9e8..bc46d9e64c 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -71,7 +71,7 @@ SplitString(I b, const TDelim& d, TConsumer&& c) { } while (c.Consume(l, i, b) && (b != i)); } -template <class I1, class I2> +template <class I1, class I2> static inline I1* FastStrChr(I1* str, I2 f) noexcept { I1* ret = NStringSplitPrivate::Find(str, f); @@ -114,8 +114,8 @@ struct TStringDelimiter { : Delim(delim) , Len(len) { - } - + } + inline Char* Find(Char*& b, Char* e) const noexcept { const auto ret = std::basic_string_view<Char>(b, e - b).find(Delim, 0, Len); diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 1b7872af1b..43e59f2d75 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -46,15 +46,15 @@ inline void Cmp(const T1& t1, const T2& t2) { throw; } } -} - +} + template <class T> inline void Print(const T& t) { for (typename T::const_iterator i = t.begin(); i != t.end(); ++i) { Cerr << *i << Endl; } -} - +} + template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> void TestDelimiterOnString(TResult& good, I* str, const TDelimiter& delim) { TResult test; @@ -62,8 +62,8 @@ void TestDelimiterOnString(TResult& good, I* str, const TDelimiter& delim) { SplitString(str, delim, consumer); Cmp(good, test); UNIT_ASSERT_EQUAL(good, test); -} - +} + template <template <typename> class TConsumer, typename TResult, typename I, typename TDelimiter> void TestDelimiterOnRange(TResult& good, I* b, I* e, const TDelimiter& delim) { TResult test; |