diff --git a/include/hyprutils/string/VarList.hpp b/include/hyprutils/string/VarList.hpp index e106c3b..dded22a 100644 --- a/include/hyprutils/string/VarList.hpp +++ b/include/hyprutils/string/VarList.hpp @@ -12,9 +12,17 @@ namespace Hyprutils { * @param lastArgNo The number of arguments to split into * @param delim The delimiter to use for splitting * @param removeEmpty Whether to remove empty arguments + */ + CVarList(const std::string& in, const size_t lastArgNo = 0, const char delim = ',', const bool removeEmpty = false); + + /** Split string into arg list with escape handling + * @param in The string to split + * @param lastArgNo The number of arguments to split into + * @param delim The delimiter to use for splitting + * @param removeEmpty Whether to remove empty arguments * @param handleEscape Whether to handle escape characters */ - CVarList(const std::string& in, const size_t lastArgNo = 0, const char delim = ',', const bool removeEmpty = false, const bool handleEscape = false); + CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty, const bool handleEscape); ~CVarList() = default; diff --git a/src/string/VarList.cpp b/src/string/VarList.cpp index 9504797..ed3b372 100644 --- a/src/string/VarList.cpp +++ b/src/string/VarList.cpp @@ -5,6 +5,11 @@ using namespace Hyprutils::String; +// Original constructor calls the extended one with handleEscape = false +Hyprutils::String::CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty) : + CVarList(in, lastArgNo, delim, removeEmpty, false) {} + +// Extended constructor with escape handling parameter Hyprutils::String::CVarList::CVarList(const std::string& in, const size_t lastArgNo, const char delim, const bool removeEmpty, const bool handleEscape) { if (!removeEmpty && in.empty()) { m_vArgs.emplace_back("");