Merge remote-tracking branch 'origin/topic/jsiwek/simplify-tag-error-check'

* origin/topic/jsiwek/simplify-tag-error-check:
  Make Tag::Error values constant
  Simplify operator bool()'s used for Tag error checks
This commit is contained in:
Johanna Amann 2019-08-28 10:58:54 -07:00
commit 81dea943d3
8 changed files with 12 additions and 12 deletions

View file

@ -3,7 +3,7 @@
#include "Tag.h"
#include "Manager.h"
analyzer::Tag analyzer::Tag::Error;
const analyzer::Tag analyzer::Tag::Error;
analyzer::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(analyzer_mgr->GetTagEnumType(), type, subtype)

View file

@ -43,7 +43,7 @@ public:
* Returns false if the tag represents an error value rather than a
* legal analyzer type.
*/
explicit operator bool() const { return *this != Tag(); }
explicit operator bool() const { return *this != Error; }
/**
* Assignment operator.
@ -82,7 +82,7 @@ public:
*/
EnumVal* AsEnumVal() const;
static Tag Error;
static const Tag Error;
protected:
friend class analyzer::Manager;

View file

@ -5,7 +5,7 @@
using namespace file_analysis;
file_analysis::Tag file_analysis::Tag::Error;
const file_analysis::Tag file_analysis::Tag::Error;
file_analysis::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(file_mgr->GetTagEnumType(), type, subtype)

View file

@ -42,7 +42,7 @@ public:
* Returns false if the tag represents an error value rather than a
* legal analyzer type.
*/
explicit operator bool() const { return *this != Tag(); }
explicit operator bool() const { return *this != Error; }
/**
* Assignment operator.
@ -81,7 +81,7 @@ public:
*/
EnumVal* AsEnumVal() const;
static Tag Error;
static const Tag Error;
protected:
friend class plugin::ComponentManager<Tag, Component>;

View file

@ -3,7 +3,7 @@
#include "Tag.h"
#include "Manager.h"
input::Tag input::Tag::Error;
const input::Tag input::Tag::Error;
input::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(input_mgr->GetTagEnumType(), type, subtype)

View file

@ -43,7 +43,7 @@ public:
* Returns false if the tag represents an error value rather than a
* legal reader type.
*/
explicit operator bool() const { return *this != Tag(); }
explicit operator bool() const { return *this != Error; }
/**
* Assignment operator.
@ -82,7 +82,7 @@ public:
*/
EnumVal* AsEnumVal() const;
static Tag Error;
static const Tag Error;
protected:
friend class plugin::ComponentManager<Tag, Component>;

View file

@ -3,7 +3,7 @@
#include "Tag.h"
#include "Manager.h"
logging::Tag logging::Tag::Error;
const logging::Tag logging::Tag::Error;
logging::Tag::Tag(type_t type, subtype_t subtype)
: ::Tag(log_mgr->GetTagEnumType(), type, subtype)

View file

@ -43,7 +43,7 @@ public:
* Returns false if the tag represents an error value rather than a
* legal writer type.
*/
explicit operator bool() const { return *this != Tag(); }
explicit operator bool() const { return *this != Error; }
/**
* Assignment operator.
@ -82,7 +82,7 @@ public:
*/
EnumVal* AsEnumVal() const;
static Tag Error;
static const Tag Error;
protected:
friend class plugin::ComponentManager<Tag, Component>;