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

Unified 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: Remove Win specific defines and fix up PmpFieldType usage. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/fileapi/media/picasa/pmp_column_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/media/picasa/pmp_column_reader.h
diff --git a/webkit/fileapi/media/picasa/pmp_column_reader.h b/webkit/fileapi/media/picasa/pmp_column_reader.h
new file mode 100644
index 0000000000000000000000000000000000000000..126657421df75c498d7bc654e75380d7d2e9a6c1
--- /dev/null
+++ b/webkit/fileapi/media/picasa/pmp_column_reader.h
@@ -0,0 +1,67 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
+#define WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "webkit/fileapi/media/picasa/pmp_constants.h"
+#include "webkit/storage/webkit_storage_export.h"
+
+namespace base {
+class FilePath;
+}
+
+namespace picasaimport {
+
+// Reads a single PMP column from a file.
+class WEBKIT_STORAGE_EXPORT_PRIVATE PmpColumnReader {
+ public:
+ PmpColumnReader();
+ virtual ~PmpColumnReader();
+
+ // Returns true if read successfully.
+ // |rows_read| is undefined if returns false.
+ bool Init(const base::FilePath& filepath, uint32* rows_read);
+
+ // These functions read the value of that |row| into |result|.
+ // Functions return false if the column is of the wrong type or the row
+ // is out of range.
+ bool ReadString(const uint32 row, std::string* result) const;
+ bool ReadUInt32(const uint32 row, uint32* result) const;
+ bool ReadDouble64(const uint32 row, double* result) const;
+ bool ReadUInt8(const uint32 row, uint8* result) const;
+ bool ReadUInt64(const uint32 row, uint64* result) const;
+
+ // Returns the native encoding of field_type.
+ PmpFieldType field_type() const {
+ return field_type_;
+ }
+
+ private:
+ bool ParseData(uint32* rows_read);
+ // Returns the number of bytes parsed in the body, or, -1 on failure.
+ long IndexStrings();
+
+ // Source data
+ scoped_array<uint8> data_;
+ size_t length_;
+
+ // Header data
+ PmpFieldType field_type_;
+ uint32 rows_;
+
+ // Index of string start locations if fields are strings. Empty otherwise.
+ std::vector<const char*> strings_;
+
+ DISALLOW_COPY_AND_ASSIGN(PmpColumnReader);
+};
+
+} // namespace picasaimport
+
+#endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/fileapi/media/picasa/pmp_column_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698