From e68194f2dfb9b25e4385eb56f8eae17c4f378586 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Tue, 21 Nov 2023 10:43:04 +0100 Subject: [PATCH] TableType: Simplify and inline Is...Index tests --- src/Type.cc | 14 -------------- src/Type.h | 10 ++++++++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/Type.cc b/src/Type.cc index a9da69e760..2c5580d50c 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -382,20 +382,6 @@ void IndexType::DescribeReST(ODesc* d, bool roles_only) const { } } -bool IndexType::IsSubNetIndex() const { - const auto& types = indices->GetTypes(); - if ( types.size() == 1 && types[0]->Tag() == TYPE_SUBNET ) - return true; - return false; -} - -bool IndexType::IsPatternIndex() const { - const auto& types = indices->GetTypes(); - if ( types.size() == 1 && types[0]->Tag() == TYPE_PATTERN ) - return true; - return false; -} - detail::TraversalCode IndexType::Traverse(detail::TraversalCallback* cb) const { auto tc = cb->PreType(this); HANDLE_TC_TYPE_PRE(tc); diff --git a/src/Type.h b/src/Type.h index 142fe2d331..71247ab335 100644 --- a/src/Type.h +++ b/src/Type.h @@ -354,10 +354,16 @@ public: void DescribeReST(ODesc* d, bool roles_only = false) const override; // Returns true if this table is solely indexed by subnet. - bool IsSubNetIndex() const; + bool IsSubNetIndex() const { + const auto& types = indices->GetTypes(); + return types.size() == 1 && types[0]->Tag() == TYPE_SUBNET; + } // Returns true if this table has a single index of type pattern. - bool IsPatternIndex() const; + bool IsPatternIndex() const { + const auto& types = indices->GetTypes(); + return types.size() == 1 && types[0]->Tag() == TYPE_PATTERN; + } detail::TraversalCode Traverse(detail::TraversalCallback* cb) const override;