mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 18:09:49 +01:00
8637bfb1b7
* helpers: add missing header after2e34548aea
src/helpers/VarList.cpp: In constructor 'CVarList::CVarList(const std::string&, size_t, char, bool)': src/helpers/VarList.cpp:19:34: error: 'removeBeginEndSpacesTabs' was not declared in this scope 19 | m_vArgs.emplace_back(removeBeginEndSpacesTabs(in.substr(pos))); | ^~~~~~~~~~~~~~~~~~~~~~~~ src/helpers/VarList.cpp:23:30: error: 'removeBeginEndSpacesTabs' was not declared in this scope 23 | m_vArgs.emplace_back(removeBeginEndSpacesTabs(std::string_view{s}.data())); | ^~~~~~~~~~~~~~~~~~~~~~~~ * helpers: add missing C linkage after0dbd997003
ld.lld: error: undefined symbol: wlr_region_scale(pixman_region32*, pixman_region32 const*, float) >>> referenced by Region.cpp >>> src/Hyprland.p/helpers_Region.cpp.o:(CRegion::scale(float)) >>> did you mean: extern "C" wlr_region_scale >>> defined in: /usr/lib/libwlroots.so.12032
37 lines
No EOL
1.1 KiB
C++
37 lines
No EOL
1.1 KiB
C++
#include "MiscFunctions.hpp"
|
|
#include "VarList.hpp"
|
|
#include <ranges>
|
|
#include <algorithm>
|
|
|
|
CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty) {
|
|
if (in.empty())
|
|
m_vArgs.emplace_back("");
|
|
|
|
std::string args{in};
|
|
size_t idx = 0;
|
|
size_t pos = 0;
|
|
std::ranges::replace_if(
|
|
args, [&](const char& c) { return delim == 's' ? std::isspace(c) : c == delim; }, 0);
|
|
|
|
for (const auto& s : args | std::views::split(0)) {
|
|
if (removeEmpty && s.empty())
|
|
continue;
|
|
if (++idx == lastArgNo) {
|
|
m_vArgs.emplace_back(removeBeginEndSpacesTabs(in.substr(pos)));
|
|
break;
|
|
}
|
|
pos += s.size() + 1;
|
|
m_vArgs.emplace_back(removeBeginEndSpacesTabs(std::string_view{s}.data()));
|
|
}
|
|
}
|
|
|
|
std::string CVarList::join(const std::string& joiner, size_t from, size_t to) const {
|
|
size_t last = to == 0 ? size() : to;
|
|
|
|
std::string rolling;
|
|
for (size_t i = from; i < last; ++i) {
|
|
rolling += m_vArgs[i] + (i + 1 < last ? joiner : "");
|
|
}
|
|
|
|
return rolling;
|
|
} |