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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PARSERS_METADATA_PARSER_H_
6 #define CHROME_BROWSER_PARSERS_METADATA_PARSER_H_
14 // Allows for Iteration on the Properties of a given file.
15 class MetadataPropertyIterator
{
17 MetadataPropertyIterator() {}
18 virtual ~MetadataPropertyIterator() {}
21 // Gets the next Property in the iterator. Returns false if at the end
23 virtual bool GetNext(std::string
* key
, std::string
* value
) = 0;
25 // Gets the number of Properties in this iterator.
26 virtual int Length() = 0;
28 // Checks to see if we're at the end of the list.
29 virtual bool IsEnd() = 0;
32 // Represents a single instance of parsing on a particular file.
33 class MetadataParser
{
35 explicit MetadataParser(const base::FilePath
& path
) {}
36 virtual ~MetadataParser() {}
39 static const char* kPropertyType
;
40 static const char* kPropertyFilesize
;
41 static const char* kPropertyTitle
;
43 // Does all the heavy work of parsing out the file. Blocking until complete.
44 virtual bool Parse() = 0;
46 // Gets a particular property found in a parse call.
47 virtual bool GetProperty(const std::string
& key
, std::string
* value
) = 0;
49 // Gets an interator allowing you to iterate over all the properties found
51 virtual MetadataPropertyIterator
* GetPropertyIterator() = 0;
54 #endif // CHROME_BROWSER_PARSERS_METADATA_PARSER_H_