OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 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_SLICE_H_ | |
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_SLICE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/logging.h" | |
11 | |
12 namespace content { | |
13 | |
14 class LevelDBSlice { | |
15 public: | |
16 LevelDBSlice(const char* begin, const char* end) : begin_(begin), end_(end) { | |
17 DCHECK_GE(end_, begin_); | |
18 } | |
19 | |
20 explicit LevelDBSlice(const std::vector<char>& v) | |
21 : begin_(&*v.begin()), end_(&*v.rbegin() + 1) { | |
22 DCHECK_GE(end_, begin_); | |
23 } | |
24 | |
25 ~LevelDBSlice() {} | |
26 | |
27 const char* begin() const { return begin_; } | |
28 const char* end() const { return end_; } | |
29 | |
30 private: | |
31 const char* begin_; | |
32 const char* end_; | |
33 }; | |
34 | |
35 } // namespace content | |
36 | |
37 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_SLICE_H_ | |
OLD | NEW |