From 95fa2a46519d0820548ab7855b32182ff81f0435 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 20 Feb 2019 22:35:24 +0100 Subject: Change linux platform from 64 to x86_64, add sibs platforms command --- src/Platform.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/Platform.cpp') 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 +#include namespace sibs { @@ -63,6 +64,34 @@ namespace sibs return PLATFORM_INVALID; } + static std::string join(const std::vector &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 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; -- cgit v1.2.3