diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/yson_pull/detail/stream_counter.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yson_pull/detail/stream_counter.h')
-rw-r--r-- | library/cpp/yson_pull/detail/stream_counter.h | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/library/cpp/yson_pull/detail/stream_counter.h b/library/cpp/yson_pull/detail/stream_counter.h index 3b41b27eb6..81146a32f2 100644 --- a/library/cpp/yson_pull/detail/stream_counter.h +++ b/library/cpp/yson_pull/detail/stream_counter.h @@ -4,48 +4,48 @@ #include <cstddef> -namespace NYsonPull { - namespace NDetail { - template <bool EnableLinePositionInfo> - class stream_counter; - - template <> - class stream_counter<true> { - private: - size_t offset_ = 0; - size_t line_ = 1; - size_t column_ = 1; - - public: - TPositionInfo info() const { - return {offset_, line_, column_}; +namespace NYsonPull { + namespace NDetail { + template <bool EnableLinePositionInfo> + class stream_counter; + + template <> + class stream_counter<true> { + private: + size_t offset_ = 0; + size_t line_ = 1; + size_t column_ = 1; + + public: + TPositionInfo info() const { + return {offset_, line_, column_}; + } + + void update(const ui8* begin, const ui8* end) { + offset_ += end - begin; + for (auto current = begin; current != end; ++current) { + ++column_; + if (*current == '\n') { //TODO: memchr + ++line_; + column_ = 1; + } + } } - - void update(const ui8* begin, const ui8* end) { - offset_ += end - begin; - for (auto current = begin; current != end; ++current) { - ++column_; - if (*current == '\n') { //TODO: memchr - ++line_; - column_ = 1; - } - } - } - }; - - template <> - class stream_counter<false> { - private: - size_t offset_ = 0; - - public: - TPositionInfo info() const { - return {offset_, {}, {}}; - } - - void update(const ui8* begin, const ui8* end) { - offset_ += end - begin; - } - }; + }; + + template <> + class stream_counter<false> { + private: + size_t offset_ = 0; + + public: + TPositionInfo info() const { + return {offset_, {}, {}}; + } + + void update(const ui8* begin, const ui8* end) { + offset_ += end - begin; + } + }; } -} +} |