switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Packets / StringParser.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Stefan Bund <g0dil@berlios.de>
27
28 /** \file
29     \brief StringParser public header */
30
31 #ifndef HH_SENF_Packets_StringParser_
32 #define HH_SENF_Packets_StringParser_ 1
33
34 #ifndef HH_SENF_Packets_Packets_
35 #error "Don't include 'StringParser.hh' directly, include 'Packets.hh'"
36 #endif
37
38 // Custom includes
39 #include "IntParser.hh"
40
41 //#include "StringParser.mpp"
42 //-/////////////////////////////////////////////////////////////////////////////////////////////////
43
44 namespace senf {
45
46     template <class LengthParser=senf::UInt16Parser>
47     class StringParser
48         : public PacketParserBase
49     {
50     public:
51         StringParser(data_iterator i, state_type s);
52
53         //-////////////////////////////////////////////////////////////////////////
54
55 #       include SENF_PARSER()
56         SENF_PARSER_PRIVATE_FIELD ( length, LengthParser );
57
58         typedef std::string value_type;
59         static const size_type init_bytes = senf::init_bytes<LengthParser>::value;
60         size_type bytes() const;
61
62         value_type value() const;
63         void value(value_type v);
64         operator value_type() const;
65         StringParser const & operator=(value_type other);
66     };
67
68     template <class LengthParser>
69     std::ostream & operator<<(std::ostream & os, StringParser<LengthParser> const & value);
70
71 }
72
73 //-/////////////////////////////////////////////////////////////////////////////////////////////////
74 #endif
75 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_StringParser_i_)
76 #define HH_SENF_Packets_StringParser_i_
77 //#include "StringParser.cci"
78 //#include "StringParser.ct"
79 #include "StringParser.cti"
80 #endif
81
82 \f
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // comment-column: 40
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u test"
91 // End: