Enabled arcs render after adapting OpenCNCPilot code.
Started porting iosender to C++
This commit is contained in:
+38
-1
@@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
inline std::vector<std::string> split_string(const std::string& in, const std::string& delimiter) {
|
||||
std::vector<std::string> result{};
|
||||
@@ -40,4 +42,39 @@ inline std::string& trim(std::string& str, const std::string& chars = "\t\n\v\f\
|
||||
|
||||
inline std::string trim(std::string&& str, const std::string& chars = "\t\n\v\f\r ") {
|
||||
return ltrim(rtrim(str, chars), chars);
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string& to_upper(std::string& str) {
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](unsigned char c) { return std::toupper(c); });
|
||||
return str;
|
||||
}
|
||||
|
||||
inline std::string& to_lower(std::string& str) {
|
||||
std::transform(str.begin(), str.end(), str.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
return str;
|
||||
}
|
||||
|
||||
inline std::string to_upper(std::string&& str) {
|
||||
auto result = str;
|
||||
return to_upper(result);
|
||||
}
|
||||
|
||||
inline std::string to_lower(std::string&& str) {
|
||||
auto result = str;
|
||||
return to_lower(result);
|
||||
}
|
||||
|
||||
inline bool string_contains(const std::string& str, const std::string& needle) {
|
||||
return str.find(needle) != std::string::npos;
|
||||
}
|
||||
|
||||
inline std::string remove_spaces(std::string str) {
|
||||
str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
inline bool starts_with(const std::string& line, const std::string& prefix) {
|
||||
return line.rfind(prefix, 0) == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user