Newer
Older
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Definition of inline template functions
#include "ParseListS.ih"
// Custom includes
#include <boost/assert.hpp>
#define prefix_ inline
///////////////////////////////cti.p///////////////////////////////////////
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::Parse_ListS()
{}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::Parse_ListS(Iterator const & i)
: ParserBase<Iterator,IPacket>(i)
{}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ typename senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::size_type
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::size()
const
{
return std::distance(begin(),end());
}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ bool senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::empty()
const
{
return begin()==end();
}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ typename senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::iterator
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::begin()
const
{
return iterator(this->i());
}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ typename senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::iterator
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::end()
const
{
return iterator();
}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ typename senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range_type
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range()
const
{
return std::make_pair(begin(),end());
}
template <class Parser, class Sentinel, class Iterator, class IPacket>
prefix_ typename senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::range_type
senf::Parse_ListS<Parser,Sentinel,Iterator,IPacket>::value()
const
{
return range();
}
///////////////////////////////////////////////////////////////////////////
// senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>
template <class Parser, class Sentinel, class Iterator>
prefix_
senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::Parse_ListS_iterator()
: i_(), atEnd_(true)
{}
template <class Parser, class Sentinel, class Iterator>
senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::
Parse_ListS_iterator(Iterator const & i)
: i_(i), atEnd_(false)
{
atEnd_ = Sentinel::check(dereference());
}
template <class Parser, class Sentinel, class Iterator>
prefix_ Iterator senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::raw()
const
{
return i_;
}
template <class Parser, class Sentinel, class Iterator>
prefix_ Parser
senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::dereference()
const
{
return Parser(i_);
}
template <class Parser, class Sentinel, class Iterator>
prefix_ bool senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::
equal(Parse_ListS_iterator const & other)
const
{
// !! We cannot compare the to iterators if either
// !! Iterator is atEnd_, since one of the iterators
// !! might be a default-constructed iterator and
// !! iterators can only be compared with each other
// !! if both point to the *same* valid container
if (atEnd_ || other.atEnd_) return atEnd_ == other.atEnd_;
return i_ == other.i_;
}
template <class Parser, class Sentinel, class Iterator>
prefix_ void senf::impl::Parse_ListS_iterator<Parser,Sentinel,Iterator>::increment()
{
BOOST_ASSERT( !atEnd_ );
i_ += dereference().bytes();
atEnd_ = Sentinel::check(dereference());
}
///////////////////////////////////////////////////////////////////////////
// senf::Parse_ListS_wrapper<Parser,Sentinel,Container>
template <class Parser, class Sentinel, class Container>
template <class P, class S, class I, class IP>
prefix_ senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::
Parse_ListS_wrapper(Parse_ListS<P,S,I,IP> const & list, Container & container)
: i_(list.i()-container.begin()), container_(container)
{}
template <class Parser, class Sentinel, class Container>
prefix_ typename senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::size_type
senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::size()
const
{
return std::distance(begin(),end());
}
template <class Parser, class Sentinel, class Container>
prefix_ bool senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::empty()
const
{
return begin()==end();
}
template <class Parser, class Sentinel, class Container>
prefix_ typename senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::iterator
senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::begin()
const
{
return iterator(container_.begin()+i_);
}
template <class Parser, class Sentinel, class Container>
prefix_ typename senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::iterator
senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::end()
const
{
return iterator();
}
template <class Parser, class Sentinel, class Container>
prefix_ typename senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::range_type
senf::Parse_ListS_wrapper<Parser,Sentinel,Container>::range()
const
{
return std::make_pair(begin(),end());
}
///////////////////////////////cti.e///////////////////////////////////////
#undef prefix_
// Local Variables:
// mode: c++
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"