2 // Copyright (C) 2007 Christoph Sommer <christoph.sommer@2007.expires.deltadevelopment.de>
3 // 2014 Ingo Ruhnke <grumbel@gmail.com>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef HEADER_SUPERTUX_ADDON_ADDON_HPP
19 #define HEADER_SUPERTUX_ADDON_ADDON_HPP
25 #include "util/reader_fwd.hpp"
30 static std::unique_ptr<Addon> parse(const Reader& lisp);
31 static std::unique_ptr<Addon> parse(const std::string& fname);
33 enum Type { WORLD, WORLDMAP, LEVELSET };
36 // fields provided by the addon.zip itself
42 std::string m_license;
44 // additional fields provided for addons from an addon repository
48 // fields filled by the AddonManager
49 std::string m_install_filename;
56 std::string get_id() const { return m_id; }
57 int get_version() const { return m_version; }
59 Type get_type() const { return m_type; }
60 std::string get_title() const { return m_title; }
61 std::string get_author() const { return m_author; }
62 std::string get_license() const { return m_license; }
64 std::string get_url() const { return m_url; }
65 std::string get_md5() const { return m_md5; }
67 std::string get_filename() const;
68 std::string get_install_filename() const;
70 bool is_installed() const;
71 bool is_enabled() const;
73 void set_install_filename(const std::string& absolute_filename, const std::string& md5);
74 void set_enabled(bool v);
77 Addon(const Addon&) = delete;
78 Addon& operator=(const Addon&) = delete;