Go to the documentation of this file.
52 explicit CStringList(
const std::deque<std::string>& lines) : m_strings(lines) { }
57 std::copy(lines.begin(),lines.end(),std::back_inserter(m_strings));
63 void add(
const std::string &str );
71 void insert(
size_t index,
const std::string &str );
76 void set(
size_t index,
const std::string &str );
94 const std::string &compareText,
96 bool caseSensitive =
true)
const;
100 void get(
size_t index, std::string &outText)
const;
104 std::string operator ()(
size_t index)
const;
108 std::string& operator ()(
size_t index);
162 void set(
const std::string &keyName,
const std::string &value );
166 void set(
const std::string &keyName,
const int &value );
170 void set(
const std::string &keyName,
const float &value );
174 void set(
const std::string &keyName,
const double &value );
178 void set(
const std::string &keyName,
const bool &value );
bool find(const std::string &compareText, size_t foundIndex, bool caseSensitive=true) const
Looks for a given string in the list, and returns its index, or returns "false" otherwise.
double get_double(const std::string &keyName)
Returns the value of the given key ("key=value").
std::string get_string(const std::string &keyName)
Returns the value of the given key ("key=value").
void getText(std::string &outText) const
Returns the whole string list as a single string with '\r ' characters for newlines.
void set(const std::string &keyName, const std::string &value)
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
CStringList(const std::vector< std::string > &lines)
Explicit constructor from vector<string>
void set(const std::string &keyName, const int &value)
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
CStringList(const std::string &text)
Constructor from a text.
void set(const std::string &keyName, const bool &value)
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
void insert(size_t index, const std::string &str)
Inserts a new item at a given position (0=insert at the beggining,1=put into the second position,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void remove(size_t index)
Delete the element at a given position (0=first element)
float get_float(const std::string &keyName)
Returns the value of the given key ("key=value").
void clear()
Clear the whole list.
size_t size() const
Returns the number of text lines in the list.
CStringList()
Default constructor (empty string list)
CStringList(const std::deque< std::string > &lines)
Explicit constructor from deque<string>
void set(size_t index, const std::string &str)
Overwrites an existing position with a new value (0=first elements)
void loadFromFile(const std::string &fileName)
Load the string list from a file.
void saveToFile(const std::string &fileName) const
Save the string list to a file.
int get_int(const std::string &keyName)
Returns the value of the given key ("key=value").
The virtual base class which provides a unified interface for all persistent objects in MRPT.
std::deque< std::string > m_strings
The internal list of strings.
void set(const std::string &keyName, const double &value)
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void set(const std::string &keyName, const float &value)
Sets the value of a given key ("key=value"), overwritten previous value if it existed.
bool get_bool(const std::string &keyName)
Returns the value of the given key ("key=value").
std::string getText() const
Returns the whole string list as a single string with '\r ' characters for newlines.
CStream BASE_IMPEXP & operator<<(mrpt::utils::CStream &s, const char *a)
void add(const std::string &str)
Appends a new string at the end of the string list.
A class for storing a list of text lines.
void setText(const std::string &inText)
Fills the string list by parsing a single string with '\r', ' ', or '\r ' characters indicatng newlin...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
void get(size_t index, std::string &outText) const
Returns one string from the line list.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |