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

@ -6,7 +6,7 @@
const logging::Tag logging::Tag::Error;
logging::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(log_mgr->GetTagEnumType(), type, subtype)
: ::Tag(log_mgr->GetTagType(), type, subtype)
{
}
@ -22,7 +22,20 @@ logging::Tag& logging::Tag::operator=(const logging::Tag&& other) noexcept
return *this;
}
const IntrusivePtr<EnumVal>& logging::Tag::AsVal() const
{
return ::Tag::AsVal(log_mgr->GetTagType());
}
EnumVal* logging::Tag::AsEnumVal() const
{
return ::Tag::AsEnumVal(log_mgr->GetTagEnumType());
return AsVal().get();
}
logging::Tag::Tag(IntrusivePtr<EnumVal> val)
: ::Tag(std::move(val))
{ }
logging::Tag::Tag(EnumVal* val)
: ::Tag({NewRef{}, val})
{ }

View file

@ -88,6 +88,9 @@ public:
*
* @param etype the script-layer enum type associated with the tag.
*/
const IntrusivePtr<EnumVal>& AsVal() const;
[[deprecated("Remove in v4.1. Use AsVal() instead.")]]
EnumVal* AsEnumVal() const;
static const Tag Error;
@ -113,7 +116,10 @@ protected:
*
* @param val An enum value of script type \c Log::Writer.
*/
explicit Tag(EnumVal* val) : ::Tag(val) {}
explicit Tag(IntrusivePtr<EnumVal> val);
[[deprecated("Remove in v4.1. Construct from IntrusivePtr instead.")]]
explicit Tag(EnumVal* val);
};
}