diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-04-10 19:24:04 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-04-12 12:56:38 +0300 |
commit | c198137d69f40c5fe17a399c06e2d2934109d8b1 (patch) | |
tree | 360a96ced514727f05d49c7783155aae37a387fd /coding/buffer_reader.hpp | |
parent | 1eb7a1d11626f1598dbd3c3bcab841e7a6cc4c40 (diff) |
[std] Use new include style for coding, fixes.
Diffstat (limited to 'coding/buffer_reader.hpp')
-rw-r--r-- | coding/buffer_reader.hpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/coding/buffer_reader.hpp b/coding/buffer_reader.hpp index c35911a29a..8bb7c8e30f 100644 --- a/coding/buffer_reader.hpp +++ b/coding/buffer_reader.hpp @@ -1,8 +1,11 @@ -#include "coding/reader.hpp" +#pragma once -#include "std/shared_ptr.hpp" -#include "std/cstring.hpp" +#include "coding/reader.hpp" +#include <cstddef> +#include <cstdint> +#include <cstring> +#include <memory> /// Reader from buffer with ownership on it, but cheap copy constructor. class BufferReader : public Reader @@ -24,26 +27,23 @@ public: memcpy(m_data.get(), p, count); } - inline uint64_t Size() const - { - return m_size; - } + uint64_t Size() const { return m_size; } - inline void Read(uint64_t pos, void * p, size_t size) const + void Read(uint64_t pos, void * p, size_t size) const { ASSERT_LESS_OR_EQUAL(pos + size, Size(), (pos, size)); memcpy(p, m_data.get() + static_cast<size_t>(pos) + m_offset, size); } - inline BufferReader SubReader(uint64_t pos, uint64_t size) const + BufferReader SubReader(uint64_t pos, uint64_t size) const { return BufferReader(*this, pos, size); } - inline unique_ptr<Reader> CreateSubReader(uint64_t pos, uint64_t size) const + std::unique_ptr<Reader> CreateSubReader(uint64_t pos, uint64_t size) const { // Can't use make_unique with private constructor. - return unique_ptr<Reader>(new BufferReader(*this, pos, size)); + return std::unique_ptr<Reader>(new BufferReader(*this, pos, size)); } private: @@ -69,5 +69,6 @@ private: { void operator() (char * p) { delete [] p; } }; - shared_ptr<char> m_data; + + std::shared_ptr<char> m_data; }; |