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

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

Issue 12704024: Simple PMP reader to parse Picasa's metadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include 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/storage/webkit_storage_export.h"
14
15 namespace base {
16 class FilePath;
17 }
18
19 namespace picasaimport {
20
21 // Reads a single PMP column from a file.
22 class WEBKIT_STORAGE_EXPORT_PRIVATE PmpColumnReader {
23 public:
24 PmpColumnReader();
25 virtual ~PmpColumnReader();
26
27 // Returns true if read successfully.
28 // |rows_read| is undefined if returns false.
29 bool Init(const base::FilePath& filepath, uint32* rows_read);
30
31 // These functions read the value of that |row| into |result|.
32 // Functions return false if the column is of the wrong type or the row
33 // is out of range.
34 bool ReadString(const uint32 row, std::string* result) const;
35 bool ReadUInt32(const uint32 row, uint32* result) const;
36 bool ReadDouble64(const uint32 row, double* result) const;
37 bool ReadUInt8(const uint32 row, uint8* result) const;
38 bool ReadUInt64(const uint32 row, uint64* result) const;
39
40 // Returns the native encoding of field_type.
41 uint16 field_type() const {
vandebo (ex-Chrome) 2013/04/05 18:52:47 Shouldn't this return a PmpFieldType ?
tommycli 2013/04/05 20:06:44 Done.
42 return field_type_;
43 }
44
45 private:
46 bool ParseData(uint32* rows_read);
47 // Returns the number of bytes parsed in the body, or, -1 on failure.
48 long IndexStrings();
49
50 // Source data
51 scoped_array<uint8> data_;
52 size_t length_;
53
54 // Header data
55 uint16 field_type_;
vandebo (ex-Chrome) 2013/04/05 18:52:47 And similarly store one?
tommycli 2013/04/05 20:06:44 Done.
56 uint32 rows_;
57
58 // Index of string start locations if fields are strings. Empty otherwise.
59 std::vector<const char*> strings_;
60
61 DISALLOW_COPY_AND_ASSIGN(PmpColumnReader);
62 };
63
64 } // namespace picasaimport
65
66 #endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698