@@ -132,17 +132,7 @@ bool WiresharkField::wiresharkPrepare()
132132
133133std::string WiresharkField::wiresharkDissectName (const WiresharkField* refField) const
134134{
135- const auto * genField = &m_genField;
136- if (refField != nullptr ) {
137- genField = &(refField->wiresharkGenField ());
138- }
139-
140- if (!genField->genIsReferenced ()) {
141- return strings::genEmptyString ();
142- }
143-
144- auto & wiresharkGenerator = WiresharkGenerator::wiresharkCast (genField->genGenerator ());
145- return wiresharkGenerator.wiresharkDissectNameFor (*genField);
135+ return wiresharkDissectNameImpl (refField);
146136}
147137
148138std::string WiresharkField::wiresharkDissectCode (const WiresharkField* refField) const
@@ -153,6 +143,7 @@ std::string WiresharkField::wiresharkDissectCode(const WiresharkField* refField)
153143 }
154144
155145 if (!genField->genIsReferenced ()) {
146+ genField->genGenerator ().genLogger ().genDebug (" Field " + genField->genName () + " is not really referenced, skipping dissect code generation" );
156147 return strings::genEmptyString ();
157148 }
158149
@@ -199,19 +190,39 @@ std::string WiresharkField::wiresharkDissectCode(const WiresharkField* refField)
199190}
200191
201192std::string WiresharkField::wiresharkFieldObjName (const WiresharkField* refField) const
193+ {
194+ return wiresharkFieldObjNameImpl (refField);
195+ }
196+
197+ std::string WiresharkField::wiresharkFieldRegistration (const WiresharkField* refField) const
198+ {
199+ return wiresharkFieldRegistrationImpl (refField);
200+ }
201+
202+ std::string WiresharkField::wiresharkDissectNameImpl (const WiresharkField* refField) const
202203{
203204 const auto * genField = &m_genField;
204205 if (refField != nullptr ) {
205206 genField = &(refField->wiresharkGenField ());
206207 }
208+
209+ if (!genField->genIsReferenced ()) {
210+ return strings::genEmptyString ();
211+ }
212+
207213 auto & wiresharkGenerator = WiresharkGenerator::wiresharkCast (genField->genGenerator ());
208- auto scope = comms::genScopeFor (*genField, wiresharkGenerator, false );
209- return Wireshark::wiresharkProtocolObjName (wiresharkGenerator) + ' _' + util::genStrReplace (scope, " ::" , " _" );
214+ return wiresharkGenerator.wiresharkDissectNameFor (*genField);
210215}
211216
212- std::string WiresharkField::wiresharkFieldRegistration (const WiresharkField* refField) const
217+ std::string WiresharkField::wiresharkFieldObjNameImpl (const WiresharkField* refField) const
213218{
214- return wiresharkFieldRegistrationImpl (refField);
219+ const auto * genField = &m_genField;
220+ if (refField != nullptr ) {
221+ genField = &(refField->wiresharkGenField ());
222+ }
223+ auto & wiresharkGenerator = WiresharkGenerator::wiresharkCast (genField->genGenerator ());
224+ auto scope = comms::genScopeFor (*genField, wiresharkGenerator, false );
225+ return Wireshark::wiresharkProtocolObjName (wiresharkGenerator) + ' _' + util::genStrReplace (scope, " ::" , " _" );
215226}
216227
217228std::string WiresharkField::wiresharkFieldRegistrationImpl ([[maybe_unused]] const WiresharkField* refField) const
@@ -236,6 +247,11 @@ std::string WiresharkField::wiresharkFieldRefName(const WiresharkField* refField
236247 return Wireshark::wiresharkProtocolObjName (wiresharkGenerator) + ' .' + util::genStrReplace (scope, " ::" , " ." );
237248}
238249
250+ bool WiresharkField::wiresharkIsBitfieldMember () const
251+ {
252+ return wiresharkParentBitfieldInternal (*this ) != nullptr ;
253+ }
254+
239255std::string WiresharkField::wiresharkForcedIntegralFieldMask (const WiresharkField* refField) const
240256{
241257 if (refField == nullptr ) {
@@ -342,6 +358,14 @@ std::string WiresharkField::wiresharkFieldNameVarNameStr(const WiresharkField* r
342358 return wiresharkFieldObjName (refField) + strings::genNameSuffixStr ();
343359}
344360
361+ bool WiresharkField::wiresharkHasOverrideCode () const
362+ {
363+ return
364+ m_customCode.m_hasRead ||
365+ m_customCode.m_hasValid ||
366+ m_customCode.m_hasName ;
367+ }
368+
345369bool WiresharkField::wiresharkCopyCodeFromInternal ()
346370{
347371 auto obj = m_genField.genParseObj ();
0 commit comments