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
00030 #define prefix_ inline
00031
00032
00033 template <class ElementParser, class AuxPolicy>
00034 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy()
00035 {}
00036
00037 template <class ElementParser, class AuxPolicy>
00038 prefix_ senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::
00039 ListNParser_Policy(parser_policy const & policy)
00040 : AuxPolicy(policy)
00041 {}
00042
00043 template <class ElementParser, class AuxPolicy>
00044 template <class Arg>
00045 prefix_
00046 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::ListNParser_Policy(Arg const & aux)
00047 : AuxPolicy (aux)
00048 {}
00049
00050 template <class ElementParser, class AuxPolicy>
00051 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
00052 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::bytes(data_iterator i, state_type s)
00053 const
00054 {
00055 container_type c (parser_type(*this, i, s));
00056 return std::distance(i,c.end().raw());
00057 }
00058
00059 template <class ElementParser, class AuxPolicy>
00060 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size_type
00061 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::size(data_iterator i, state_type s)
00062 const
00063 {
00064 return AuxPolicy::aux(i,s);
00065 }
00066
00067 template <class ElementParser, class AuxPolicy>
00068 prefix_ void senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::init(data_iterator i,
00069 state_type s)
00070 const
00071 {
00072 AuxPolicy::aux(0,i,s);
00073 }
00074
00075 template <class ElementParser, class AuxPolicy>
00076 prefix_ void
00077 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::construct(container_type & c)
00078 const
00079 {}
00080
00081 template <class ElementParser, class AuxPolicy>
00082 prefix_ void
00083 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::destruct(container_type & c)
00084 const
00085 {}
00086
00087 template <class ElementParser, class AuxPolicy>
00088 prefix_ void
00089 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::erase(container_type & c,
00090 data_iterator p)
00091 const
00092 {
00093 this->aux(this->aux(c.i(),c.state())-1,c.i(),c.state());
00094 }
00095
00096 template <class ElementParser, class AuxPolicy>
00097 prefix_ void
00098 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::insert(container_type & c,
00099 data_iterator p)
00100 const
00101 {
00102 this->aux(this->aux(c.i(),c.state())+1,c.i(),c.state());
00103 }
00104
00105 template <class ElementParser, class AuxPolicy>
00106 prefix_ void
00107 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::update(container_type const & c)
00108 const
00109 {}
00110
00111 template <class ElementParser, class AuxPolicy>
00112 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00113 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setBegin(container_type const & c,
00114 iterator_data & d)
00115 const
00116 {
00117 d.n_ = this->aux(c.i(),c.state());
00118 return d.n_ ? this->adjust(c.i(),c.state()) : c.data().end();
00119 }
00120
00121 template <class ElementParser, class AuxPolicy>
00122 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00123 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::setEnd(container_type const & c,
00124 iterator_data & d)
00125 const
00126 {
00127 d.n_ = 0;
00128 return c.data().end();
00129 }
00130
00131 template <class ElementParser, class AuxPolicy>
00132 prefix_ typename senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::data_iterator
00133 senf::detail::ListNParser_Policy<ElementParser,AuxPolicy>::next(container_type const & c,
00134 iterator_data & d)
00135 const
00136 {
00137 --d.n_;
00138 return d.n_ ? boost::next( container_type::iterator::get(d).i(),
00139 senf::bytes(* container_type::iterator::get(d)) )
00140 : c.data().end();
00141 }
00142
00143
00144 #undef prefix_
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155