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