@@ -36,7 +36,7 @@ WiresharkEnumField::WiresharkEnumField(WiresharkGenerator& generator, ParseField
3636{
3737}
3838
39- std::string WiresharkEnumField::wiresharkFieldRegistrationImpl (const std::string& objName, const std::string& refName ) const
39+ std::string WiresharkEnumField::wiresharkFieldRegistrationImpl (const WiresharkField* refField ) const
4040{
4141 static const std::string Templ =
4242 " #^#VALS#$#\n "
@@ -45,26 +45,18 @@ std::string WiresharkEnumField::wiresharkFieldRegistrationImpl(const std::string
4545
4646 auto obj = genEnumFieldParseObj ();
4747 util::GenReplacementMap repl = {
48- {" VALS" , wiresharkValsInternal ()},
49- {" OBJ_NAME" , objName },
48+ {" VALS" , wiresharkValsInternal (refField )},
49+ {" OBJ_NAME" , wiresharkFieldObjName (refField) },
5050 {" CREATE_FUNC" , Wireshark::wiresharkCreateFieldFuncName (WiresharkGenerator::wiresharkCast (genGenerator ()))},
51- {" TYPE" , wiresharkForcedIntegralFieldType ()},
52- {" REF_NAME" , refName },
53- {" DISP_NAME" , util::genDisplayName (obj. parseDisplayName (), obj. parseName () )},
54- {" VALS_NAME" , wiresharkFieldObjName () + strings::genValsSuffixStr ()},
51+ {" TYPE" , wiresharkForcedIntegralFieldType (refField )},
52+ {" REF_NAME" , wiresharkFieldRefName (refField) },
53+ {" DISP_NAME" , wiresharkFieldDisplayNameStr (refField )},
54+ {" VALS_NAME" , wiresharkFieldObjName (refField ) + strings::genValsSuffixStr ()},
5555 {" BASE" , " base.DEC_HEX" },
56- {" MASK" , wiresharkForcedIntegralFieldMask ()},
57- {" DESC" , wiresharkFieldDescriptionStr ()},
56+ {" MASK" , wiresharkForcedIntegralFieldMask (refField )},
57+ {" DESC" , wiresharkFieldDescriptionStr (refField )},
5858 };
5959
60- if (repl[" OBJ_NAME" ].empty ()) {
61- repl[" OBJ_NAME" ] = wiresharkFieldObjName ();
62- }
63-
64- if (repl[" REF_NAME" ].empty ()) {
65- repl[" REF_NAME" ] = wiresharkFieldRefName ();
66- }
67-
6860 if (obj.parseHexAssign ()) {
6961 repl[" BASE" ] = " base.HEX_DEC" ;
7062 }
@@ -80,7 +72,7 @@ std::string WiresharkEnumField::wiresharkFieldRegistrationImpl(const std::string
8072 return util::genProcessTemplate (Templ, repl);
8173}
8274
83- std::string WiresharkEnumField::wiresharkValsInternal () const
75+ std::string WiresharkEnumField::wiresharkValsInternal (const WiresharkField* refField ) const
8476{
8577 auto & values = genSortedRevValues ();
8678 assert (!values.empty ());
@@ -118,7 +110,7 @@ std::string WiresharkEnumField::wiresharkValsInternal() const
118110 ;
119111
120112 util::GenReplacementMap repl = {
121- {" NAME" , wiresharkFieldObjName ()},
113+ {" NAME" , wiresharkFieldObjName (refField )},
122114 {" SUFFIX" , strings::genValsSuffixStr ()},
123115 {" ELEMS" , util::genStrListToString (elems, " ,\n " , " " )},
124116 };
0 commit comments