diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index 25e440d9b295..307f1b00ae81 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -258,7 +258,7 @@ nsresult GetJSValFromKeyPathString( // static Result KeyPath::Parse(const nsAString& aString) { KeyPath keyPath(0); - keyPath.SetType(STRING); + keyPath.SetType(KeyPathType::String); if (!keyPath.AppendStringWithValidation(aString)) { return Err(NS_ERROR_FAILURE); @@ -270,7 +270,7 @@ Result KeyPath::Parse(const nsAString& aString) { // static Result KeyPath::Parse(const Sequence& aStrings) { KeyPath keyPath(0); - keyPath.SetType(ARRAY); + keyPath.SetType(KeyPathType::Array); for (uint32_t i = 0; i < aStrings.Length(); ++i) { if (!keyPath.AppendStringWithValidation(aStrings[i])) { @@ -453,7 +453,7 @@ KeyPath KeyPath::DeserializeFromString(const nsAString& aString) { KeyPath keyPath(0); if (!aString.IsEmpty() && aString.First() == ',') { - keyPath.SetType(ARRAY); + keyPath.SetType(KeyPathType::Array); // We use a comma in the beginning to indicate that it's an array of // key paths. This is to be able to tell a string-keypath from an @@ -475,7 +475,7 @@ KeyPath KeyPath::DeserializeFromString(const nsAString& aString) { return keyPath; } - keyPath.SetType(STRING); + keyPath.SetType(KeyPathType::String); keyPath.mStrings.AppendElement(aString); return keyPath; diff --git a/dom/indexedDB/KeyPath.h b/dom/indexedDB/KeyPath.h index 109d909e25e8..75cfaf8d34b9 100644 --- a/dom/indexedDB/KeyPath.h +++ b/dom/indexedDB/KeyPath.h @@ -41,16 +41,18 @@ class KeyPath { friend class IndexMetadata; friend class ObjectStoreMetadata; - KeyPath() : mType(NONEXISTENT) { MOZ_COUNT_CTOR(KeyPath); } + KeyPath() : mType(KeyPathType::NonExistent) { MOZ_COUNT_CTOR(KeyPath); } public: - enum KeyPathType { NONEXISTENT, STRING, ARRAY, ENDGUARD }; + enum class KeyPathType { NonExistent, String, Array, EndGuard }; void SetType(KeyPathType aType); bool AppendStringWithValidation(const nsAString& aString); - explicit KeyPath(int aDummy) : mType(NONEXISTENT) { MOZ_COUNT_CTOR(KeyPath); } + explicit KeyPath(int aDummy) : mType(KeyPathType::NonExistent) { + MOZ_COUNT_CTOR(KeyPath); + } KeyPath(KeyPath&& aOther) { MOZ_COUNT_CTOR(KeyPath); @@ -85,14 +87,14 @@ class KeyPath { Key& aKey, ExtractOrCreateKeyCallback aCallback, void* aClosure) const; - inline bool IsValid() const { return mType != NONEXISTENT; } + inline bool IsValid() const { return mType != KeyPathType::NonExistent; } - inline bool IsArray() const { return mType == ARRAY; } + inline bool IsArray() const { return mType == KeyPathType::Array; } - inline bool IsString() const { return mType == STRING; } + inline bool IsString() const { return mType == KeyPathType::String; } inline bool IsEmpty() const { - return mType == STRING && mStrings[0].IsEmpty(); + return mType == KeyPathType::String && mStrings[0].IsEmpty(); } bool operator==(const KeyPath& aOther) const { diff --git a/dom/indexedDB/SerializationHelpers.h b/dom/indexedDB/SerializationHelpers.h index bcfe37b3807f..b0818b5cabce 100644 --- a/dom/indexedDB/SerializationHelpers.h +++ b/dom/indexedDB/SerializationHelpers.h @@ -46,8 +46,8 @@ template <> struct ParamTraits : public ContiguousEnumSerializer< mozilla::dom::indexedDB::KeyPath::KeyPathType, - mozilla::dom::indexedDB::KeyPath::NONEXISTENT, - mozilla::dom::indexedDB::KeyPath::ENDGUARD> {}; + mozilla::dom::indexedDB::KeyPath::KeyPathType::NonExistent, + mozilla::dom::indexedDB::KeyPath::KeyPathType::EndGuard> {}; template <> struct ParamTraits {