aboutsummaryrefslogtreecommitdiff
path: root/src/leveldbwrapper.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-10-07 17:12:24 -0700
committerJames O'Beirne <james.obeirne@gmail.com>2015-10-08 09:32:27 -0700
commit3499ce1e1ad87a86598d00b7124072c91ddad833 (patch)
treea85dd4fc69ca25aad28bf5bead2097d9688abece /src/leveldbwrapper.cpp
parent4fac576c619f450da8ca09ac8790063b3dea4364 (diff)
Encapsulate CLevelDB iterators cleanly
Conflicts: src/leveldb.cpp src/leveldb.h src/txdb.cpp
Diffstat (limited to 'src/leveldbwrapper.cpp')
-rw-r--r--src/leveldbwrapper.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp
index ce96b5c8aa..a94cfd8a30 100644
--- a/src/leveldbwrapper.cpp
+++ b/src/leveldbwrapper.cpp
@@ -131,7 +131,7 @@ std::vector<unsigned char> CLevelDBWrapper::CreateObfuscateKey() const
bool CLevelDBWrapper::IsEmpty()
{
- boost::scoped_ptr<leveldb::Iterator> it(NewIterator());
+ boost::scoped_ptr<CLevelDBIterator> it(NewIterator());
it->SeekToFirst();
return !(it->Valid());
}
@@ -145,3 +145,10 @@ std::string CLevelDBWrapper::GetObfuscateKeyHex() const
{
return HexStr(obfuscate_key);
}
+
+CLevelDBIterator::~CLevelDBIterator() { delete piter; }
+bool CLevelDBIterator::Valid() { return piter->Valid(); }
+void CLevelDBIterator::SeekToFirst() { piter->SeekToFirst(); }
+void CLevelDBIterator::SeekToLast() { piter->SeekToLast(); }
+void CLevelDBIterator::Next() { piter->Next(); }
+void CLevelDBIterator::Prev() { piter->Prev(); }