21 namespace tdc {
namespace io {
40 static constexpr
size_t npos = -1;
45 InputAllocHandle m_handle;
49 mutable size_t m_escaped_size_cache = npos;
51 inline void set_escaped_size(
size_t size)
const {
52 m_escaped_size_cache =
size;
54 inline Variant(
const Variant& other,
56 size_t to): Variant(other) {
59 m_escaped_size_cache = npos;
61 inline Variant(
const Variant& other,
63 m_input_restrictions = restrictions;
64 m_escaped_size_cache = npos;
69 inline const InputAllocHandle& alloc()
const {
74 return m_input_restrictions;
77 inline size_t from()
const {
81 inline size_t to()
const {
85 inline bool to_unknown()
const {
89 inline bool escaped_size_unknown()
const {
90 return m_escaped_size_cache == npos;
93 inline size_t escaped_size()
const {
94 DCHECK(!escaped_size_unknown());
95 return m_escaped_size_cache;
104 inline std::shared_ptr<Variant> slice(
size_t from,
size_t to)
const;
106 inline size_t size()
const;
115 std::shared_ptr<Variant>
m_data;
128 m_data(other.m_data) {}
132 m_data(
std::move(other.m_data)) {}
145 m_data(
std::make_shared<Variant>(
View(buf))) {}
150 Input(
const std::vector<uint8_t>& buf):
163 m_data = std::move(other.m_data);
170 *
this = std::move(cpy);
234 return m_data->size();
241 inline Input(
const Input& other,
size_t from,
size_t to = npos):
242 m_data(other.m_data->slice(from, to)) {}
249 m_data(other.m_data->restrict(restrictions)) {}
259 namespace tdc {
namespace io {
265 return m_data->as_stream();
Contains the text compression and encoding framework.
A const view into a slice of memory.