Migrate Tag classes to use IntrusivePtr

Deprecates various methods that previously took raw pointers
This commit is contained in:
Jon Siwek 2020-05-05 17:10:34 -07:00
parent b096e552d3
commit 1abed4fd4c
20 changed files with 174 additions and 85 deletions

View file

@ -3,6 +3,7 @@
#pragma once
#include "zeek-config.h"
#include "IntrusivePtr.h"
#include <string>
@ -114,6 +115,9 @@ protected:
*
* @param etype the script-layer enum type associated with the tag.
*/
const IntrusivePtr<EnumVal>& AsVal(const IntrusivePtr<EnumType>& etype) const;
[[deprecated("Remove in v4.1. Use AsVal() instead.")]]
EnumVal* AsEnumVal(EnumType* etype) const;
/**
@ -127,6 +131,9 @@ protected:
* @param subtype The sub type, which is left to an analyzer for
* interpretation. By default it's set to zero.
*/
Tag(const IntrusivePtr<EnumType>& etype, type_t type, subtype_t subtype = 0);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr& instead.")]]
Tag(EnumType* etype, type_t type, subtype_t subtype = 0);
/**
@ -134,10 +141,13 @@ protected:
*
* @param val An enum value of script type \c Analyzer::Tag.
*/
explicit Tag(IntrusivePtr<EnumVal> val);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Tag(EnumVal* val);
private:
type_t type; // Main type.
subtype_t subtype; // Subtype.
mutable EnumVal* val; // Script-layer value.
mutable IntrusivePtr<EnumVal> val; // Script-layer value.
};