diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-02-20 22:35:24 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 95fa2a46519d0820548ab7855b32182ff81f0435 (patch) | |
tree | ff5333b61195a0d5019eb3d0aea05a1ff1ba7897 /src/Platform.cpp | |
parent | 29fa87b048c20a1e6e648cb874c6da1cb7f1766a (diff) |
Change linux platform from 64 to x86_64, add sibs platforms command
Diffstat (limited to 'src/Platform.cpp')
-rw-r--r-- | src/Platform.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Platform.cpp b/src/Platform.cpp index b011d93..f92e1ea 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -1,5 +1,6 @@ #include "../include/Platform.hpp" #include <cassert> +#include <algorithm> namespace sibs { @@ -63,6 +64,34 @@ namespace sibs return PLATFORM_INVALID; } + static std::string join(const std::vector<std::string> &strings) + { + std::string result; + ssize size = strings.size(); + ssize i = 0; + for(const std::string &str: strings) + { + result += str; + if(i == size - 2) + result += " and "; + else if(i < size - 2) + result += ", "; + ++i; + } + return result; + } + + std::string getPlatformListFormatted() + { + std::vector<std::string> platformsSorted; + for(auto &it: PLATFORM_BY_NAME) + { + platformsSorted.push_back({ it.first.data, it.first.size }); + } + std::sort(platformsSorted.begin(), platformsSorted.end()); + return join(platformsSorted); + } + bool isSamePlatformFamily(Platform a, Platform b) { return a & b; |