00001 // $Id: StringParser.hh 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2009 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #ifndef HH_SENF_Packets_StringParser_ 00027 #define HH_SENF_Packets_StringParser_ 1 00028 00029 #ifndef HH_SENF_Packets_Packets_ 00030 #error "Don't include 'StringParser.hh' directly, include 'Packets.hh'" 00031 #endif 00032 00033 // Custom includes 00034 #include "IntParser.hh" 00035 00036 //#include "StringParser.mpp" 00037 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00038 00039 namespace senf { 00040 00041 template <class LengthParser=senf::UInt16Parser> 00042 class StringParser 00043 : public PacketParserBase 00044 { 00045 public: 00046 StringParser(data_iterator i, state_type s); 00047 00048 //-//////////////////////////////////////////////////////////////////////// 00049 00050 # include SENF_PARSER() 00051 SENF_PARSER_PRIVATE_FIELD ( length, LengthParser ); 00052 00053 typedef std::string value_type; 00054 static const size_type init_bytes = senf::init_bytes<LengthParser>::value; 00055 size_type bytes() const; 00056 00057 value_type value() const; 00058 void value(value_type v); 00059 operator value_type() const; 00060 StringParser const & operator=(value_type other); 00061 }; 00062 00063 template <class LengthParser> 00064 std::ostream & operator<<(std::ostream & os, StringParser<LengthParser> const & value); 00065 00066 } 00067 00068 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00069 #endif 00070 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_StringParser_i_) 00071 #define HH_SENF_Packets_StringParser_i_ 00072 //#include "StringParser.cci" 00073 //#include "StringParser.ct" 00074 #include "StringParser.cti" 00075 #endif 00076 00077 00078 // Local Variables: 00079 // mode: c++ 00080 // fill-column: 100 00081 // comment-column: 40 00082 // c-file-style: "senf" 00083 // indent-tabs-mode: nil 00084 // ispell-local-dictionary: "american" 00085 // compile-command: "scons -u test" 00086 // End: