1 /* 2 * exporthelper.h 3 * Copyright 2018, Thorbjørn Lindeijer <bjorn@lindeijer.nl> 4 * 5 * This file is part of Tiled. 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #pragma once 22 23 #include "fileformat.h" 24 #include "preferences.h" 25 #include "tileset.h" 26 27 #include <memory> 28 29 namespace Tiled { 30 31 /** 32 * Applies certain export options to a map and its tilesets, or to a specific 33 * tileset. 34 */ 35 class ExportHelper 36 { 37 public: 38 explicit ExportHelper(Preferences::ExportOptions options = Preferences::instance()->exportOptions()) mOptions(options)39 : mOptions(options) 40 {} 41 42 FileFormat::Options formatOptions() const; 43 44 SharedTileset prepareExportTileset(const SharedTileset &tileset, 45 bool savingTileset = true) const; 46 47 const Map *prepareExportMap(const Map *map, std::unique_ptr<Map> &exportMap) const; 48 49 private: 50 void resolveTypeAndProperties(MapObject *object) const; 51 52 const Preferences::ExportOptions mOptions; 53 }; 54 55 } // namespace Tiled 56