X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FListParser.hh;h=8807578ed0217016cb1450891e082a42b5dcea05;hb=92f8630b75f3ef50e73c48cde58645dcd1534e27;hp=18bc1d645a23f8080cc6da0c0104db3c14822d7d;hpb=43ebe17b77586542dff65f2535815a19812e4316;p=senf.git diff --git a/Packets/ListParser.hh b/Packets/ListParser.hh index 18bc1d6..8807578 100644 --- a/Packets/ListParser.hh +++ b/Packets/ListParser.hh @@ -23,8 +23,8 @@ /** \file \brief ListParser public header */ -#ifndef HH_ListParser_ -#define HH_ListParser_ 1 +#ifndef HH_SENF_Packets_ListParser_ +#define HH_SENF_Packets_ListParser_ 1 // Custom includes #include @@ -58,7 +58,16 @@ namespace senf { You will normally not instantiate ListParser directly, you will use the \ref SENF_PARSER_LIST() helper macro. - \see ExampleListPolicy + Some basic list access methods are defined as parser members. To access the complete list + API however you will need to instantiate a container wrapper for the list. See \ref + packet_usage_fields_collection. + + \see + \ref How to access \ref packet_usage_fields_collection + SENF_PARSER_LIST() macro used to define list fields \n + ListParser_Container list container wrapper API \n + ExampleListPolicy + \ingroup parsecollection */ template @@ -229,17 +238,24 @@ namespace senf { // The size field should be declared private or read-only (size is accessible via the list) SENF_PARSER_PRIVATE_FIELD ( list_size_, senf::UInt16Parser ); // Define the list - SENF_PARSER_VECTOR ( list, list_size_, EltParser ); + SENF_PARSER_LIST ( list, list_size_, EltParser ); \endcode Here \c EltParser can be an arbitrary parser and need not have a fixed size. + \warning Realize, that the \a size field is controlled by the list parser. This field + should therefore be declared either read-only or private and must be changed only via + the list parser. + Further additional tags are supported which modify the type of list created: + + @@ -263,7 +279,7 @@ namespace senf { The tags are applied to the \a size parameter: \code - SENF_PARSER_LIST ( vec, transform(MyTransform, list_size_), EltParser ); + SENF_PARSER_LIST ( list, transform(MyTransform, list_size_), EltParser ); \endcode \warning There are some caveats when working with \c bytes() type lists: @@ -281,6 +297,11 @@ namespace senf { \param[in] size name of field giving the list size \param[in] elt_type list element type + \see + How to use \ref packet_usage_fields_collection \n + senf::ListParser the list parser API for list field access + senf::ListParser_Container the list parser container API for list field access + \hideinitializer \ingroup packetparsermacros */ @@ -301,8 +322,8 @@ namespace senf { ///////////////////////////////hh.e//////////////////////////////////////// #endif -#if !defined(HH_Packets__decls_) && !defined(HH_ListParser_i_) -#define HH_ListParser_i_ +#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_ListParser_i_) +#define HH_SENF_Packets_ListParser_i_ //#include "ListParser.cci" #include "ListParser.ct" #include "ListParser.cti"
\c bytes(\a size)\a size gives the size of the list in bytes not the number of contained elements
\c packetSize()Use the size of the packet to get the list size. The + list will occupy all space up to the end of the packet.
\c transform(\a transform, \a size)The \a transform is applied to the \a size value, the value is not used directly