1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_http_internal_EncodedBlock_hpp
10 #define anna_http_internal_EncodedBlock_hpp
12 #include <anna/core/DataBlock.hpp>
18 class EncodedBlock : public DataBlock {
20 struct Type { enum _v { None, Chunked }; };
21 struct State { enum _v { Completed, Incomplete }; };
23 EncodedBlock() : DataBlock(true), a_chunk(true), a_expectedSize(-1), a_type(Type::None) {;}
25 Type::_v getType() const throw() { return a_type; }
26 bool isValid() const throw() { return a_type != Type::None; }
28 void setType(const Type::_v type) throw() { a_type = type; }
29 void setExpectedSize(const int expectedSize) throw() { a_expectedSize = expectedSize; }
31 void clear() { DataBlock::clear(); a_expectedSize = -1; a_chunk.clear(); a_type = Type::None; }
33 State::_v append(const DataBlock& chunk) throw();