leveldb_iterator_impl.h revision 116680a4aac90f2aa7413d9095a592090648e557
1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_ITERATOR_IMPL_H_
6#define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_ITERATOR_IMPL_H_
7
8#include "base/memory/scoped_ptr.h"
9#include "content/browser/indexed_db/leveldb/leveldb_iterator.h"
10#include "content/common/content_export.h"
11#include "third_party/leveldatabase/src/include/leveldb/iterator.h"
12
13namespace content {
14
15class CONTENT_EXPORT LevelDBIteratorImpl : public content::LevelDBIterator {
16 public:
17  virtual ~LevelDBIteratorImpl();
18  virtual bool IsValid() const OVERRIDE;
19  virtual leveldb::Status SeekToLast() OVERRIDE;
20  virtual leveldb::Status Seek(const base::StringPiece& target) OVERRIDE;
21  virtual leveldb::Status Next() OVERRIDE;
22  virtual leveldb::Status Prev() OVERRIDE;
23  virtual base::StringPiece Key() const OVERRIDE;
24  virtual base::StringPiece Value() const OVERRIDE;
25
26 protected:
27  explicit LevelDBIteratorImpl(scoped_ptr<leveldb::Iterator> iterator);
28
29 private:
30  void CheckStatus();
31
32  friend class IndexedDBClassFactory;
33  friend class MockBrowserTestIndexedDBClassFactory;
34
35  scoped_ptr<leveldb::Iterator> iterator_;
36
37  DISALLOW_COPY_AND_ASSIGN(LevelDBIteratorImpl);
38};
39
40}  // namespace content
41
42#endif  // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_ITERATOR_IMPL_H_
43