Move base Tag class to zeek namespace

This commit is contained in:
Tim Wojtulewicz 2020-07-01 14:19:13 -07:00
parent 8517d70e52
commit 87054d9d6b
10 changed files with 53 additions and 45 deletions

View file

@ -3,6 +3,8 @@
#include "Tag.h" #include "Tag.h"
#include "Val.h" #include "Val.h"
namespace zeek {
Tag::Tag(const zeek::EnumTypePtr& etype, type_t arg_type, subtype_t arg_subtype) Tag::Tag(const zeek::EnumTypePtr& etype, type_t arg_type, subtype_t arg_subtype)
{ {
assert(arg_type > 0); assert(arg_type > 0);
@ -92,3 +94,5 @@ std::string Tag::AsString() const
{ {
return fmt("%" PRIu32 "/%" PRIu32, type, subtype); return fmt("%" PRIu32 "/%" PRIu32, type, subtype);
} }
} // namespace zeek

View file

@ -14,9 +14,9 @@ ZEEK_FORWARD_DECLARE_NAMESPACED(EnumVal, zeek);
ZEEK_FORWARD_DECLARE_NAMESPACED(EnumType, zeek); ZEEK_FORWARD_DECLARE_NAMESPACED(EnumType, zeek);
namespace zeek { namespace zeek {
using EnumTypePtr = zeek::IntrusivePtr<zeek::EnumType>; using EnumTypePtr = zeek::IntrusivePtr<zeek::EnumType>;
using EnumValPtr = zeek::IntrusivePtr<zeek::EnumVal>; using EnumValPtr = zeek::IntrusivePtr<zeek::EnumVal>;
}
/** /**
* Class to identify an analyzer type. * Class to identify an analyzer type.
@ -157,3 +157,7 @@ private:
subtype_t subtype; // Subtype. subtype_t subtype; // Subtype.
mutable zeek::EnumValPtr val; // Script-layer value. mutable zeek::EnumValPtr val; // Script-layer value.
}; };
} // namespace zeek
using Tag [[deprecated("Remove in v4.1. Use zeek::Tag instead")]] = zeek::Tag;

View file

@ -6,19 +6,19 @@
const analyzer::Tag analyzer::Tag::Error; const analyzer::Tag analyzer::Tag::Error;
analyzer::Tag::Tag(type_t type, subtype_t subtype) analyzer::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(analyzer_mgr->GetTagType(), type, subtype) : zeek::Tag(analyzer_mgr->GetTagType(), type, subtype)
{ {
} }
analyzer::Tag& analyzer::Tag::operator=(const analyzer::Tag& other) analyzer::Tag& analyzer::Tag::operator=(const analyzer::Tag& other)
{ {
::Tag::operator=(other); zeek::Tag::operator=(other);
return *this; return *this;
} }
const zeek::EnumValPtr& analyzer::Tag::AsVal() const const zeek::EnumValPtr& analyzer::Tag::AsVal() const
{ {
return ::Tag::AsVal(analyzer_mgr->GetTagType()); return zeek::Tag::AsVal(analyzer_mgr->GetTagType());
} }
zeek::EnumVal* analyzer::Tag::AsEnumVal() const zeek::EnumVal* analyzer::Tag::AsEnumVal() const
@ -27,9 +27,9 @@ zeek::EnumVal* analyzer::Tag::AsEnumVal() const
} }
analyzer::Tag::Tag(zeek::EnumValPtr val) analyzer::Tag::Tag(zeek::EnumValPtr val)
: ::Tag(std::move(val)) : zeek::Tag(std::move(val))
{ } { }
analyzer::Tag::Tag(zeek::EnumVal* val) analyzer::Tag::Tag(zeek::EnumVal* val)
: ::Tag({zeek::NewRef{}, val}) : zeek::Tag({zeek::NewRef{}, val})
{ } { }

View file

@ -31,18 +31,18 @@ class Component;
* *
* The script-layer analogue is Analyzer::Tag. * The script-layer analogue is Analyzer::Tag.
*/ */
class Tag : public ::Tag { class Tag : public zeek::Tag {
public: public:
/* /*
* Copy constructor. * Copy constructor.
*/ */
Tag(const Tag& other) : ::Tag(other) {} Tag(const Tag& other) : zeek::Tag(other) {}
/** /**
* Default constructor. This initializes the tag with an error value * Default constructor. This initializes the tag with an error value
* that will make \c operator \c bool return false. * that will make \c operator \c bool return false.
*/ */
Tag() : ::Tag() {} Tag() : zeek::Tag() {}
/** /**
* Destructor. * Destructor.
@ -65,7 +65,7 @@ public:
*/ */
bool operator==(const Tag& other) const bool operator==(const Tag& other) const
{ {
return ::Tag::operator==(other); return zeek::Tag::operator==(other);
} }
/** /**
@ -73,7 +73,7 @@ public:
*/ */
bool operator!=(const Tag& other) const bool operator!=(const Tag& other) const
{ {
return ::Tag::operator!=(other); return zeek::Tag::operator!=(other);
} }
/** /**
@ -81,7 +81,7 @@ public:
*/ */
bool operator<(const Tag& other) const bool operator<(const Tag& other) const
{ {
return ::Tag::operator<(other); return zeek::Tag::operator<(other);
} }
/** /**

View file

@ -14,13 +14,13 @@ file_analysis::Tag::Tag(type_t type, subtype_t subtype)
file_analysis::Tag& file_analysis::Tag::operator=(const file_analysis::Tag& other) file_analysis::Tag& file_analysis::Tag::operator=(const file_analysis::Tag& other)
{ {
::Tag::operator=(other); zeek::Tag::operator=(other);
return *this; return *this;
} }
const zeek::EnumValPtr& file_analysis::Tag::AsVal() const const zeek::EnumValPtr& file_analysis::Tag::AsVal() const
{ {
return ::Tag::AsVal(file_mgr->GetTagType()); return zeek::Tag::AsVal(file_mgr->GetTagType());
} }
zeek::EnumVal* file_analysis::Tag::AsEnumVal() const zeek::EnumVal* file_analysis::Tag::AsEnumVal() const
@ -29,9 +29,9 @@ zeek::EnumVal* file_analysis::Tag::AsEnumVal() const
} }
file_analysis::Tag::Tag(zeek::EnumValPtr val) file_analysis::Tag::Tag(zeek::EnumValPtr val)
: ::Tag(std::move(val)) : zeek::Tag(std::move(val))
{ } { }
file_analysis::Tag::Tag(zeek::EnumVal* val) file_analysis::Tag::Tag(zeek::EnumVal* val)
: ::Tag({zeek::NewRef{}, val}) : zeek::Tag({zeek::NewRef{}, val})
{ } { }

View file

@ -29,18 +29,18 @@ class Component;
* *
* The script-layer analogue is Files::Tag. * The script-layer analogue is Files::Tag.
*/ */
class Tag : public ::Tag { class Tag : public zeek::Tag {
public: public:
/* /*
* Copy constructor. * Copy constructor.
*/ */
Tag(const Tag& other) : ::Tag(other) {} Tag(const Tag& other) : zeek::Tag(other) {}
/** /**
* Default constructor. This initializes the tag with an error value * Default constructor. This initializes the tag with an error value
* that will make \c operator \c bool return false. * that will make \c operator \c bool return false.
*/ */
Tag() : ::Tag() {} Tag() : zeek::Tag() {}
/** /**
* Destructor. * Destructor.
@ -63,7 +63,7 @@ public:
*/ */
bool operator==(const Tag& other) const bool operator==(const Tag& other) const
{ {
return ::Tag::operator==(other); return zeek::Tag::operator==(other);
} }
/** /**
@ -71,7 +71,7 @@ public:
*/ */
bool operator!=(const Tag& other) const bool operator!=(const Tag& other) const
{ {
return ::Tag::operator!=(other); return zeek::Tag::operator!=(other);
} }
/** /**
@ -79,7 +79,7 @@ public:
*/ */
bool operator<(const Tag& other) const bool operator<(const Tag& other) const
{ {
return ::Tag::operator<(other); return zeek::Tag::operator<(other);
} }
/** /**

View file

@ -6,19 +6,19 @@
const input::Tag input::Tag::Error; const input::Tag input::Tag::Error;
input::Tag::Tag(type_t type, subtype_t subtype) input::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(input_mgr->GetTagType(), type, subtype) : zeek::Tag(input_mgr->GetTagType(), type, subtype)
{ {
} }
input::Tag& input::Tag::operator=(const input::Tag& other) input::Tag& input::Tag::operator=(const input::Tag& other)
{ {
::Tag::operator=(other); zeek::Tag::operator=(other);
return *this; return *this;
} }
const zeek::EnumValPtr& input::Tag::AsVal() const const zeek::EnumValPtr& input::Tag::AsVal() const
{ {
return ::Tag::AsVal(input_mgr->GetTagType()); return zeek::Tag::AsVal(input_mgr->GetTagType());
} }
zeek::EnumVal* input::Tag::AsEnumVal() const zeek::EnumVal* input::Tag::AsEnumVal() const
@ -27,9 +27,9 @@ zeek::EnumVal* input::Tag::AsEnumVal() const
} }
input::Tag::Tag(zeek::EnumValPtr val) input::Tag::Tag(zeek::EnumValPtr val)
: ::Tag(std::move(val)) : zeek::Tag(std::move(val))
{ } { }
input::Tag::Tag(zeek::EnumVal* val) input::Tag::Tag(zeek::EnumVal* val)
: ::Tag({zeek::NewRef{}, val}) : zeek::Tag({zeek::NewRef{}, val})
{ } { }

View file

@ -30,18 +30,18 @@ class Component;
* *
* The script-layer analogue is Input::Reader. * The script-layer analogue is Input::Reader.
*/ */
class Tag : public ::Tag { class Tag : public zeek::Tag {
public: public:
/* /*
* Copy constructor. * Copy constructor.
*/ */
Tag(const Tag& other) : ::Tag(other) {} Tag(const Tag& other) : zeek::Tag(other) {}
/** /**
* Default constructor. This initializes the tag with an error value * Default constructor. This initializes the tag with an error value
* that will make \c operator \c bool return false. * that will make \c operator \c bool return false.
*/ */
Tag() : ::Tag() {} Tag() : zeek::Tag() {}
/** /**
* Destructor. * Destructor.
@ -64,7 +64,7 @@ public:
*/ */
bool operator==(const Tag& other) const bool operator==(const Tag& other) const
{ {
return ::Tag::operator==(other); return zeek::Tag::operator==(other);
} }
/** /**
@ -72,7 +72,7 @@ public:
*/ */
bool operator!=(const Tag& other) const bool operator!=(const Tag& other) const
{ {
return ::Tag::operator!=(other); return zeek::Tag::operator!=(other);
} }
/** /**
@ -80,7 +80,7 @@ public:
*/ */
bool operator<(const Tag& other) const bool operator<(const Tag& other) const
{ {
return ::Tag::operator<(other); return zeek::Tag::operator<(other);
} }
/** /**

View file

@ -6,25 +6,25 @@
const logging::Tag logging::Tag::Error; const logging::Tag logging::Tag::Error;
logging::Tag::Tag(type_t type, subtype_t subtype) logging::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(log_mgr->GetTagType(), type, subtype) : zeek::Tag(log_mgr->GetTagType(), type, subtype)
{ {
} }
logging::Tag& logging::Tag::operator=(const logging::Tag& other) logging::Tag& logging::Tag::operator=(const logging::Tag& other)
{ {
::Tag::operator=(other); zeek::Tag::operator=(other);
return *this; return *this;
} }
logging::Tag& logging::Tag::operator=(const logging::Tag&& other) noexcept logging::Tag& logging::Tag::operator=(const logging::Tag&& other) noexcept
{ {
::Tag::operator=(other); zeek::Tag::operator=(other);
return *this; return *this;
} }
const zeek::EnumValPtr& logging::Tag::AsVal() const const zeek::EnumValPtr& logging::Tag::AsVal() const
{ {
return ::Tag::AsVal(log_mgr->GetTagType()); return zeek::Tag::AsVal(log_mgr->GetTagType());
} }
zeek::EnumVal* logging::Tag::AsEnumVal() const zeek::EnumVal* logging::Tag::AsEnumVal() const
@ -33,9 +33,9 @@ zeek::EnumVal* logging::Tag::AsEnumVal() const
} }
logging::Tag::Tag(zeek::EnumValPtr val) logging::Tag::Tag(zeek::EnumValPtr val)
: ::Tag(std::move(val)) : zeek::Tag(std::move(val))
{ } { }
logging::Tag::Tag(zeek::EnumVal* val) logging::Tag::Tag(zeek::EnumVal* val)
: ::Tag({zeek::NewRef{}, val}) : zeek::Tag({zeek::NewRef{}, val})
{ } { }

View file

@ -30,18 +30,18 @@ class Component;
* *
* The script-layer analogue is Log::Writer. * The script-layer analogue is Log::Writer.
*/ */
class Tag : public ::Tag { class Tag : public zeek::Tag {
public: public:
/* /*
* Copy constructor. * Copy constructor.
*/ */
Tag(const Tag& other) : ::Tag(other) {} Tag(const Tag& other) : zeek::Tag(other) {}
/** /**
* Default constructor. This initializes the tag with an error value * Default constructor. This initializes the tag with an error value
* that will make \c operator \c bool return false. * that will make \c operator \c bool return false.
*/ */
Tag() : ::Tag() {} Tag() : zeek::Tag() {}
/** /**
* Destructor. * Destructor.
@ -69,7 +69,7 @@ public:
*/ */
bool operator==(const Tag& other) const bool operator==(const Tag& other) const
{ {
return ::Tag::operator==(other); return zeek::Tag::operator==(other);
} }
/** /**
@ -77,7 +77,7 @@ public:
*/ */
bool operator!=(const Tag& other) const bool operator!=(const Tag& other) const
{ {
return ::Tag::operator!=(other); return zeek::Tag::operator!=(other);
} }
/** /**
@ -85,7 +85,7 @@ public:
*/ */
bool operator<(const Tag& other) const bool operator<(const Tag& other) const
{ {
return ::Tag::operator<(other); return zeek::Tag::operator<(other);
} }
/** /**