OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_METADATA_PARSER_H_ | 5 #ifndef CHROME_BROWSER_METADATA_PARSER_H_ |
6 #define CHROME_BROWSER_METADATA_PARSER_H_ | 6 #define CHROME_BROWSER_METADATA_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 | 11 |
12 // Allows for Iteration on the Properties of a given file. | 12 // Allows for Iteration on the Properties of a given file. |
13 class MetadataPropertyIterator { | 13 class MetadataPropertyIterator { |
14 public: | 14 public: |
15 MetadataPropertyIterator() {} | 15 MetadataPropertyIterator() {} |
16 virtual ~MetadataPropertyIterator() {} | |
17 | 16 |
18 // Gets the next Property in the iterator. Returns false if at the end | 17 // Gets the next Property in the iterator. Returns false if at the end |
19 // of the list. | 18 // of the list. |
20 virtual bool GetNext(std::string* key, std::string* value) = 0; | 19 virtual bool GetNext(std::string* key, std::string* value) = 0; |
21 | 20 |
22 // Gets the number of Properties in this iterator. | 21 // Gets the number of Properties in this iterator. |
23 virtual int Length() = 0; | 22 virtual int Length() = 0; |
24 | 23 |
25 // Checks to see if we're at the end of the list. | 24 // Checks to see if we're at the end of the list. |
26 virtual bool IsEnd() = 0; | 25 virtual bool IsEnd() = 0; |
27 }; | 26 }; |
28 | 27 |
29 // Represents a single instance of parsing on a particular file. | 28 // Represents a single instance of parsing on a particular file. |
30 class MetadataParser { | 29 class MetadataParser { |
31 public: | 30 public: |
32 MetadataParser(const FilePath& path) {} | 31 MetadataParser(const FilePath& path) {} |
33 virtual ~MetadataParser() {} | |
34 | 32 |
35 static const char* kPropertyType; | 33 static const char* kPropertyType; |
36 static const char* kPropertyFilesize; | 34 static const char* kPropertyFilesize; |
37 static const char* kPropertyTitle; | 35 static const char* kPropertyTitle; |
38 | 36 |
39 // Does all the heavy work of parsing out the file. Blocking until complete. | 37 // Does all the heavy work of parsing out the file. Blocking until complete. |
40 virtual bool Parse() = 0; | 38 virtual bool Parse() = 0; |
41 | 39 |
42 // Gets a particular property found in a parse call. | 40 // Gets a particular property found in a parse call. |
43 virtual bool GetProperty(const std::string& key, std::string* value) = 0; | 41 virtual bool GetProperty(const std::string& key, std::string* value) = 0; |
44 | 42 |
45 // Gets an interator allowing you to iterate over all the properties found | 43 // Gets an interator allowing you to iterate over all the properties found |
46 // in a parse call. | 44 // in a parse call. |
47 virtual MetadataPropertyIterator* GetPropertyIterator() = 0; | 45 virtual MetadataPropertyIterator* GetPropertyIterator() = 0; |
48 }; | 46 }; |
49 | 47 |
50 #endif // CHROME_BROWSER-METADATA_PARSER_H_ | 48 #endif // CHROME_BROWSER-METADATA_PARSER_H_ |
OLD | NEW |