|
#include <Strings.h>
Public Types | |
| enum class | SortOrder : uint8_t { UNSORTED , ASCENDING , DESCENDING } |
| enum class | SplitMode : uint8_t { DELIMITER , ANYCHAR , REGEXP } |
Public Member Functions | |
| Strings ()=default | |
| Strings (const Strings &other)=default | |
| Strings (Strings &&other)=default | |
| Strings (std::initializer_list< String > list) | |
| Strings (const String &src, const char *delimiter, SplitMode mode=SplitMode::DELIMITER) noexcept | |
| virtual | ~Strings ()=default |
| void | fromString (const String &src, const char *delimiter, SplitMode mode) |
| virtual int | indexOf (const String &needle) const |
| void | saveToFile (const fs::path &fileName) const |
| void | loadFromFile (const fs::path &fileName) |
| int64_t | argument () const |
| void | argument (int64_t d) |
| iterator | remove (size_t i) |
| iterator | remove (const String &str) |
| Strings & | operator= (const Strings &other)=default |
| Strings & | operator= (Strings &&other)=default |
| String | join (const String &delimiter) const |
| Strings | grep (const String &pattern) const |
| void | sort (bool ascending=true) |
| void | clear () |
| void | resize (size_t size) |
| void | push_back (const String &str) |
| void | push_back (String &&str) |
| template<typename... Args> | |
| void | emplace_back (Args &&... args) |
| String & | operator[] (size_t index) |
| const String & | operator[] (size_t index) const |
List of strings with ids
General string list. Based on vector<idstring>. Stores strings with (optional) integer Ids. Includes several extra methods to construct it from string or load/save from/to file.
|
strong |
Sort order enumeration
|
strong |
String split mode
| Enumerator | |
|---|---|
| DELIMITER | Split by the whole delimiter |
| ANYCHAR | Split by any char in delimiter |
| REGEXP | Regular expression |
|
default |
Default constructor
|
default |
Copy constructor
|
default |
Move constructor
|
inline |
Initializer list constructor
| list | Initializer list |
|
noexcept |
Constructor from a string with elements separated by a delimiter string
| src | Source string |
| delimiter | Delimiter string |
| mode | Delimiter string usage |
|
virtualdefault |
Destructor
|
inline |
Returns user data as integer
|
inline |
Sets user data as integer
| d | New value for user data |
|
inline |
Clear strings
|
inline |
Emplace back a string
Assigns strings from a string with elements separated by a delimiter string
| src | Source string |
| delimiter | Delimiter string |
| mode | Delimiter string usage |
Returns strings matching regex pattern
| pattern | Regex pattern |
|
virtual |
Returns concatenated string
| delimiter | Delimiter |
| void sptk::Strings::loadFromFile | ( | const fs::path & | fileName | ) |
Loads strings from file. String ids are not loaded.
| fileName | The name of the file |
|
inline |
|
inline |
|
inline |
Push back a string
Referenced by sptk::Tar::fileList().
|
inline |
Push back a string
|
inline |
Removes a string from this object
| str | String to remove from the string vector |
|
inline |
Removes a string from this object
| i | String index in the string vector |
|
inline |
Change size of the collection
| size | New number of strings in the collection |
| void sptk::Strings::saveToFile | ( | const fs::path & | fileName | ) | const |
Saves strings to file. String ids are discarded.
| fileName | The name of the file |
| void sptk::Strings::sort | ( | bool | ascending = true | ) |
Sort strings inside this object