aboutsummaryrefslogtreecommitdiff
path: root/src/Platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform.cpp')
-rw-r--r--src/Platform.cpp29
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;