source.hpp (2251B)
1 /* ReaPack: Package manager for REAPER 2 * Copyright (C) 2015-2025 Christian Fillion 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef REAPACK_SOURCE_HPP 19 #define REAPACK_SOURCE_HPP 20 21 #include "package.hpp" 22 #include "path.hpp" 23 #include "platform.hpp" 24 25 class Package; 26 class Version; 27 28 class Source { 29 public: 30 enum Section { 31 UnknownSection = 0, 32 MainSection = 1<<0, 33 MIDIEditorSection = 1<<1, 34 MIDIInlineEditorSection = 1<<2, 35 MIDIEventListEditorSection = 1<<3, 36 MediaExplorerSection = 1<<4, 37 38 ImplicitSection = -1, // for compatibility with v1.0 39 }; 40 41 static Section getSection(const char *); 42 static Section detectSection(const Path &category); 43 44 Source(const std::string &file, const std::string &url, const Version *); 45 46 const Version *version() const { return m_version; } 47 Package::Type type() const; 48 const std::string &file() const; 49 const std::string &url() const { return m_url; } 50 Path targetPath() const; 51 52 void setChecksum(const std::string &checksum) { m_checksum = checksum; } 53 const std::string &checksum() const { return m_checksum; } 54 55 void setPlatform(Platform p) { m_platform = p; } 56 Platform platform() const { return m_platform; } 57 58 void setTypeOverride(Package::Type t) { m_type = t; } 59 Package::Type typeOverride() const { return m_type; } 60 61 void setSections(int); 62 int sections() const { return m_sections; } 63 64 private: 65 Platform m_platform; 66 Package::Type m_type; 67 std::string m_file; 68 std::string m_url; 69 std::string m_checksum; 70 int m_sections; 71 Path m_targetPath; 72 const Version *m_version; 73 }; 74 75 #endif