#ifndef CHROME_BROWSER_PARSERS_METADATA_PARSER_FILEBASE_H_
#define CHROME_BROWSER_PARSERS_METADATA_PARSER_FILEBASE_H_
#include <string>
#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
#include "chrome/browser/parsers/metadata_parser.h"
typedef base::hash_map<std::string, std::string> PropertyMap;
class FileMetadataParser : public MetadataParser {
public:
explicit FileMetadataParser(const base::FilePath& path);
virtual ~FileMetadataParser();
virtual bool Parse() OVERRIDE;
virtual bool GetProperty(const std::string& key, std::string* value) OVERRIDE;
virtual MetadataPropertyIterator* GetPropertyIterator() OVERRIDE;
protected:
PropertyMap properties_;
base::FilePath path_;
private:
DISALLOW_COPY_AND_ASSIGN(FileMetadataParser);
};
class FileMetadataPropertyIterator : public MetadataPropertyIterator {
public:
explicit FileMetadataPropertyIterator(PropertyMap& properties);
virtual ~FileMetadataPropertyIterator();
virtual bool GetNext(std::string* key, std::string* value) OVERRIDE;
virtual int Length() OVERRIDE;
virtual bool IsEnd() OVERRIDE;
private:
PropertyMap& properties_;
PropertyMap::iterator it;
DISALLOW_COPY_AND_ASSIGN(FileMetadataPropertyIterator);
};
#endif