X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FListParser.hh;h=c101b82bc31b1c9e5ec541b11af227413fa8d7db;hb=8f1a688cea76f2e76bfa0193dff9c1538929147e;hp=ae3d9ae2167322094a02c6ae60f525e0d8c4c8ae;hpb=a1a6c76a214ad1935032826713cabaf9ac57bf07;p=senf.git diff --git a/Packets/ListParser.hh b/Packets/ListParser.hh index ae3d9ae..c101b82 100644 --- a/Packets/ListParser.hh +++ b/Packets/ListParser.hh @@ -35,8 +35,7 @@ namespace senf { - namespace detail { template - class ListParser_Iterator; } + namespace detail { template class ListParser_Iterator; } template class ListParser_Container; @@ -65,6 +64,8 @@ namespace senf { private ListPolicy { public: + typedef ListPolicy policy; + ListParser(data_iterator i, state_type s); ListParser(ListPolicy policy, data_iterator i, state_type s); ///< Additional policy specific constructor @@ -80,17 +81,11 @@ namespace senf { // Container interface typedef typename ListPolicy::element_type value_type; - typedef detail::ListParser_Iterator< - value_type, typename ListPolicy::iterator_policy > iterator; - typedef iterator const_iterator; typedef typename ListPolicy::container_type container; size_type size() const; bool empty() const; - iterator begin() const; - iterator end() const; - value_type front() const; value_type back() const; @@ -101,6 +96,9 @@ namespace senf { void resize (size_type n) const; template void resize (size_type n, Value value) const; + static ListParser & get(ListPolicy & p); + static ListParser const & get(ListPolicy const & p); + private: template friend class ListParser_Container; }; @@ -131,13 +129,13 @@ namespace senf { /////////////////////////////////////////////////////////////////////////// // Types + typedef ListPolicy policy; typedef typename ListPolicy::parser_type parser_type; typedef PacketParserBase::data_iterator data_iterator; typedef PacketParserBase::size_type size_type; typedef PacketParserBase::difference_type difference_type; typedef typename ListPolicy::element_type value_type; - typedef detail::ListParser_Iterator< - value_type, typename ListPolicy::iterator_policy> iterator; + typedef detail::ListParser_Iterator iterator; typedef iterator const_iterator; typedef PacketParserBase::state_type state_type; @@ -213,10 +211,17 @@ namespace senf { ///@} private: + friend class detail::ListParser_Iterator; + state_type state_; size_type i_; }; +# define SENF_PARSER_LIST(name, size, elt_type) \ + SENF_PARSER_LIST_I(public, name, size, elt_type) + +# define SENF_PARSER_PRIVATE_LIST(name, size, elt_type) \ + SENF_PARSER_LIST_I(private, name, size, elt_type) }