A class for representing a list of strings with special constructors. More...
#include <StringList.hpp>
Public Types | |
using | value_type = std::string |
The type of the value stored in a StringList instance (for STL compatibility reasons). | |
Public Member Functions | |
StringList () | |
Construct a default StringList instance. | |
StringList (std::initializer_list< std::string > strings) | |
Construct a StringList instance with a initializer list of strings. | |
StringList (std::vector< std::string > strings) | |
Construct a StringList instance with a vector of strings. | |
StringList (const char *str) | |
Construct a StringList instance by breaking the words within separated by space. More... | |
StringList (const char *str, char token) | |
Construct a StringList instance by breaking the words within separated by a token. More... | |
StringList (std::string str) | |
Construct a StringList instance by breaking the words within separated by space. More... | |
StringList (std::string str, char token) | |
Construct a StringList instance by breaking the words within separated by a token. More... | |
auto | empty () const -> bool |
Return true if the string list is empty. | |
auto | size () const -> std::size_t |
Return the number of strings. | |
auto | data () const -> const std::vector< std::string > & |
Return the vector of strings. | |
auto | operator[] (std::size_t index) -> std::string & |
Return the string at the given index position. | |
auto | operator[] (std::size_t index) const -> const std::string & |
Return the string at the given index position. | |
operator std::vector< std::string > () const | |
Convert this StringList instance into a std::vector<std::string>. | |
auto | begin () const |
Return begin const iterator of this StringList instance (for STL compatibility reasons). | |
auto | begin () |
Return begin iterator of this StringList instance (for STL compatibility reasons). | |
auto | end () const |
Return end const iterator of this StringList instance (for STL compatibility reasons). | |
auto | end () |
Return end iterator of this StringList instance (for STL compatibility reasons). | |
Detailed Description
A class for representing a list of strings with special constructors.
Constructor & Destructor Documentation
◆ StringList() [1/4]
StringList | ( | const char * | str | ) |
Construct a StringList instance by breaking the words within separated by space.
This method converts a given string into a list of strings separated by a token. However, it ignores the token inside brackets. If the token is space, then the string "hello (to you)"
are split into "hello"
and "(to you)"
.
- Parameters
-
str The string containing words separated by space.
◆ StringList() [2/4]
StringList | ( | const char * | str, |
char | token | ||
) |
Construct a StringList instance by breaking the words within separated by a token.
This method converts a given string into a list of strings separated by a token. However, it ignores the token inside brackets. If the token is space, then the string "hello (to you)"
are split into "hello"
and "(to you)"
.
- Parameters
-
str The string containing words separated by token
.token The token used to separate the words in str
.
◆ StringList() [3/4]
StringList | ( | std::string | str | ) |
Construct a StringList instance by breaking the words within separated by space.
This method converts a given string into a list of strings separated by a token. However, it ignores the token inside brackets. If the token is space, then the string "hello (to you)"
are split into "hello"
and "(to you)"
.
- Parameters
-
str The string containing words separated by space.
◆ StringList() [4/4]
StringList | ( | std::string | str, |
char | token | ||
) |
Construct a StringList instance by breaking the words within separated by a token.
This method converts a given string into a list of strings separated by a token. However, it ignores the token inside brackets. If the token is space, then the string "hello (to you)"
are split into "hello"
and "(to you)"
.
- Parameters
-
str The string containing words separated by token
.token The token used to separate the words in str
.
The documentation for this class was generated from the following file:
- Reaktoro/Common/StringList.hpp