X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FVectorParser.ih;h=9f6771c4e60f41cec3764740ee3ab367a8f969ea;hb=166490fa7396b56c717ab4efea4551b8c5581ef9;hp=6da8f4901df0714f192505238225f271c6278cca;hpb=4ee78597a1dae53669f5295cbb686c58146d2449;p=senf.git diff --git a/Packets/VectorParser.ih b/Packets/VectorParser.ih index 6da8f49..9f6771c 100644 --- a/Packets/VectorParser.ih +++ b/Packets/VectorParser.ih @@ -42,12 +42,48 @@ namespace detail { > BOOST_PP_CAT(name, _vec_t); \ field( name, BOOST_PP_CAT(name, _vec_t) ) + template + struct VectorParserPolicy + {}; + + template + struct VectorParserPolicy + { + typedef AuxPolicy type; + }; + + template + struct VectorParserPolicy > + { + typedef senf::detail::TransformAuxParserPolicy type; + }; + + template + struct VectorParserBytesTransform + { + typedef PacketParserBase::size_type value_type; + static value_type get(value_type v) { return v/fixedSize; } + static value_type set(value_type v) { return v*fixedSize; } + }; + + template + struct VectorParserPolicy + { + typedef senf::detail::TransformAuxParserPolicy< + AuxPolicy, + VectorParserBytesTransform > type; + }; + template struct VectorParserTraits { template struct parser { - typedef senf::VectorParser type; + typedef senf::VectorParser< + ElementParser, + typename VectorParserPolicy::type > type; }; };