Every parser is derived from senf::PacketParserBase. This class provides the necessary
housekeeping information and provides the parsers with access to the data.
+
+ \warning Parsers are like iterators: They are invalidated <em>whenever the size of the packet's
+ data is changed</em>. You should not store a parser anywhere. If you want to keep a parser
+ reference, use the senf::SafePacketParser wrapper. You still will need to take extra care to
+ ensure the parser is not invalidated.
*/
#ifndef HH_PacketParser_
struct init_bytes : public detail::ParserInitBytes<Parser>
{};
+# ifndef DOXYGEN
+ template <class Parser>
+ typename boost::enable_if<
+ boost::is_base_of<PacketParserBase, Parser>,
+ Parser >::type
+ operator<<(Parser target, Parser source);
+# else
/** \brief Generic parser copying
This operator allows to copy the values of identical parsers. This operation does \e not
\ingroup packetparser
*/
template <class Parser>
- typename boost::enable_if<
- boost::is_base_of<PacketParserBase, Parser>,
- Parser >::type
- operator<<(Parser target, Parser source);
+ Parser operator<<(Parser target, Parser source);
+# endif
+# ifndef DOXYGEN
+ template <class Parser, class Value>
+ typename boost::enable_if_c <
+ boost::is_base_of<PacketParserBase, Parser>::value
+ && ! boost::is_base_of<PacketParserBase, Value>::value,
+ Parser >::type
+ operator<<(Parser target, Value const & value);
+# else
/** \brief Generic parser value assignment
This operator allows to assign a value to parsers which implement a <tt>value(</tt>\a
\ingroup packetparser
*/
template <class Parser, class Value>
- typename boost::enable_if_c <
- boost::is_base_of<PacketParserBase, Parser>::value
- && ! boost::is_base_of<PacketParserBase, Value>::value,
- Parser >::type
- operator<<(Parser target, Value const & value);
+ Parser operator<<(Parser target, Value const & value);
+# endif
/** \defgroup packetparsermacros Helper macros for defining new packet parsers
location will \e not be updated accordingly and therefore the parser will be
invalid.
- Additionally a SafePacketparser has an uninitialized state. The only allowed operations in
+ Additionally a SafePacketParser has an uninitialized state. The only allowed operations in
this state are the boolean test for validity and assigning another parser.
+
+ \ingroup packetparser
*/
template <class Parser>
class SafePacketParser