diff options
author | bnagaev <bnagaev@yandex-team.ru> | 2022-02-10 16:47:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:04 +0300 |
commit | c74559fb88da8adac0d9186cfa55a6b13c47695f (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /contrib/libs/yaml-cpp/src/stringsource.h | |
parent | d6449ba66291ff0c0d352c82e6eb3efb4c8a7e8d (diff) | |
download | ydb-c74559fb88da8adac0d9186cfa55a6b13c47695f.tar.gz |
Restoring authorship annotation for <bnagaev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/yaml-cpp/src/stringsource.h')
-rw-r--r-- | contrib/libs/yaml-cpp/src/stringsource.h | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/contrib/libs/yaml-cpp/src/stringsource.h b/contrib/libs/yaml-cpp/src/stringsource.h index 1691040db7..6fee44bb28 100644 --- a/contrib/libs/yaml-cpp/src/stringsource.h +++ b/contrib/libs/yaml-cpp/src/stringsource.h @@ -1,48 +1,48 @@ -#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 -#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 - -#if defined(_MSC_VER) || \ - (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ - (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 -#pragma once -#endif - -#include <cstddef> - -namespace YAML { -class StringCharSource { - public: - StringCharSource(const char* str, std::size_t size) - : m_str(str), m_size(size), m_offset(0) {} - - operator bool() const { return m_offset < m_size; } - char operator[](std::size_t i) const { return m_str[m_offset + i]; } - bool operator!() const { return !static_cast<bool>(*this); } - - const StringCharSource operator+(int i) const { - StringCharSource source(*this); - if (static_cast<int>(source.m_offset) + i >= 0) - source.m_offset += i; - else - source.m_offset = 0; - return source; - } - - StringCharSource& operator++() { - ++m_offset; - return *this; - } - - StringCharSource& operator+=(std::size_t offset) { - m_offset += offset; - return *this; - } - - private: - const char* m_str; - std::size_t m_size; - std::size_t m_offset; -}; -} - -#endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#ifndef STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 + +#if defined(_MSC_VER) || \ + (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ + (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + +#include <cstddef> + +namespace YAML { +class StringCharSource { + public: + StringCharSource(const char* str, std::size_t size) + : m_str(str), m_size(size), m_offset(0) {} + + operator bool() const { return m_offset < m_size; } + char operator[](std::size_t i) const { return m_str[m_offset + i]; } + bool operator!() const { return !static_cast<bool>(*this); } + + const StringCharSource operator+(int i) const { + StringCharSource source(*this); + if (static_cast<int>(source.m_offset) + i >= 0) + source.m_offset += i; + else + source.m_offset = 0; + return source; + } + + StringCharSource& operator++() { + ++m_offset; + return *this; + } + + StringCharSource& operator+=(std::size_t offset) { + m_offset += offset; + return *this; + } + + private: + const char* m_str; + std::size_t m_size; + std::size_t m_offset; +}; +} + +#endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 |