summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-04-03 12:04:31 +0000
committerGeir Storli <geirst@yahoo-inc.com>2017-04-04 19:24:55 +0000
commitb3785113f3df9bd64d5cfb7d6fda2cae8144544a (patch)
treec72f9c81c3086a0ff34c8fd79f041da8ddf8a6b9 /searchlib
parent3948d63b4d7a64fb964f052df4dfcb87845bd364 (diff)
Change FieldType to enum class.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/fef/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/fef/fieldtype.cpp21
-rw-r--r--searchlib/src/vespa/searchlib/fef/fieldtype.h42
3 files changed, 5 insertions, 59 deletions
diff --git a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt
index 280d3befbf1..ec4a9e138dc 100644
--- a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt
@@ -13,7 +13,6 @@ vespa_add_library(searchlib_fef OBJECT
fef.cpp
fieldinfo.cpp
fieldpositionsiterator.cpp
- fieldtype.cpp
filetablefactory.cpp
functiontablefactory.cpp
indexproperties.cpp
diff --git a/searchlib/src/vespa/searchlib/fef/fieldtype.cpp b/searchlib/src/vespa/searchlib/fef/fieldtype.cpp
deleted file mode 100644
index 39cb1be7997..00000000000
--- a/searchlib/src/vespa/searchlib/fef/fieldtype.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fastos/fastos.h>
-#include "fieldtype.h"
-
-namespace search {
-namespace fef {
-
-FieldType::FieldType(uint32_t value)
- : _value(value)
-{
-}
-
-const FieldType FieldType::INDEX(1);
-
-const FieldType FieldType::ATTRIBUTE(2);
-
-const FieldType FieldType::HIDDEN_ATTRIBUTE(3);
-
-} // namespace fef
-} // namespace search
diff --git a/searchlib/src/vespa/searchlib/fef/fieldtype.h b/searchlib/src/vespa/searchlib/fef/fieldtype.h
index 8b1b17f9801..ab918baa293 100644
--- a/searchlib/src/vespa/searchlib/fef/fieldtype.h
+++ b/searchlib/src/vespa/searchlib/fef/fieldtype.h
@@ -6,44 +6,12 @@ namespace search {
namespace fef {
/**
- * Typesafe enum used to indicate the type of a field.
+ * Scoped and typesafe enum used to indicate the type of a field.
**/
-class FieldType
-{
-private:
- uint32_t _value;
-
- FieldType(uint32_t value);
-public:
- /**
- * Indicating that the field is indexed
- **/
- static const FieldType INDEX;
-
- /**
- * Indicating that the field is kept in an attribute vector
- **/
- static const FieldType ATTRIBUTE;
-
- /**
- * Indicating that the field is kept in an attribute vector
- **/
- static const FieldType HIDDEN_ATTRIBUTE;
-
- /**
- * Less than operator; needed to be handled as a value by the standard library.
- **/
- bool operator<(const FieldType &rhs) const { return (_value < rhs._value); }
-
- /**
- * Check if two field types are equal.
- **/
- bool operator==(const FieldType &rhs) const { return (_value == rhs._value); }
-
- /**
- * Check if two field types are not equal.
- **/
- bool operator!=(const FieldType &rhs) const { return (_value != rhs._value); }
+enum class FieldType {
+ INDEX = 1,
+ ATTRIBUTE = 2,
+ HIDDEN_ATTRIBUTE = 3
};
} // namespace fef