1
0
forked from blue/pica
pica/utils/helpers.h

25 lines
697 B
C
Raw Normal View History

2023-12-30 22:42:11 +00:00
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
//SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <filesystem>
#include <string>
2023-12-11 23:29:55 +00:00
#define UNUSED(variable) (void)variable
void initPaths(const char* programPath);
const std::filesystem::path& sharedPath();
bool endsWith(const std::string& string, const std::string& query);
2023-12-11 23:29:55 +00:00
void ltrim(std::string& string);
void rtrim(std::string& string);
void trim(std::string& string);
std::string extract(std::string& string, std::string::size_type begin, std::string::size_type end);
2023-12-31 17:10:04 +00:00
template <class T>
struct FirstGreater {
bool operator () (T left, T right) {
return std::get<0>(left) > std::get<0>(right);
}
};