// $Id$ // // Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund // // 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 #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// template prefix_ senf::Parse_ListS::Parse_ListS() {} template prefix_ senf::Parse_ListS::Parse_ListS(Iterator const & i) : ParserBase(i) {} template prefix_ typename senf::Parse_ListS::size_type senf::Parse_ListS::size() const { return std::distance(begin(),end()); } template prefix_ bool senf::Parse_ListS::empty() const { return begin()==end(); } template prefix_ typename senf::Parse_ListS::iterator senf::Parse_ListS::begin() const { return iterator(this->i()); } template prefix_ typename senf::Parse_ListS::iterator senf::Parse_ListS::end() const { return iterator(); } template prefix_ typename senf::Parse_ListS::range_type senf::Parse_ListS::range() const { return std::make_pair(begin(),end()); } template prefix_ typename senf::Parse_ListS::range_type senf::Parse_ListS::value() const { return range(); } /////////////////////////////////////////////////////////////////////////// // senf::impl::Parse_ListS_iterator template prefix_ senf::impl::Parse_ListS_iterator::Parse_ListS_iterator() : i_(), atEnd_(true) {} template prefix_ senf::impl::Parse_ListS_iterator:: Parse_ListS_iterator(Iterator const & i) : i_(i), atEnd_(false) { atEnd_ = Sentinel::check(dereference()); } template prefix_ Iterator senf::impl::Parse_ListS_iterator::raw() const { return i_; } template prefix_ Parser senf::impl::Parse_ListS_iterator::dereference() const { return Parser(i_); } template prefix_ bool senf::impl::Parse_ListS_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 prefix_ void senf::impl::Parse_ListS_iterator::increment() { BOOST_ASSERT( !atEnd_ ); i_ += dereference().bytes(); atEnd_ = Sentinel::check(dereference()); } /////////////////////////////////////////////////////////////////////////// // senf::Parse_ListS_wrapper template template prefix_ senf::Parse_ListS_wrapper:: Parse_ListS_wrapper(Parse_ListS const & list, Container & container) : i_(list.i()-container.begin()), container_(container) {} template prefix_ typename senf::Parse_ListS_wrapper::size_type senf::Parse_ListS_wrapper::size() const { return std::distance(begin(),end()); } template prefix_ bool senf::Parse_ListS_wrapper::empty() const { return begin()==end(); } template prefix_ typename senf::Parse_ListS_wrapper::iterator senf::Parse_ListS_wrapper::begin() const { return iterator(container_.begin()+i_); } template prefix_ typename senf::Parse_ListS_wrapper::iterator senf::Parse_ListS_wrapper::end() const { return iterator(); } template prefix_ typename senf::Parse_ListS_wrapper::range_type senf::Parse_ListS_wrapper::range() const { return std::make_pair(begin(),end()); } ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // End: