diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/deprecated/split/split_iterator.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/deprecated/split/split_iterator.cpp')
-rw-r--r-- | library/cpp/deprecated/split/split_iterator.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/deprecated/split/split_iterator.cpp b/library/cpp/deprecated/split/split_iterator.cpp index b1fe9a5f15..32262d25bd 100644 --- a/library/cpp/deprecated/split/split_iterator.cpp +++ b/library/cpp/deprecated/split/split_iterator.cpp @@ -1,23 +1,23 @@ -#include "split_iterator.h" - -#include <util/system/yassert.h> - -#include <cctype> -#include <cstring> -#include <cstdlib> - +#include "split_iterator.h" + +#include <util/system/yassert.h> + +#include <cctype> +#include <cstring> +#include <cstdlib> + /****************** TSplitDelimiters2 ******************/ -TSplitDelimiters::TSplitDelimiters(const char* s) { +TSplitDelimiters::TSplitDelimiters(const char* s) { memset(Delims, 0, sizeof(Delims)); while (*s) - Delims[(ui8) * (s++)] = true; + Delims[(ui8) * (s++)] = true; } /****************** TSplitBase ******************/ -TSplitBase::TSplitBase(const char* str, size_t length) - : Str(str) - , Len(length) +TSplitBase::TSplitBase(const char* str, size_t length) + : Str(str) + , Len(length) { } @@ -29,62 +29,62 @@ TSplitBase::TSplitBase(const TString& s) /****************** TDelimitersSplit ******************/ -TDelimitersSplit::TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters) - : TSplitBase(str, length) - , Delimiters(delimiters) +TDelimitersSplit::TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters) + : TSplitBase(str, length) + , Delimiters(delimiters) { } TDelimitersSplit::TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters) - : TSplitBase(s) - , Delimiters(delimiters) + : TSplitBase(s) + , Delimiters(delimiters) { } -size_t TDelimitersSplit::Begin() const { +size_t TDelimitersSplit::Begin() const { size_t pos = 0; - while ((pos < Len) && Delimiters.IsDelimiter(Str[pos])) + while ((pos < Len) && Delimiters.IsDelimiter(Str[pos])) ++pos; return pos; } -TSizeTRegion TDelimitersSplit::Next(size_t& pos) const { +TSizeTRegion TDelimitersSplit::Next(size_t& pos) const { size_t begin = pos; - while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos])) + while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos])) ++pos; TSizeTRegion result(begin, pos); - while ((pos < Len) && Delimiters.IsDelimiter(Str[pos])) + while ((pos < Len) && Delimiters.IsDelimiter(Str[pos])) ++pos; - + return result; } -TDelimitersSplit::TIterator TDelimitersSplit::Iterator() const { +TDelimitersSplit::TIterator TDelimitersSplit::Iterator() const { return TIterator(*this); } /****************** TDelimitersStrictSplit ******************/ -TDelimitersStrictSplit::TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters) - : TSplitBase(str, length) - , Delimiters(delimiters) +TDelimitersStrictSplit::TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters) + : TSplitBase(str, length) + , Delimiters(delimiters) { } TDelimitersStrictSplit::TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters) - : TSplitBase(s) - , Delimiters(delimiters) + : TSplitBase(s) + , Delimiters(delimiters) { } -TDelimitersStrictSplit::TIterator TDelimitersStrictSplit::Iterator() const { +TDelimitersStrictSplit::TIterator TDelimitersStrictSplit::Iterator() const { return TIterator(*this); } -TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const { +TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const { size_t begin = pos; - while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos])) + while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos])) ++pos; TSizeTRegion result(begin, pos); @@ -94,7 +94,7 @@ TSizeTRegion TDelimitersStrictSplit::Next(size_t& pos) const { return result; } -size_t TDelimitersStrictSplit::Begin() const { +size_t TDelimitersStrictSplit::Begin() const { return 0; } @@ -142,84 +142,84 @@ size_t TScreenedDelimitersSplit::Begin() const { /****************** TDelimitersSplitWithoutTags ******************/ -TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters) - : TSplitBase(str, length) - , Delimiters(delimiters) +TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters) + : TSplitBase(str, length) + , Delimiters(delimiters) { } TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters) - : TSplitBase(s) - , Delimiters(delimiters) + : TSplitBase(s) + , Delimiters(delimiters) { } -size_t TDelimitersSplitWithoutTags::SkipTag(size_t pos) const { +size_t TDelimitersSplitWithoutTags::SkipTag(size_t pos) const { Y_ASSERT('<' == Str[pos]); while ((pos < Len) && ('>' != Str[pos])) ++pos; return pos + 1; } -size_t TDelimitersSplitWithoutTags::SkipDelimiters(size_t pos) const { - while (true) { - while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos])) +size_t TDelimitersSplitWithoutTags::SkipDelimiters(size_t pos) const { + while (true) { + while ((pos < Len) && Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos])) ++pos; - if (pos < Len) { + if (pos < Len) { if ('<' != Str[pos]) break; else pos = SkipTag(pos); - } else + } else break; } return pos; } -size_t TDelimitersSplitWithoutTags::Begin() const { +size_t TDelimitersSplitWithoutTags::Begin() const { size_t pos = 0; pos = SkipDelimiters(pos); return pos; } -TSizeTRegion TDelimitersSplitWithoutTags::Next(size_t& pos) const { +TSizeTRegion TDelimitersSplitWithoutTags::Next(size_t& pos) const { size_t begin = pos; - while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos])) + while ((pos < Len) && !Delimiters.IsDelimiter(Str[pos]) && ('<' != Str[pos])) ++pos; TSizeTRegion result(begin, pos); - + pos = SkipDelimiters(pos); return result; } -TDelimitersSplitWithoutTags::TIterator TDelimitersSplitWithoutTags::Iterator() const { +TDelimitersSplitWithoutTags::TIterator TDelimitersSplitWithoutTags::Iterator() const { return TIterator(*this); } /****************** TCharSplit ******************/ -TCharSplit::TCharSplit(const char* str, size_t length) - : TSplitBase(str, length) +TCharSplit::TCharSplit(const char* str, size_t length) + : TSplitBase(str, length) { } TCharSplit::TCharSplit(const TString& s) - : TSplitBase(s) + : TSplitBase(s) { } -TCharSplit::TIterator TCharSplit::Iterator() const { +TCharSplit::TIterator TCharSplit::Iterator() const { return TIterator(*this); } -TSizeTRegion TCharSplit::Next(size_t& pos) const { +TSizeTRegion TCharSplit::Next(size_t& pos) const { TSizeTRegion result(pos, pos + 1); ++pos; return result; } -size_t TCharSplit::Begin() const { +size_t TCharSplit::Begin() const { return 0; } @@ -235,33 +235,33 @@ TCharSplitWithoutTags::TCharSplitWithoutTags(const TString& s) { } -size_t TCharSplitWithoutTags::SkipTag(size_t pos) const { +size_t TCharSplitWithoutTags::SkipTag(size_t pos) const { Y_ASSERT('<' == Str[pos]); while ((pos < Len) && ('>' != Str[pos])) ++pos; return pos + 1; } -size_t TCharSplitWithoutTags::SkipDelimiters(size_t pos) const { - while (true) { - if (pos < Len) { +size_t TCharSplitWithoutTags::SkipDelimiters(size_t pos) const { + while (true) { + if (pos < Len) { if ('<' != Str[pos]) break; else pos = SkipTag(pos); - } else + } else break; } return pos; } -size_t TCharSplitWithoutTags::Begin() const { +size_t TCharSplitWithoutTags::Begin() const { size_t pos = 0; pos = SkipDelimiters(pos); return pos; } -TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const { +TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const { size_t begin = pos++; TSizeTRegion result(begin, pos); @@ -270,7 +270,7 @@ TSizeTRegion TCharSplitWithoutTags::Next(size_t& pos) const { return result; } -TCharSplitWithoutTags::TIterator TCharSplitWithoutTags::Iterator() const { +TCharSplitWithoutTags::TIterator TCharSplitWithoutTags::Iterator() const { return TIterator(*this); } |