Osmium
0.1
|
00001 #ifndef OSMIUM_OSMFILE_IMPL_HPP 00002 #define OSMIUM_OSMFILE_IMPL_HPP 00003 00004 /* 00005 00006 Copyright 2011 Jochen Topf <jochen@topf.org> and others (see README). 00007 00008 This file is part of Osmium (https://github.com/joto/osmium). 00009 00010 Osmium is free software: you can redistribute it and/or modify it under the 00011 terms of the GNU Lesser General Public License or (at your option) the GNU 00012 General Public License as published by the Free Software Foundation, either 00013 version 3 of the Licenses, or (at your option) any later version. 00014 00015 Osmium is distributed in the hope that it will be useful, but WITHOUT ANY 00016 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00017 PARTICULAR PURPOSE. See the GNU Lesser General Public License and the GNU 00018 General Public License for more details. 00019 00020 You should have received a copy of the Licenses along with Osmium. If not, see 00021 <http://www.gnu.org/licenses/>. 00022 00023 */ 00024 00025 #include <osmium/osmfile.hpp> 00026 #include <osmium/output.hpp> 00027 00028 namespace Osmium { 00029 00030 template <class T> 00031 void OSMFile::read(T& handler) { 00032 Osmium::Input::Base<T>* input = m_encoding->is_pbf() 00033 ? static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::PBF<T>(*this, handler)) 00034 : static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::XML<T>(*this, handler)); 00035 input->parse(); 00036 delete input; 00037 } 00038 00039 Osmium::Output::Base *OSMFile::create_output_file() { 00040 Osmium::Output::Base *output = NULL; 00041 00042 if (m_encoding->is_pbf()) { 00043 output = new Osmium::Output::PBF(*this); 00044 } else { 00045 #ifdef OSMIUM_WITH_OUTPUT_OSM_XML 00046 output = new Osmium::Output::XML(*this); 00047 #endif 00048 } 00049 00050 return output; 00051 } 00052 00053 } // namespace Osmium 00054 00055 #endif // OSMIUM_OSMFILE_IMPL_HPP