Go to the documentation of this file.00001 #include "importer.hh"
00002 #include <iostream>
00003 #include <fstream>
00004 #include <sstream>
00005 #include <string.h>
00006 #include <boost/lexical_cast.hpp>
00007
00008 using namespace Typelib;
00009 using namespace std;
00010
00011 void Importer::load
00012 ( std::string const& path
00013 , utilmm::config_set const& config
00014 , Registry& registry)
00015 {
00016
00017 ifstream s(path.c_str());
00018 if (!s)
00019 throw ImportError(path, "cannot open for reading");
00020 load(s, config, registry);
00021 }
00022
00023
00024 ImportError::ImportError(const std::string& file, const std::string& what_, int line, int column)
00025 : std::runtime_error(file + ":" + boost::lexical_cast<string>(line) + ":" + what_)
00026 , m_file(file), m_line(line), m_column(column), m_what(what_), m_buffer(0) {}
00027 ImportError::~ImportError() throw() {}
00028
00029 void ImportError::setFile(const std::string& path) { m_file = path; }
00030 std::string ImportError::getFile() const { return m_file; }
00031 int ImportError::getLine() const { return m_line; }
00032 int ImportError::getColumn() const { return m_column; }
00033
00034