00001 #ifndef TYPELIB_IMPORTER_HH 00002 #define TYPELIB_IMPORTER_HH 00003 00004 #include <string> 00005 #include "pluginmanager.hh" 00006 00007 namespace utilmm { class config_set; } 00008 00009 namespace Typelib 00010 { 00011 class Registry; 00012 00014 class ImportError : public std::runtime_error 00015 { 00016 std::string m_file; 00017 int m_line, m_column; 00018 std::string m_what; 00019 char* m_buffer; 00020 00021 public: 00022 ImportError(const std::string& file, const std::string& what_ = "", int line = 0, int column = 0); 00023 ~ImportError() throw(); 00024 00025 void setFile(const std::string& path); 00027 std::string getFile() const; 00029 int getLine() const; 00031 int getColumn() const; 00032 }; 00033 00034 class ImportPlugin 00035 { 00036 std::string m_name; 00037 00038 public: 00039 ImportPlugin(std::string const& name) 00040 : m_name(name) {} 00041 virtual ~ImportPlugin() {} 00042 00043 std::string getName() const { return m_name; } 00044 virtual Importer* create() = 0; 00045 }; 00046 00048 class Importer 00049 { 00050 public: 00051 virtual ~Importer() {} 00052 00058 virtual void load 00059 ( std::istream& stream 00060 , utilmm::config_set const& config 00061 , Registry& registry) = 0; 00062 00069 virtual void load 00070 ( std::string const& path 00071 , utilmm::config_set const& config 00072 , Registry& registry); 00073 }; 00074 } 00075 00076 #endif 00077