reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

platform.hpp (1917B)


      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_PLATFORM_HPP
     19 #define REAPACK_PLATFORM_HPP
     20 
     21 class Platform {
     22 public:
     23   enum Enum {
     24     Unknown,
     25 
     26     Darwin_i386   = 1<<0,
     27     Darwin_x86_64 = 1<<1,
     28     Darwin_arm64  = 1<<2,
     29     Darwin_Any    = Darwin_i386 | Darwin_x86_64 | Darwin_arm64,
     30 
     31     Linux_i686    = 1<<3,
     32     Linux_x86_64  = 1<<4,
     33     Linux_armv7l  = 1<<5,
     34     Linux_aarch64 = 1<<6,
     35     Linux_Any     = Linux_i686 | Linux_x86_64 | Linux_armv7l | Linux_aarch64,
     36 
     37     Windows_x86     = 1<<7,
     38     Windows_x64     = 1<<8,
     39     Windows_arm64ec = 1<<9,
     40     Windows_Any     = Windows_x86 | Windows_x64 | Windows_arm64ec,
     41     Windows_x64_arm64ec = Windows_x64 | Windows_arm64ec,
     42 
     43     Generic = Darwin_Any | Linux_Any | Windows_Any,
     44   };
     45 
     46   static const Enum Current;
     47 
     48   Platform() : m_value(Generic) {}
     49   Platform(Enum val) : m_value(val) {}
     50   Platform(const char *str, bool hasArm64Ec = true) : m_value(parse(str, hasArm64Ec)) {}
     51 
     52   Enum value() const { return m_value; }
     53   bool test() const;
     54 
     55   operator Enum() const { return m_value; }
     56   Platform &operator=(Enum n) { m_value = n; return *this; }
     57 
     58 private:
     59   static Enum parse(const char *, bool hasArm64Ec);
     60 
     61   Enum m_value;
     62 };
     63 
     64 #endif