mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
binpac: Add 'override' to virtual methods in generated code
This commit is contained in:
parent
28cc9ca3ec
commit
ef962376bc
4 changed files with 11 additions and 5 deletions
|
@ -8,14 +8,14 @@ namespace binpac {
|
|||
// The interface for a connection analyzer
|
||||
class ConnectionAnalyzer {
|
||||
public:
|
||||
virtual ~ConnectionAnalyzer() {}
|
||||
virtual ~ConnectionAnalyzer() = default;
|
||||
virtual void NewData(bool is_orig, const unsigned char* begin_of_data, const unsigned char* end_of_data) = 0;
|
||||
};
|
||||
|
||||
// The interface for a flow analyzer
|
||||
class FlowAnalyzer {
|
||||
public:
|
||||
virtual ~FlowAnalyzer() {}
|
||||
virtual ~FlowAnalyzer() = default;
|
||||
virtual void NewData(const unsigned char* begin_of_data, const unsigned char* end_of_data) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void ConnDecl::GenGapFunc(Output* out_h, Output* out_cc) {
|
|||
void ConnDecl::GenProcessFunc(Output* out_h, Output* out_cc) {
|
||||
string proto = strfmt("%s(bool is_orig, const_byteptr begin, const_byteptr end)", kNewData);
|
||||
|
||||
out_h->println("void %s;", proto.c_str());
|
||||
out_h->println("void %s override;", proto.c_str());
|
||||
|
||||
out_cc->println("void %s::%s {", class_name().c_str(), proto.c_str());
|
||||
out_cc->inc_indent();
|
||||
|
|
|
@ -151,7 +151,7 @@ void FlowDecl::GenProcessFunc(Output* out_h, Output* out_cc) {
|
|||
string proto = strfmt("%s(const_byteptr %s, const_byteptr %s)", kNewData, env_->LValue(begin_of_data),
|
||||
env_->LValue(end_of_data));
|
||||
|
||||
out_h->println("void %s;", proto.c_str());
|
||||
out_h->println("void %s override;", proto.c_str());
|
||||
|
||||
out_cc->println("void %s::%s {", class_name().c_str(), proto.c_str());
|
||||
out_cc->inc_indent();
|
||||
|
|
|
@ -178,9 +178,15 @@ void TypeDecl::GenConstructorFunc(Output* out_h, Output* out_cc) {
|
|||
}
|
||||
|
||||
void TypeDecl::GenDestructorFunc(Output* out_h, Output* out_cc) {
|
||||
vector<string> base_classes;
|
||||
AddBaseClass(&base_classes);
|
||||
|
||||
string proto = strfmt("~%s()", class_name().c_str());
|
||||
|
||||
if ( base_classes.empty() )
|
||||
out_h->println("%s;", proto.c_str());
|
||||
else
|
||||
out_h->println("%s override;", proto.c_str());
|
||||
|
||||
out_cc->println("%s::%s {", class_name().c_str(), proto.c_str());
|
||||
out_cc->inc_indent();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue