| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/files/file_path.h" |
| 11 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "chrome/browser/media_galleries/fileapi/picasa/pmp_constants.h" |
| 12 | 15 |
| 13 namespace base { | 16 namespace base { |
| 14 class FilePath; | 17 class FilePath; |
| 15 } | 18 } |
| 16 | 19 |
| 17 namespace picasaimport { | 20 namespace picasaimport { |
| 18 | 21 |
| 19 class PmpColumnReader; | 22 class PmpColumnReader; |
| 20 | 23 |
| 21 class PmpTableReader { | 24 class PmpTableReader { |
| 22 public: | 25 public: |
| 23 PmpTableReader(); | 26 PmpTableReader(const std::string& table_name, |
| 27 const base::FilePath& directory_path); |
| 24 | 28 |
| 25 virtual ~PmpTableReader(); | 29 virtual ~PmpTableReader(); |
| 26 | 30 |
| 27 // |columns| parameter will define, in-order, the columns returned by | 31 // Returns NULL on failure. |
| 28 // subsequent columns to GetColumns() if Init() succeeds. | 32 const PmpColumnReader* AddColumn(const std::string& column_name, |
| 29 bool Init(const std::string& table_name, | 33 const PmpFieldType expected_type); |
| 30 const base::FilePath& directory_path, | |
| 31 const std::vector<std::string>& columns); | |
| 32 | 34 |
| 33 // Returns a const "view" of the current contents of |column_readers_|. | 35 // Returns a const "view" of the successfully added columns. |
| 34 std::vector<const PmpColumnReader*> GetColumns() const; | 36 std::map<std::string, const PmpColumnReader*> Columns() const; |
| 35 | 37 |
| 38 // This value may change after calls to AddColumn(). |
| 36 uint32 RowCount() const; | 39 uint32 RowCount() const; |
| 37 | 40 |
| 38 private: | 41 private: |
| 42 bool initialized_; |
| 43 |
| 44 std::string table_name_; |
| 45 base::FilePath directory_path_; |
| 46 |
| 39 ScopedVector<PmpColumnReader> column_readers_; | 47 ScopedVector<PmpColumnReader> column_readers_; |
| 48 std::map<std::string, const PmpColumnReader*> column_map_; |
| 49 |
| 40 uint32 max_row_count_; | 50 uint32 max_row_count_; |
| 41 | 51 |
| 42 DISALLOW_COPY_AND_ASSIGN(PmpTableReader); | 52 DISALLOW_COPY_AND_ASSIGN(PmpTableReader); |
| 43 }; | 53 }; |
| 44 | 54 |
| 45 } // namespace picasaimport | 55 } // namespace picasaimport |
| 46 | 56 |
| 47 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ | 57 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_PICASA_PMP_TABLE_READER_H_ |
| OLD | NEW |