rm ingored
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
#include "utils.h"
|
||||
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
std::string to_utf8(std::wstring wide_string) {
|
||||
static std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
||||
return utf8_conv.to_bytes(wide_string);
|
||||
}
|
||||
|
||||
std::wstring from_utf8(std::string string) {
|
||||
static std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
||||
return utf8_conv.from_bytes(string);
|
||||
}
|
||||
|
||||
std::string get_path_relative_to_home(std::string path) {
|
||||
return std::string(std::getenv("HOME")) + "/" + path;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool vector_contains_element(const std::vector<T>& vector, const T& to_find) {
|
||||
for (const T& element : vector) {
|
||||
if (element == to_find) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//ужас
|
||||
template bool vector_contains_element<std::string>(const std::vector<std::string>& vector, const std::string& to_find);
|
||||
|
||||
std::vector<std::string> split(std::string s, std::string delimiter) {
|
||||
std::vector<std::string> result;
|
||||
size_t pos = 0;
|
||||
std::string token;
|
||||
while ((pos = s.find(delimiter)) != std::string::npos) {
|
||||
token = s.substr(0, pos);
|
||||
result.push_back(token);
|
||||
s.erase(0, pos + delimiter.length());
|
||||
}
|
||||
result.push_back(s);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
std::string to_utf8(std::wstring wide_string);
|
||||
std::wstring from_utf8(std::string string);
|
||||
|
||||
std::string get_path_relative_to_home(std::string path);
|
||||
|
||||
template <typename T>
|
||||
bool vector_contains_element(const std::vector<T> &vector, const T &to_find);
|
||||
|
||||
std::vector<std::string> split(std::string, std::string);
|
||||
|
||||
#endif // UTILS_H
|
||||
Reference in New Issue
Block a user