OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ | 5 #ifndef CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ |
6 #define CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ | 6 #define CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ |
7 | 7 |
8 #define JET_UNICODE | 8 #define JET_UNICODE |
9 #include <esent.h> | 9 #include <esent.h> |
10 | |
11 #include <memory> | |
Lei Zhang
2016/04/19 01:35:43
Move this down to after line 14.
dcheng
2016/04/19 03:51:33
Done.
| |
10 #undef JET_UNICODE | 12 #undef JET_UNICODE |
11 | 13 |
12 #include <map> | 14 #include <map> |
13 | 15 |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
17 | 18 |
18 class EdgeErrorObject { | 19 class EdgeErrorObject { |
19 public: | 20 public: |
20 EdgeErrorObject() : last_error_(JET_errSuccess) {} | 21 EdgeErrorObject() : last_error_(JET_errSuccess) {} |
21 | 22 |
22 // Get the last error converted to a descriptive string. | 23 // Get the last error converted to a descriptive string. |
23 base::string16 GetErrorMessage() const; | 24 base::string16 GetErrorMessage() const; |
24 // Get the last error value. | 25 // Get the last error value. |
25 JET_ERR last_error() const { return last_error_; } | 26 JET_ERR last_error() const { return last_error_; } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 : db_id_(JET_dbidNil), | 73 : db_id_(JET_dbidNil), |
73 instance_id_(JET_instanceNil), | 74 instance_id_(JET_instanceNil), |
74 session_id_(JET_sesidNil) {} | 75 session_id_(JET_sesidNil) {} |
75 | 76 |
76 ~EdgeDatabaseReader(); | 77 ~EdgeDatabaseReader(); |
77 | 78 |
78 // Open the database from a file path. Returns true on success. | 79 // Open the database from a file path. Returns true on success. |
79 bool OpenDatabase(const base::string16& database_file); | 80 bool OpenDatabase(const base::string16& database_file); |
80 | 81 |
81 // Open a row enumerator for a specified table. Returns a nullptr on error. | 82 // Open a row enumerator for a specified table. Returns a nullptr on error. |
82 scoped_ptr<EdgeDatabaseTableEnumerator> OpenTableEnumerator( | 83 std::unique_ptr<EdgeDatabaseTableEnumerator> OpenTableEnumerator( |
83 const base::string16& table_name); | 84 const base::string16& table_name); |
84 | 85 |
85 private: | 86 private: |
86 bool IsOpen() { return instance_id_ != JET_instanceNil; } | 87 bool IsOpen() { return instance_id_ != JET_instanceNil; } |
87 | 88 |
88 JET_DBID db_id_; | 89 JET_DBID db_id_; |
89 JET_INSTANCE instance_id_; | 90 JET_INSTANCE instance_id_; |
90 JET_SESID session_id_; | 91 JET_SESID session_id_; |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(EdgeDatabaseReader); | 93 DISALLOW_COPY_AND_ASSIGN(EdgeDatabaseReader); |
93 }; | 94 }; |
94 | 95 |
95 #endif // CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ | 96 #endif // CHROME_UTILITY_IMPORTER_EDGE_DATABASE_READER_WIN_H_ |
OLD | NEW |