pw_kvs: Rename Entry to Item
Item is more consistent with Python, and it frees up the name Entry for
other uses.
Change-Id: Iad27b289203fbb63238ba44defbf61b50a3836c8
diff --git a/pw_kvs/key_value_store.cc b/pw_kvs/key_value_store.cc
index 0b6a6a3..39790ae 100644
--- a/pw_kvs/key_value_store.cc
+++ b/pw_kvs/key_value_store.cc
@@ -285,7 +285,7 @@
return Status::UNIMPLEMENTED;
}
-const KeyValueStore::Entry& KeyValueStore::Iterator::operator*() {
+const KeyValueStore::Item& KeyValueStore::Iterator::operator*() {
const KeyDescriptor& descriptor = entry_.kvs_.key_descriptor_list_[index_];
std::memset(entry_.key_buffer_.data(), 0, entry_.key_buffer_.size());
diff --git a/pw_kvs/key_value_store_test.cc b/pw_kvs/key_value_store_test.cc
index ed2ccc8..07fb396 100644
--- a/pw_kvs/key_value_store_test.cc
+++ b/pw_kvs/key_value_store_test.cc
@@ -283,14 +283,14 @@
} // namespace
TEST_F(KeyValueStoreTest, Iteration_Empty_ByReference) {
- for (const KeyValueStore::Entry& entry : kvs_) {
+ for (const KeyValueStore::Item& entry : kvs_) {
FAIL(); // The KVS is empty; this shouldn't execute.
static_cast<void>(entry);
}
}
TEST_F(KeyValueStoreTest, Iteration_Empty_ByValue) {
- for (KeyValueStore::Entry entry : kvs_) {
+ for (KeyValueStore::Item entry : kvs_) {
FAIL(); // The KVS is empty; this shouldn't execute.
static_cast<void>(entry);
}
diff --git a/pw_kvs/public/pw_kvs/key_value_store.h b/pw_kvs/public/pw_kvs/key_value_store.h
index 89ae31c..8632c22 100644
--- a/pw_kvs/public/pw_kvs/key_value_store.h
+++ b/pw_kvs/public/pw_kvs/key_value_store.h
@@ -125,7 +125,7 @@
// Classes and functions to support STL-style iteration.
class Iterator;
- class Entry {
+ class Item {
public:
// Guaranteed to be null-terminated
std::string_view key() const { return key_buffer_.data(); }
@@ -145,7 +145,7 @@
private:
friend class Iterator;
- constexpr Entry(const KeyValueStore& kvs) : kvs_(kvs), key_buffer_{} {}
+ constexpr Item(const KeyValueStore& kvs) : kvs_(kvs), key_buffer_{} {}
const KeyValueStore& kvs_;
KeyBuffer key_buffer_;
@@ -161,10 +161,10 @@
Iterator& operator++(int) { return operator++(); }
// Reads the entry's key from flash.
- const Entry& operator*();
+ const Item& operator*();
- const Entry* operator->() {
- operator*(); // Read the key into the Entry object.
+ const Item* operator->() {
+ operator*(); // Read the key into the Item object.
return &entry_;
}
@@ -182,7 +182,7 @@
constexpr Iterator(const KeyValueStore& kvs, size_t index)
: entry_(kvs), index_(index) {}
- Entry entry_;
+ Item entry_;
size_t index_;
};