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

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: Fix memory issue. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
vandebo (ex-Chrome) 2013/03/26 01:12:14 As of 8/12 the copyright format changed, there sho
tommycli 2013/03/26 22:30:43 Done.
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
13 namespace base {
14 class FilePath;
vandebo (ex-Chrome) 2013/03/26 01:12:14 nit: namespace does not indent.
tommycli 2013/03/26 22:30:43 Done.
15 }
16
17 namespace fileapi {
18
19 // Parses a PMP bytestream from either a file or directly from memory
20 class PmpColumnReader {
21 public:
22 PmpColumnReader(std::string column_name);
23 virtual ~PmpColumnReader();
24
25 // Returns true if read successfully. rows_read is undefined if returns false
vandebo (ex-Chrome) 2013/03/26 01:12:14 |rows_read| and add a '.' at the end. Comments sh
tommycli 2013/03/26 22:30:43 Done.
26 bool ReadFromDisk(uint32* rows_read, const base::FilePath& filepath);
vandebo (ex-Chrome) 2013/03/26 01:12:14 Do you use both ReadFromDisk and ReadFromMemory?
tommycli 2013/03/26 22:30:43 Makes sense. I consolidated ReadFromDisk functiona
27 bool ReadFromMemory(uint32* rows_read, const uint8* data, const size_t len);
28
29 template<class T> bool Read(uint32 row, T* target);
vandebo (ex-Chrome) 2013/03/26 01:12:14 Probably want a family of methods here instead of
tommycli 2013/03/26 22:30:43 Yeah, this way is way more readable. I was able to
30
31 const std::string column_name_;
vandebo (ex-Chrome) 2013/03/26 01:12:14 Data members should be private. http://google-styl
tommycli 2013/03/26 22:30:43 Done.
32
33 private:
34 bool ParseData(uint32* rows_read);
35 bool IndexStrings();
36 template<class T> bool SetAndValidateFieldsize();
37
38 uint8* data_;
39 size_t length_;
40 uint32 rows_;
41
42 // Store locations to strings if the data type is strings
43 std::vector<const char*> strings_;
44
45 // Size in bytes of each field. -1 if string type or uninitialized
46 int fieldsize_;
47
48 DISALLOW_COPY_AND_ASSIGN(PmpColumnReader);
49 };
50
51 template<> bool PmpColumnReader::Read(uint32 row, std::string* target);
vandebo (ex-Chrome) 2013/03/26 01:12:14 You're only read string columns? If that's all yo
tommycli 2013/03/26 22:30:43 This was here to declare a custom specialization f
52
53 } // namespace fileapi
54
55 #endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_COLUMN_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698