51 m_strings.push_back( str );
62 m_strings.insert( m_strings.begin()+
index, str);
75 m_strings[
index]= str;
98 m_strings.erase( m_strings.begin()+
index );
108 const string &compareText,
110 bool caseSensitive)
const 139 size_t curPos = 0,totalLen = 0;
143 for (it=m_strings.begin();it!=m_strings.end();it++)
144 totalLen += it->size() + 2;
146 outText.resize(totalLen);
150 for (it=m_strings.begin();it!=m_strings.end();it++)
152 os::memcpy(&outText[curPos],totalLen,it->c_str(),it->size());
154 outText[curPos++]=
'\r';
155 outText[curPos++]=
'\n';
185 wholeStr.resize( nBytes );
189 if ( nBytes != fil.ReadBuffer( &wholeStr[0],nBytes ) )
208 for (it=m_strings.begin();it!=m_strings.end();++it)
210 fil.WriteBuffer( it->c_str(), it->size() );
211 fil.WriteBuffer(
"\r\n",2 );
267 return m_strings.size();
278 outText = m_strings[
index];
291 return m_strings[
index];
303 return m_strings[
index];
313 string strToLookFor(keyName +
string(
"="));
314 size_t idx = string::npos;
318 idx = it->find(strToLookFor);
320 return it->substr( strToLookFor.size() );
334 string s( get_string(keyName) );
335 return (
float)atof(
s.c_str());
345 string s( get_string(keyName) );
346 return atoi(
s.c_str());
356 string s( get_string(keyName) );
357 return atof(
s.c_str());
367 string s( get_string(keyName) );
368 return atoi(
s.c_str())!=0;
378 string strToLookFor(keyName +
string(
"="));
379 size_t idx = string::npos;
383 idx = it->find(strToLookFor);
387 (*it) = strToLookFor +
value ;
393 m_strings.push_back( strToLookFor +
value );
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
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...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
CStringList()
Default constructor (empty string list)
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
The virtual base class which provides a unified interface for all persistent objects in MRPT...
void set(size_t index, const std::string &str)
Overwrites an existing position with a new value (0=first elements)
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.
#define THROW_EXCEPTION(msg)
bool BASE_IMPEXP fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
bool get_bool(const std::string &keyName)
Returns the value of the given key ("key=value").
float get_float(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 ' ' characters for newlines.
const Scalar * const_iterator
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
std::string get_string(const std::string &keyName)
Returns the value of the given key ("key=value").
std::string operator()(size_t index) const
Returns one string from the line list.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A class for storing a list of text lines.
void remove(size_t index)
Delete the element at a given position (0=first element)
This CStream derived class allow using a file as a write-only, binary stream.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void clear()
Clear the whole list.
void setText(const std::string &inText)
Fills the string list by parsing a single string with '', ' ', or ' ' characters indicatng newlines...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLsizei const GLchar ** string
size_t size() const
Returns the number of text lines in the list.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
int BASE_IMPEXP _strcmpi(const char *str1, const char *str2) MRPT_NO_THROWS
An OS-independent version of strcmpi.
double get_double(const std::string &keyName)
Returns the value of the given key ("key=value").
int get_int(const std::string &keyName)
Returns the value of the given key ("key=value").
GLsizei const GLfloat * value
void get(size_t index, std::string &outText) const
Returns one string from the line list.
void saveToFile(const std::string &fileName) const
Save the string list to a file.
int BASE_IMPEXP _strcmp(const char *str1, const char *str2) MRPT_NO_THROWS
An OS-independent version of strcmp.
unsigned __int32 uint32_t
void BASE_IMPEXP tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) MRPT_NO_THROWS
Tokenizes a string according to a set of delimiting characters.
void loadFromFile(const std::string &fileName)
Load the string list from a file.
void add(const std::string &str)
Appends a new string at the end of the string list.