Packets: Add StringParser ostream operation
[senf.git] / Packets / PacketParser.hh
index 1e389da..b5ef0ea 100644 (file)
     parsers). When defining composite parsers without the help of the \ref packetparsermacros, you
     should provide those same members.
 
-    \subsection parserimpl_packet Packet parsers
+    \subsection parserimpl_packet Protocol parsers
 
-    Packet parsers are composite parsers with relaxed requirements. Since a packet parser will never
-    be used as a sub-parser (it will not be used within another composite parser or as value type in
-    a collection parser), the value returned by senf::bytes for this parser must not necessarily
-    cover the complete packet (e.g. if the packet has a trailer, the trailer will live outside the
-    range given by senf::bytes). You may define any member you want to have in your packets field
-    interface. These members may access the packet data in any way. You just need to ensure, that
-    the integration into the packet-type is correct (the senf::PacketTypeMixin will by default use
-    senf::bytes() to find the end of the header).
+    Protocol parsers are composite parsers with relaxed requirements. Since a Protocol parser will
+    never be used as a sub-parser (it will not be used within another composite parser or as value
+    type in a collection parser), the value returned by senf::bytes for this parser must not
+    necessarily cover the complete packet (e.g. if the packet has a trailer, the trailer will live
+    outside the range given by senf::bytes). You may define any member you want to have in your
+    packets field interface. These members may access the packet data in any way. You just need to
+    ensure, that the integration into the packet-type is correct (the senf::PacketTypeMixin will by
+    default use senf::bytes() to find the end of the header).
 
     <hr>
  */
 
-#ifndef HH_PacketParser_
-#define HH_PacketParser_ 1
+#ifndef HH_SENF_Packets_PacketParser_
+#define HH_SENF_Packets_PacketParser_ 1
 
 // Custom includes
 #include <boost/utility/enable_if.hpp>
@@ -354,6 +354,16 @@ namespace senf {
                                              parsers when access to previous or following packets is
                                              needed e.g. for calculating checksums etc. */
 
+        void resize(size_type oldSize, size_type newSize); ///< Resize data container
+                                        /**< This command will erase or insert bytes from/into the
+                                             data container at the end of the parser (at i() + \a
+                                             newSize). If \a oldSize is > \a newSize, bytes will be
+                                             removed, otherwise bytes will be inserted.
+
+                                             \warning This may invalidate iterators and other
+                                                 parsers. The current parser itself is automatically
+                                                 updated */
+
     private:
         data_iterator end() const;
 
@@ -402,6 +412,20 @@ namespace senf {
     struct init_bytes : public detail::ParserInitBytes<Parser>
     {};
 
+    /** \brief Test, whether a parser is a fixed-size parser
+
+        This meta-function is called like
+        \code
+            senf::is_fixed<SomeParser>::value
+        \endcode
+
+        This expression evaluates to a compile-time constant boolean expression which is \c true, if
+        \a SomeParser is a fixed size parser, \c false otherwise
+
+        \param[in] Parser The Parser to test
+        \returns \c true, if \a Parser is fixed size, \c false otherwise
+        \ingroup packetparser
+     */
     template <class Parser>
     struct is_fixed : public detail::ParserIsFixed<Parser>
     {};
@@ -485,8 +509,8 @@ namespace senf {
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
-#if !defined(HH_Packets__decls_) && !defined(HH_PacketParser_i_)
-#define HH_PacketParser_i_
+#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_PacketParser_i_)
+#define HH_SENF_Packets_PacketParser_i_
 #include "PacketParser.cci"
 #include "PacketParser.ct"
 #include "PacketParser.cti"