From: g0dil Date: Wed, 6 Oct 2010 13:37:19 +0000 (+0000) Subject: Packets: Fix ListBParser and ListNParser to corretly utilize AuxPolicy::WrapperPolicy X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=f3f6fb924f4029466cf88f5d7e3cdbaf468a24dc;p=senf.git Packets: Fix ListBParser and ListNParser to corretly utilize AuxPolicy::WrapperPolicy git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1727 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/ListBParser.ct b/senf/Packets/ListBParser.ct index 03baab8..f430e70 100644 --- a/senf/Packets/ListBParser.ct +++ b/senf/Packets/ListBParser.ct @@ -37,12 +37,12 @@ template prefix_ senf::detail::ListBParser_Policy::container_policy:: container_policy(parser_policy const & p) - : AuxPolicy (p) + : AuxPolicy::WrapperPolicy (p) { parser_type selfp (parser_type::get(p)); size_type totalsz (selfp.bytes()); data_iterator const e (selfp.i(totalsz)); - data_iterator i (AuxPolicy::adjust(selfp.i(), selfp.state())); + data_iterator i (AuxPolicy::WrapperPolicy::adjust(selfp.i(), selfp.state())); n_ = 0; while (i!=e) { ElementParser p (i,selfp.state()); diff --git a/senf/Packets/ListBParser.cti b/senf/Packets/ListBParser.cti index 80e8c79..9f2dcf4 100644 --- a/senf/Packets/ListBParser.cti +++ b/senf/Packets/ListBParser.cti @@ -79,7 +79,7 @@ senf::detail::ListBParser_Policy::container_policy::byt state_type s) const { - return AuxPolicy::aux(i,s) + AuxPolicy::aux_bytes; + return AuxPolicy::WrapperPolicy::aux(i,s) + AuxPolicy::aux_bytes; } template @@ -97,7 +97,7 @@ init(data_iterator i, state_type s) { n_ = 0; container_size_ = s->size(); - AuxPolicy::aux(0,i,s); + AuxPolicy::WrapperPolicy::aux(0,i,s); } template @@ -119,7 +119,8 @@ prefix_ void senf::detail::ListBParser_Policy::containe erase(container_type & c, data_iterator p) { size_type b (senf::bytes(ElementParser(p,c.state()))); - AuxPolicy::aux( AuxPolicy::aux(c.i(), c.state())-b, c.i(), c.state()); + AuxPolicy::WrapperPolicy::aux( + AuxPolicy::WrapperPolicy::aux(c.i(), c.state())-b, c.i(), c.state()); --n_; // The container will be reduced by b bytes directly after this call container_size_ = c.data().size()-b; @@ -131,7 +132,8 @@ senf::detail::ListBParser_Policy::container_policy:: insert(container_type & c, data_iterator p) { size_type b (senf::bytes(ElementParser(p,c.state()))); - AuxPolicy::aux( AuxPolicy::aux(c.i(), c.state())+b, c.i(), c.state()); + AuxPolicy::WrapperPolicy::aux( + AuxPolicy::WrapperPolicy::aux(c.i(), c.state())+b, c.i(), c.state()); ++n_; container_size_ = c.data().size(); } @@ -145,7 +147,7 @@ update(container_type const & c) if (container_size_ == c.data().size()) return; #if 1 - data_iterator i (AuxPolicy::adjust(c.i(), c.state())); + data_iterator i (AuxPolicy::WrapperPolicy::adjust(c.i(), c.state())); data_iterator j (i); for (size_type n (n_); n; --n, std::advance(j,senf::bytes(ElementParser(j,c.state())))) ; aux( std::distance(i,j), c.i(), c.state() ); @@ -161,7 +163,7 @@ senf::detail::ListBParser_Policy::container_policy:: setBegin(container_type const & c, iterator_data & d) const { - return AuxPolicy::adjust(c.i(), c.state()); + return AuxPolicy::WrapperPolicy::adjust(c.i(), c.state()); } template @@ -170,7 +172,7 @@ senf::detail::ListBParser_Policy::container_policy:: setEnd(container_type const & c, iterator_data & d) const { - return boost::next(AuxPolicy::adjust(c.i(), c.state()),aux(c.i(),c.state())); + return boost::next(AuxPolicy::WrapperPolicy::adjust(c.i(), c.state()),aux(c.i(),c.state())); } template diff --git a/senf/Packets/ListBParser.ih b/senf/Packets/ListBParser.ih index c3c8e2e..a69e6f9 100644 --- a/senf/Packets/ListBParser.ih +++ b/senf/Packets/ListBParser.ih @@ -88,7 +88,7 @@ namespace detail { /** \brief Internal: ListBParser container/wrapper policy */ struct container_policy - : public AuxPolicy + : public AuxPolicy::WrapperPolicy { typedef PacketParserBase::data_iterator data_iterator; typedef PacketParserBase::state_type state_type; diff --git a/senf/Packets/ListNParser.cti b/senf/Packets/ListNParser.cti index c10b375..2cf61fa 100644 --- a/senf/Packets/ListNParser.cti +++ b/senf/Packets/ListNParser.cti @@ -35,6 +35,12 @@ prefix_ senf::detail::ListNParser_Policy::ListNParser_P {} template +prefix_ senf::detail::ListNParser_Policy:: +ListNParser_Policy(parser_policy const & policy) + : AuxPolicy(policy) +{} + +template template prefix_ senf::detail::ListNParser_Policy::ListNParser_Policy(Arg const & aux) diff --git a/senf/Packets/ListNParser.ih b/senf/Packets/ListNParser.ih index b6e2042..20bacec 100644 --- a/senf/Packets/ListNParser.ih +++ b/senf/Packets/ListNParser.ih @@ -42,17 +42,22 @@ namespace detail { struct ListNParser_Policy : public AuxPolicy { + typedef ListNParser_Policy< + ElementParser, typename AuxPolicy::ParserPolicy> parser_policy; + typedef ListNParser_Policy< + ElementParser, typename AuxPolicy::WrapperPolicy> container_policy; typedef PacketParserBase::data_iterator data_iterator; typedef PacketParserBase::state_type state_type; typedef PacketParserBase::size_type size_type; typedef ElementParser element_type; - typedef ListParser< ListNParser_Policy > parser_type; - typedef ListParser_Container< ListNParser_Policy > container_type; + typedef ListParser parser_type; + typedef ListParser_Container container_type; static const size_type init_bytes = AuxPolicy::aux_bytes; ListNParser_Policy(); template ListNParser_Policy(Arg const & aux); + ListNParser_Policy(parser_policy const & policy); size_type bytes (data_iterator i, state_type s) const; size_type size (data_iterator i, state_type s) const;