diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2024-06-11 17:17:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-11 17:17:45 +0200 |
| commit | 8c64a4bad710fb18e9b84812bd680a89d1e93661 (patch) | |
| tree | 2439b8408abd8e14f6af35ef9cfbeb7c51429f99 /src/helpers/VarList.cpp | |
| parent | 1f46296ea05f9a8e6020ab694b531c91a1abdfa6 (diff) | |
core: move to hyprutils for utils (#6385)
* core: move to hyprutils for utils
Nix: add hyprutils dep
* Meson: add hyprutils dep
* flake.lock: update
---------
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src/helpers/VarList.cpp')
| -rw-r--r-- | src/helpers/VarList.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/helpers/VarList.cpp b/src/helpers/VarList.cpp deleted file mode 100644 index 780ea9a0..00000000 --- a/src/helpers/VarList.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#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; -}
\ No newline at end of file |
