// $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. #ifndef IH_ParserBase_ #define IH_ParserBase_ 1 // Custom includes ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { namespace impl { struct ParserBase {}; template struct Parser_traits_sentinel { int v[N]; }; template struct Parser_traits_fixed_size { // This differentiates between bytes being a static or // non-static member of Parser ... static const bool fixed_size = sizeof( Parser_traits_fixed_size_check(&Parser::bytes))-sizeof(Parser_traits_sentinel<1>); }; template Parser_traits_sentinel<2> Parser_traits_fixed_size_check(R (*)()); template Parser_traits_sentinel<1> Parser_traits_fixed_size_check(R (T::*)() const); template bool check(Iterator const & b, Iterator const & e, ParserBase *); template bool check(Iterator const & b, Iterator const & e, void *); template struct ParserCheck { template static unsigned check(Iterator const & b, Iterator const & e) { return Parser::check(b,e); } }; template struct ParserCheck { template static unsigned check(Iterator const & b, Iterator const & e) { return unsigned(e-b) >= Parser::bytes(); } }; template unsigned min_bytes(ParserBase *); template unsigned min_bytes(void *); template struct ParserMinBytes { static unsigned bytes() { return Parser::min_bytes(); } }; template struct ParserMinBytes { static unsigned bytes() { return Parser::bytes(); } }; }} ///////////////////////////////ih.e//////////////////////////////////////// #endif // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // End: