Arbitrary sequential element collection. More...
#include <senf/Packets/ListParser.hh>
Public Types | |
typedef ListPolicy | policy |
typedef ListPolicy::element_type | value_type |
typedef ListPolicy::container_type | container_type |
Public Types inherited from senf::PacketParserBase | |
typedef detail::packet::iterator | data_iterator |
Raw data iterator type. More... | |
typedef detail::packet::size_type | size_type |
Unsigned integral type. More... | |
typedef detail::packet::difference_type | difference_type |
Signed integral type. More... | |
typedef detail::packet::byte | byte |
Unsigned 8bit value, the raw value type. More... | |
typedef PacketData * | state_type |
Type of the 'state' parameter. More... | |
typedef PacketParserBase | parser_base_type |
Base type of the next parser. More... | |
Public Member Functions | |
ListParser (data_iterator i, state_type s) | |
ListParser (ListPolicy policy, data_iterator i, state_type s) | |
Additional policy specific constructor. More... | |
size_type | bytes () const |
void | init () const |
container_type | container () const |
size_type | size () const |
bool | empty () const |
value_type | front () const |
value_type | back () const |
template<class InputIterator > | |
void | assign (InputIterator first, InputIterator last) |
template<class Range > | |
void | assign (Range const &range) |
template<class Value > | |
void | push_back (Value const &value, size_type n=1) const |
value_type | push_back_space (size_type n=1) const |
template<class Value > | |
void | push_front (Value const &value, size_type n=1) const |
value_type | push_front_space (size_type n=1) const |
void | resize (size_type n) const |
template<class Value > | |
void | resize (size_type n, Value value) const |
Public Member Functions inherited from senf::PacketParserBase | |
data_iterator | i () const |
Return beginning of data to parse. More... | |
data_iterator | i (size_type offset) const |
Return iterator offset bytes from the start. More... | |
state_type | state () const |
Return state of this parser. More... | |
PacketData & | data () const |
Access the packets raw data container. More... | |
void | init () const |
Default implementation. More... | |
Static Public Member Functions | |
static ListParser & | get (ListPolicy &p) |
static ListParser const & | get (ListPolicy const &p) |
Static Public Attributes | |
static const size_type | init_bytes = ListPolicy::init_bytes |
Additional Inherited Members | |
Protected Member Functions inherited from senf::PacketParserBase | |
ParserProtector | protect () const |
PacketParserBase (data_iterator i, state_type s) | |
Standard constructor. More... | |
PacketParserBase (data_iterator i, state_type s, size_type size) | |
Size checking constructor. More... | |
bool | check (size_type size) const |
Check size of data container. More... | |
void | validate (size_type size) const |
Validate size of data container. More... | |
template<class Parser > | |
Parser | parse (data_iterator i) const |
Create sub-parser. More... | |
template<class Parser , class Arg > | |
Parser | parse (Arg const &arg, data_iterator i) const |
Create sub-parser. More... | |
template<class Parser > | |
Parser | parse (size_type n) const |
Create sub-parser. More... | |
template<class Parser , class Arg > | |
Parser | parse (Arg const &arg, size_type n) const |
Create sub-parser. More... | |
void | defaultInit () const |
Default implementation. More... | |
Packet | packet () const |
Get packet this parser is parsing from. More... | |
void | resize (size_type oldSize, size_type newSize) |
Resize data container. More... | |
Arbitrary sequential element collection.
A List is a sequential collection of elements. The element type is given as an arbitrary parser. The list is more flexible than a vector: It is not limited to fixed-size elements and it might not have direct access to the size of the collection.
The cost is however, that a List is only a model of an STL forward sequence. The parser provides a reduced interface to this sequence, the container wrapper provides the complete interface.
ListParser makes use of a policy template argument, ListPolicy, to customize the way the list is laid out. This policy is given quite some freedom in the list implementation. It is however important, that list elements always follow each other without padding (if padding is needed, it needs to be part of the element parser).
You will normally not instantiate ListParser directly, you will use the SENF_PARSER_LIST() helper macro.
Some basic list access methods are defined as parser members. To access the complete list API however you will need to instantiate a container wrapper for the list. See Collection parsers.
Definition at line 65 of file ListParser.hh.
typedef ListPolicy::container_type senf::ListParser< ListPolicy >::container_type |
Definition at line 87 of file ListParser.hh.
typedef ListPolicy senf::ListParser< ListPolicy >::policy |
Definition at line 70 of file ListParser.hh.
typedef ListPolicy::element_type senf::ListParser< ListPolicy >::value_type |
Definition at line 86 of file ListParser.hh.
senf::ListParser< ListPolicy >::ListParser | ( | data_iterator | i, |
state_type | s | ||
) |
senf::ListParser< ListPolicy >::ListParser | ( | ListPolicy | policy, |
data_iterator | i, | ||
state_type | s | ||
) |
Additional policy specific constructor.
This constructor may be used, if the policy needs additional parameters.
void senf::ListParser< ListPolicy >::assign | ( | InputIterator | first, |
InputIterator | last | ||
) |
void senf::ListParser< ListPolicy >::assign | ( | Range const & | range | ) |
value_type senf::ListParser< ListPolicy >::back | ( | ) | const |
size_type senf::ListParser< ListPolicy >::bytes | ( | ) | const |
container_type senf::ListParser< ListPolicy >::container | ( | ) | const |
bool senf::ListParser< ListPolicy >::empty | ( | ) | const |
value_type senf::ListParser< ListPolicy >::front | ( | ) | const |
|
static |
|
static |
void senf::ListParser< ListPolicy >::init | ( | ) | const |
void senf::ListParser< ListPolicy >::push_back | ( | Value const & | value, |
size_type | n = 1 |
||
) | const |
value_type senf::ListParser< ListPolicy >::push_back_space | ( | size_type | n = 1 | ) | const |
void senf::ListParser< ListPolicy >::push_front | ( | Value const & | value, |
size_type | n = 1 |
||
) | const |
value_type senf::ListParser< ListPolicy >::push_front_space | ( | size_type | n = 1 | ) | const |
void senf::ListParser< ListPolicy >::resize | ( | size_type | n | ) | const |
void senf::ListParser< ListPolicy >::resize | ( | size_type | n, |
Value | value | ||
) | const |
size_type senf::ListParser< ListPolicy >::size | ( | ) | const |
|
static |
Definition at line 81 of file ListParser.hh.