diff options
author | Victor Costan <costan@google.com> | 2019-05-04 17:40:21 -0700 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2019-05-04 17:42:20 -0700 |
commit | 24424a1ef2c284f4ec30544a3458023362cbeacd (patch) | |
tree | 9af6fa8b9f885a3a3f8b5c011e882cab4c25dd4c /db/db_test.cc | |
parent | 9a56c49ed415df1b72ba1c84c8e7ed00de497f68 (diff) | |
download | leveldb-24424a1ef2c284f4ec30544a3458023362cbeacd.tar.gz |
Style cleanup.
1) Convert iterator-based for loops to C++11 foreach loops.
2) Convert "void operator=" to "T& operator=".
3) Switch from copy operators from private to public deleted.
4) Switch from empty ctors / dtors to "= default" where appropriate.
PiperOrigin-RevId: 246679195
Diffstat (limited to 'db/db_test.cc')
-rw-r--r-- | db/db_test.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/db/db_test.cc b/db/db_test.cc index 78296d5..e7386f7 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -2024,19 +2024,19 @@ class ModelDB : public DB { }; explicit ModelDB(const Options& options) : options_(options) {} - ~ModelDB() {} + ~ModelDB() override = default; virtual Status Put(const WriteOptions& o, const Slice& k, const Slice& v) { return DB::Put(o, k, v); } - virtual Status Delete(const WriteOptions& o, const Slice& key) { + Status Delete(const WriteOptions& o, const Slice& key) override { return DB::Delete(o, key); } - virtual Status Get(const ReadOptions& options, const Slice& key, - std::string* value) { + Status Get(const ReadOptions& options, const Slice& key, + std::string* value) override { assert(false); // Not implemented return Status::NotFound(key); } - virtual Iterator* NewIterator(const ReadOptions& options) { + Iterator* NewIterator(const ReadOptions& options) override { if (options.snapshot == nullptr) { KVMap* saved = new KVMap; *saved = map_; @@ -2047,16 +2047,16 @@ class ModelDB : public DB { return new ModelIter(snapshot_state, false); } } - virtual const Snapshot* GetSnapshot() { + const Snapshot* GetSnapshot() override { ModelSnapshot* snapshot = new ModelSnapshot; snapshot->map_ = map_; return snapshot; } - virtual void ReleaseSnapshot(const Snapshot* snapshot) { + void ReleaseSnapshot(const Snapshot* snapshot) override { delete reinterpret_cast<const ModelSnapshot*>(snapshot); } - virtual Status Write(const WriteOptions& options, WriteBatch* batch) { + Status Write(const WriteOptions& options, WriteBatch* batch) override { class Handler : public WriteBatch::Handler { public: KVMap* map_; @@ -2070,15 +2070,15 @@ class ModelDB : public DB { return batch->Iterate(&handler); } - virtual bool GetProperty(const Slice& property, std::string* value) { + bool GetProperty(const Slice& property, std::string* value) override { return false; } - virtual void GetApproximateSizes(const Range* r, int n, uint64_t* sizes) { + void GetApproximateSizes(const Range* r, int n, uint64_t* sizes) override { for (int i = 0; i < n; i++) { sizes[i] = 0; } } - virtual void CompactRange(const Slice* start, const Slice* end) {} + void CompactRange(const Slice* start, const Slice* end) override {} private: class ModelIter : public Iterator { |