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