X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FListNParser.ct;h=5b19099c922b6fe354b1f16424d6a4fb0debede2;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=6d97545ef14ede27804421b5803bc1148cfe50f5;hpb=f73fa16ed5abdce272ac77f8b8b9ef2b9922c266;p=senf.git diff --git a/Packets/ListNParser.ct b/Packets/ListNParser.ct index 6d97545..5b19099 100644 --- a/Packets/ListNParser.ct +++ b/Packets/ListNParser.ct @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -26,40 +26,42 @@ #include "ListNParser.ih" // Custom includes +#include "../Utils/senfassert.hh" #define prefix_ ///////////////////////////////ct.p//////////////////////////////////////// -template +template prefix_ void -senf::detail::ListNParser_Policy::iterator_policy:: -setFromPosition(iterator i, state_type s, iterator p) +senf::detail::ListNParser_Policy::setFromPosition(container_type const & c, + iterator_data & d, + data_iterator p) + const { - l_ = i; - if (p == data(s).end()) { - n_ = 0; + if (p == c.data().end()) { + d.n_ = 0; return; } - n_ = SizeParser(i,s); - iterator j (boost::next(i,SizeParser::fixed_bytes)); - for (; n_; --n_, j += ElementParser(j,s).bytes()) + d.n_ = this->aux(c.i(),c.state()); + data_iterator j (this->adjust(c.i(),c.state())); + for (; d.n_; --d.n_, j += ElementParser(j,c.state()).bytes()) if (j==p) return; - BOOST_ASSERT( false ); + SENF_ASSERT( false ); } -template -prefix_ typename senf::detail::ListNParser_Policy::iterator -senf::detail::ListNParser_Policy::iterator_policy::raw(iterator i, - state_type s) +template +prefix_ typename senf::detail::ListNParser_Policy::data_iterator +senf::detail::ListNParser_Policy::raw(container_type const & c, + iterator_data const & d) const { - if (i != data(s).end()) - return i; - size_type n (SizeParser(l_,s)); - iterator j (boost::next(l_,SizeParser::fixed_bytes)); + if (container_type::iterator::get(d).i() != c.data().end()) + return container_type::iterator::get(d).i(); + size_type n (this->aux(c.i(),c.state())); + data_iterator j (this->adjust(c.i(),c.state())); for (; n; --n) - j += ElementParser(j,s).bytes(); + j += ElementParser(j,c.state()).bytes(); return j; }