summaryrefslogtreecommitdiffstats
path: root/chrome/browser/parsers/metadata_parser_filebase.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/parsers/metadata_parser_filebase.h')
-rw-r--r--chrome/browser/parsers/metadata_parser_filebase.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/parsers/metadata_parser_filebase.h b/chrome/browser/parsers/metadata_parser_filebase.h
new file mode 100644
index 0000000..8b67a2d
--- /dev/null
+++ b/chrome/browser/parsers/metadata_parser_filebase.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 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 CHROME_BROWSER_METADATA_PARSER_FILEBASE_H_
+#define CHROME_BROWSER_METADATA_PARSER_FILEBASE_H_
+
+#include "chrome/browser/parsers/metadata_parser.h"
+
+typedef base::hash_map<std::string, std::string> PropertyMap;
+
+// Parser for the file type. Allows for parsing of files, and gets
+// properties assiciated with files.
+class FileMetadataParser : public MetadataParser {
+ public:
+ FileMetadataParser(const FilePath& path);
+
+ // Implementation of MetadataParser
+ virtual bool Parse();
+ virtual bool GetProperty(const std::string& key, std::string* value);
+
+ MetadataPropertyIterator* GetPropertyIterator();
+
+ protected:
+ PropertyMap properties_;
+ FilePath path_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FileMetadataParser);
+};
+
+class FileMetadataPropertyIterator : public MetadataPropertyIterator {
+ public:
+ FileMetadataPropertyIterator(PropertyMap& properties);
+
+ // Implementation of MetadataPropertyIterator
+ virtual bool GetNext(std::string* key, std::string* value);
+ virtual int Length();
+ virtual bool IsEnd();
+
+ private:
+ PropertyMap& properties_;
+ PropertyMap::iterator it;
+
+ DISALLOW_COPY_AND_ASSIGN(FileMetadataPropertyIterator);
+};
+
+#endif // CHROME_BROWSER_METADATA_PARSER_FILEBASE_H_