29#include <sptk5/String.h>
51 :
public std::vector<String>
107 std::copy(list.begin(), list.end(), back_inserter(*
this));
157 return (
int) m_userData;
175 return StringVector::erase(begin() + i);
184 if (
auto itor = std::find(begin(), end(), str); itor != end())
186 return StringVector::erase(itor);
209 void sort(
bool ascending =
true);
216 m_sorted = SortOrder::UNSORTED;
217 StringVector::clear();
227 if (size > this->size())
229 m_sorted = SortOrder::UNSORTED;
231 StringVector::resize(size);
239 m_sorted = SortOrder::UNSORTED;
240 StringVector::push_back(str);
248 m_sorted = SortOrder::UNSORTED;
249 StringVector::push_back(std::move(str));
255 template<
typename... Args>
258 m_sorted = SortOrder::UNSORTED;
259 StringVector::emplace_back(args...);
269 m_sorted = SortOrder::UNSORTED;
270 return StringVector::operator[](index);
280 return StringVector::operator[](index);
284 using StringVector = std::vector<String>;
289 int64_t m_userData {0};
294 SortOrder m_sorted {SortOrder::UNSORTED};
iterator remove(const String &str)
Definition: Strings.h:182
Strings(const String &src, const char *delimiter, SplitMode mode=SplitMode::DELIMITER) noexcept
void fromString(const String &src, const char *delimiter, SplitMode mode)
String & operator[](size_t index)
Definition: Strings.h:267
Strings grep(const String &pattern) const
virtual int indexOf(const String &needle) const
void clear()
Definition: Strings.h:214
virtual ~Strings()=default
void push_back(const String &str)
Definition: Strings.h:237
Strings(Strings &&other)=default
void saveToFile(const fs::path &fileName) const
String join(const String &delimiter) const
void argument(int64_t d)
Definition: Strings.h:164
void push_back(String &&str)
Definition: Strings.h:246
Strings(std::initializer_list< String > list)
Definition: Strings.h:105
void loadFromFile(const fs::path &fileName)
SplitMode
Definition: Strings.h:68
Strings(const Strings &other)=default
int64_t argument() const
Definition: Strings.h:155
void resize(size_t size)
Definition: Strings.h:225
void emplace_back(Args &&... args)
Definition: Strings.h:256
SortOrder
Definition: Strings.h:58
void sort(bool ascending=true)
const String & operator[](size_t index) const
Definition: Strings.h:278
iterator remove(size_t i)
Definition: Strings.h:173