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

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 unused constant. Created 7 years, 9 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
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..2057eb2ac9e40f9c6068d1497ead328527dabeec
--- /dev/null
+++ b/webkit/fileapi/media/picasa/pmp_column_reader.h
@@ -0,0 +1,63 @@
+// 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/storage/webkit_storage_export.h"
+
+namespace base {
+class FilePath;
+}
+
+namespace fileapi {
+
+// 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| undefined if returns false.
vandebo (ex-Chrome) 2013/03/29 21:35:07 nit: ...is undefined...
tommycli 2013/04/01 22:19:18 Done.
+ bool InitFromFile(const base::FilePath& filepath, uint32* rows_read);
vandebo (ex-Chrome) 2013/03/29 21:35:07 nit: Since there's only one Init method and it's c
tommycli 2013/04/01 22:19:18 Done.
+
+ // These functions read the value of that row into the |result| variable.
vandebo (ex-Chrome) 2013/03/29 21:35:07 nit: ..the value of |row| into |result|.
tommycli 2013/04/01 22:19:18 Done.
+ // Function returns false if the column is of the wrong type or the row
vandebo (ex-Chrome) 2013/03/29 21:35:07 nit: Functions return
tommycli 2013/04/01 22:19:18 Done.
+ // 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;
+
+ const uint16 field_type() const {
vandebo (ex-Chrome) 2013/03/29 21:35:07 The native encoding of field_type is returned? Say
tommycli 2013/04/01 22:19:18 Done.
+ return field_type_;
+ }
+
+ private:
+ bool ParseData(uint32* rows_read);
+ bool IndexStrings();
+ template<class T> bool ValidatePrimitiveArrayLength();
+
+ scoped_array<uint8> data_;
vandebo (ex-Chrome) 2013/03/29 21:35:07 This is really nit picky, but is there any organiz
tommycli 2013/04/01 22:19:18 Done.
+ size_t length_;
+ uint32 rows_;
+
+ // Index of string start locations if fields are strings. Empty otherwise.
+ std::vector<const char*> strings_;
+
+ // Store type of field
+ uint16 field_type_;
+
+ DISALLOW_COPY_AND_ASSIGN(PmpColumnReader);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_

Powered by Google App Engine
This is Rietveld 408576698