varlist: cleanup unintuitive string splitting (#3369)
* refactor(varlist): replace unintuitive string splitting * refactor(varlist): remove test asserts
This commit is contained in:
parent
60f10e6037
commit
c50072b108
2 changed files with 25 additions and 31 deletions
|
|
@ -5,8 +5,12 @@
|
|||
|
||||
class CVarList {
|
||||
public:
|
||||
/* passing 's' as a separator will use std::isspace */
|
||||
CVarList(const std::string& in, long unsigned int lastArgNo = 0, const char separator = ',');
|
||||
/** Split string into arg list
|
||||
@param lastArgNo stop splitting after argv reaches maximum size, last arg will contain rest of unsplit args
|
||||
@param delim if delimiter is 's', use std::isspace
|
||||
@param removeEmpty remove empty args from argv
|
||||
*/
|
||||
CVarList(const std::string& in, const size_t maxSize = 0, const char delim = ',', const bool removeEmpty = false);
|
||||
|
||||
~CVarList() = default;
|
||||
|
||||
|
|
@ -16,7 +20,7 @@ class CVarList {
|
|||
|
||||
std::string join(const std::string& joiner, size_t from = 0, size_t to = 0) const;
|
||||
|
||||
std::string operator[](const long unsigned int& idx) const {
|
||||
std::string operator[](const size_t& idx) const {
|
||||
if (idx >= m_vArgs.size())
|
||||
return "";
|
||||
return m_vArgs[idx];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue