Packets/80221Bundle: fix for MIHF_Id parser
[senf.git] / senf / Packets / StringParser.hh
index bc0ffb2..022f25f 100644 (file)
 #endif
 
 // Custom includes
+#include "IntParser.hh"
 
 //#include "StringParser.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 
 namespace senf {
     
-    struct StringParser
+    template <class LengthParser=senf::UInt16Parser>
+    class StringParser
         : public PacketParserBase
     {
-
+    public:
         StringParser(data_iterator i, state_type s);
 
         ///////////////////////////////////////////////////////////////////////////
 
+#       include SENF_PARSER()
+        SENF_PARSER_PRIVATE_FIELD ( length, LengthParser );
+        
         typedef std::string value_type;
-        static const size_type init_bytes = 2;
+        static const size_type init_bytes = senf::init_bytes<LengthParser>::value;
         size_type bytes() const;
         
         value_type value() const;
@@ -55,7 +60,8 @@ namespace senf {
         StringParser const & operator=(value_type other);
     };
 
-    std::ostream & operator<<(std::ostream & os, StringParser const & value);
+    template <class LengthParser>
+    std::ostream & operator<<(std::ostream & os, StringParser<LengthParser> const & value);
     
 }
 
@@ -63,9 +69,9 @@ namespace senf {
 #endif
 #if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_StringParser_i_)
 #define HH_SENF_Packets_StringParser_i_
-#include "StringParser.cci"
+//#include "StringParser.cci"
 //#include "StringParser.ct"
-//#include "StringParser.cti"
+#include "StringParser.cti"
 #endif
 
 \f