Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: webkit/fileapi/media/picasa/pmp_column_reader.h

Issue 14247034: Move Media Galleries FileAPI code out of webkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr-14352004
Patch Set: Add android ifdef. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
6 #define WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "webkit/fileapi/media/picasa/pmp_constants.h"
14 #include "webkit/storage/webkit_storage_export.h"
15
16 namespace base {
17 class FilePath;
18 }
19
20 namespace picasaimport {
21
22 // Reads a single PMP column from a file.
23 class WEBKIT_STORAGE_EXPORT_PRIVATE PmpColumnReader {
24 public:
25 PmpColumnReader();
26 virtual ~PmpColumnReader();
27
28 // Returns true if read successfully.
29 // |rows_read| is undefined if returns false.
30 bool Init(const base::FilePath& filepath, uint32* rows_read);
31
32 // These functions read the value of that |row| into |result|.
33 // Functions return false if the column is of the wrong type or the row
34 // is out of range.
35 bool ReadString(const uint32 row, std::string* result) const;
36 bool ReadUInt32(const uint32 row, uint32* result) const;
37 bool ReadDouble64(const uint32 row, double* result) const;
38 bool ReadUInt8(const uint32 row, uint8* result) const;
39 bool ReadUInt64(const uint32 row, uint64* result) const;
40
41 // Returns the native encoding of field_type.
42 PmpFieldType field_type() const {
43 return field_type_;
44 }
45
46 private:
47 bool ParseData(uint32* rows_read);
48 // Returns the number of bytes parsed in the body, or, -1 on failure.
49 long IndexStrings();
50
51 // Source data
52 scoped_ptr<uint8[]> data_;
53 size_t length_;
54
55 // Header data
56 PmpFieldType field_type_;
57 uint32 rows_;
58
59 // Index of string start locations if fields are strings. Empty otherwise.
60 std::vector<const char*> strings_;
61
62 DISALLOW_COPY_AND_ASSIGN(PmpColumnReader);
63 };
64
65 } // namespace picasaimport
66
67 #endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/media/native_media_file_util_unittest.cc ('k') | webkit/fileapi/media/picasa/pmp_column_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698