00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00026 #include "ListNParser.ih"
00027
00028
00029 #include <senf/Utils/senfassert.hh>
00030
00031 #define prefix_
00032
00033
00034 template <class ElementParser, class AuxPolicy>
00035 prefix_ void
00036 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setFromPosition(container_type const & c,
00037 iterator_data & d,
00038 data_iterator p)
00039 const
00040 {
00041 if (p == c.data().end()) {
00042 d.n_ = 0;
00043 return;
00044 }
00045 d.n_ = this->aux(c.i(),c.state());
00046 data_iterator j (this->adjust(c.i(),c.state()));
00047 for (; d.n_; --d.n_, j += ElementParser(j,c.state()).bytes())
00048 if (j==p)
00049 return;
00050 SENF_ASSERT( false, "setFromPosition: position does not point to any list element" );
00051 }
00052
00053 template <class ElementParser, class AuxPolicy>
00054 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00055 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::raw(container_type const & c,
00056 iterator_data const & d)
00057 const
00058 {
00059 if (container_type::iterator::get(d).i() != c.data().end())
00060 return container_type::iterator::get(d).i();
00061 size_type n (this->aux(c.i(),c.state()));
00062 data_iterator j (this->adjust(c.i(),c.state()));
00063 for (; n; --n)
00064 j += ElementParser(j,c.state()).bytes();
00065 return j;
00066 }
00067
00068
00069 #undef prefix_
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080