3 namespace tdc {
namespace io {
4 inline size_t Input::Variant::size()
const {
5 if (source().is_view()) {
9 actual_to = source().view().size();
11 if(escaped_size_unknown()) {
12 if(restrictions().has_no_restrictions()) {
13 set_escaped_size(actual_to - from());
15 auto strm = as_stream();
26 }
else if (source().is_file()) {
28 auto actual_to = to();
30 actual_to = read_file_size(source().file());
32 if(escaped_size_unknown()) {
33 if(restrictions().has_no_restrictions()) {
34 set_escaped_size(actual_to - from());
36 auto strm = as_stream();
47 }
else if (source().is_stream()) {
48 if(escaped_size_unknown()) {
49 auto p = alloc().find_or_construct(
50 InputSource(source().stream()), from(), to(), restrictions());
51 set_escaped_size(p->view().size());
52 unregister_alloc_chunk_handle(p);
57 return escaped_size();
60 inline std::shared_ptr<Input::Variant> Input::Variant::slice(
61 size_t from,
size_t to = npos)
const 63 size_t new_from = this->from() + from;
68 new_to = this->from() + to;
71 return std::shared_ptr<Variant>(
new Variant(*
this, new_from, new_to));
74 inline std::shared_ptr<Input::Variant> Input::Variant::restrict(
75 const InputRestrictions& rest)
const 77 return std::shared_ptr<Variant>(
new Variant(*
this, restrictions() | rest));
Contains the text compression and encoding framework.