sptk2 logo
SPTK Home Page

sptk::CStrings Class Reference
[Utility Classes]

List of strings with ids. More...

#include <CStrings.h>

List of all members.

Public Member Functions

 CStrings ()
 Default constructor.
 CStrings (const CStrings &src)
 Copy constructor.
 CStrings (const std::string &src, const char *separator)
 Constructor from a string with elements separated by a delimiter string.
 CStrings (const char *src, const char *separator)
 Constructor from a string with elements separated by a delimiter string.
void fromString (const std::string &src, const char *separator)
 Assigns strings from a string with elements separated by a delimiter string.
std::string asString (const char *separator) const
 Makes string from own strings separated by a delimiter string.
int indexOf (std::string s) const
 Returns an index of the string in strings, or -1 if not found.
void saveToFile (std::string fileName) const throw (CException)
 Saves strings to file. String ids are discarded.
void loadFromFile (std::string fileName) throw (CException)
 Loads strings from file. String ids are not loaded.
int32_t argument () const
 Returns user data as integer.
void argument (int32_t d)
 Sets user data as integer.
void remove (uint32_t i)
 Removes a string from vector.


Detailed Description

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.


Constructor & Destructor Documentation

sptk::CStrings::CStrings ( const std::string &  src,
const char *  separator 
) [inline]

Constructor from a string with elements separated by a delimiter string.

Parameters:
src const std::string&, a source string
separator const char *, a separator string

sptk::CStrings::CStrings ( const char *  src,
const char *  separator 
) [inline]

Constructor from a string with elements separated by a delimiter string.

Parameters:
src const char *, a source string
separator const char *, a separator string


Member Function Documentation

void sptk::CStrings::argument ( int32_t  d  )  [inline]

Sets user data as integer.

Parameters:
d int, new value for user data

std::string sptk::CStrings::asString ( const char *  separator  )  const

Makes string from own strings separated by a delimiter string.

Parameters:
separator const char *, a separator string

Referenced by sptk::CDirectoryDS::pattern().

void sptk::CStrings::fromString ( const std::string &  src,
const char *  separator 
) [inline]

Assigns strings from a string with elements separated by a delimiter string.

Parameters:
src const std::string&, a source string
separator const char *, a separator string

Referenced by sptk::CDirectoryDS::pattern().

int sptk::CStrings::indexOf ( std::string  s  )  const

Returns an index of the string in strings, or -1 if not found.

Parameters:
s std::string, a string to find
Returns:
a string index, or -1

void sptk::CStrings::loadFromFile ( std::string  fileName  )  throw (CException)

Loads strings from file. String ids are not loaded.

Parameters:
fileName std::string, the name of the file

void sptk::CStrings::remove ( uint32_t  i  )  [inline]

Removes a string from vector.

Parameters:
i uint32_t, string index in the vector

void sptk::CStrings::saveToFile ( std::string  fileName  )  const throw (CException)

Saves strings to file. String ids are discarded.

Parameters:
fileName std::string, the name of the file


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:07 2012: SPTK 3.5.7