Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Static Public Member Functions | Friends

StringList Class Reference
[Datastructures]

String list. More...

#include <OpenMS/DATASTRUCTURES/StringList.h>

Inheritance diagram for StringList:
TextFile CsvFile

List of all members.

Public Types

Type definitions

typedef iterator Iterator
 Mutable iterator.
typedef const_iterator ConstIterator
 Non-mutable iterator.
typedef reverse_iterator ReverseIterator
 Mutable reverse iterator.
typedef const_reverse_iterator ConstReverseIterator
 Non-mutable reverse iterator.

Public Member Functions

template<typename StringType >
StringListoperator<< (const StringType &string)
 Operator for appending entries with less code.
bool contains (const String &s) const
 Returns if a string is contained in the list.
void toUpper ()
 Transforms all contained strings to upper case.
void toLower ()
 Transforms all contained strings to lower case.
String concatenate (const String &glue="") const
 Concatenate the string elements and putting the glue string between elements.
Constructors and assignment operators

 StringList ()
 Default constructor.
 StringList (const StringList &rhs)
 Copy constructor.
 StringList (const std::vector< String > &rhs)
 Constructor from vector<String>
 StringList (const std::vector< std::string > &rhs)
 Constructor from vector<string>
 StringList (const QStringList &rhs)
 Constructor from QStringList.
StringListoperator= (const StringList &rhs)
 Assignment operator.
StringListoperator= (const std::vector< String > &rhs)
 Assignment operator from vector<String>
StringListoperator= (const std::vector< std::string > &rhs)
 Assignment operator vector<string>
Search methods

Iterator search (const Iterator &start, const String &text, bool trim=false)
 Searches for the first line that starts with text beginning at line start.
Iterator search (const String &text, bool trim=false)
 Searches for the first line that starts with text.
Iterator searchSuffix (const Iterator &start, const String &text, bool trim=false)
 Searches for the first line that ends with text beginning at line start.
Iterator searchSuffix (const String &text, bool trim=false)
 Searches for the first line that ends with text.
ConstIterator search (const ConstIterator &start, const String &text, bool trim=false) const
 Searches for the first line that starts with text beginning at line start.
ConstIterator search (const String &text, bool trim=false) const
 Searches for the first line that starts with text.
ConstIterator searchSuffix (const ConstIterator &start, const String &text, bool trim=false) const
 Searches for the first line that ends with text beginning at line start.
ConstIterator searchSuffix (const String &text, bool trim=false) const
 Searches for the first line that ends with text.

Static Public Member Functions

static StringList create (const String &list, const char splitter= ',')
 Returns a list that is created by splitting the given (comma-separated) string (String are not trimmed!).
static StringList create (const char *const *list, UInt size)
 Returns a list that is created from an array of char*.

Friends

std::ostream & operator<< (std::ostream &os, const StringList &p)
 output stream operator

Detailed Description

String list.

This class is based on std::vector<String> but adds some methods for convenience.


Member Typedef Documentation

typedef const_iterator ConstIterator

Non-mutable iterator.

typedef const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.

typedef iterator Iterator

Mutable iterator.

typedef reverse_iterator ReverseIterator

Mutable reverse iterator.


Constructor & Destructor Documentation

StringList (  ) 

Default constructor.

StringList ( const StringList rhs  ) 

Copy constructor.

StringList ( const std::vector< String > &  rhs  ) 

Constructor from vector<String>

StringList ( const std::vector< std::string > &  rhs  ) 

Constructor from vector<string>

StringList ( const QStringList &  rhs  ) 

Constructor from QStringList.


Member Function Documentation

String concatenate ( const String glue = ""  )  const

Concatenate the string elements and putting the glue string between elements.

Referenced by RNPxlReportRowHeader::getString(), and RNPxlReportRow::getString().

bool contains ( const String s  )  const

Returns if a string is contained in the list.

Referenced by HasActivationMethod< SpectrumType >::operator()().

static StringList create ( const char *const *  list,
UInt  size 
) [static]

Returns a list that is created from an array of char*.

StringList& operator<< ( const StringType &  string  )  [inline]

Operator for appending entries with less code.

StringList& operator= ( const std::vector< String > &  rhs  ) 

Assignment operator from vector<String>

StringList& operator= ( const StringList rhs  ) 

Assignment operator.

StringList& operator= ( const std::vector< std::string > &  rhs  ) 

Assignment operator vector<string>

ConstIterator search ( const String text,
bool  trim = false 
) const

Searches for the first line that starts with text.

This is an overloaded member function, provided for convenience.
It behaves essentially like the above function but the search is start at the beginning of the file

ConstIterator search ( const ConstIterator start,
const String text,
bool  trim = false 
) const

Searches for the first line that starts with text beginning at line start.

Parameters:
start the line to start the search in
text the text to find
trim whether the line is trimmed before
Returns:
returns an iterator to the matching line. If no line matches, end() is returned
Iterator search ( const Iterator start,
const String text,
bool  trim = false 
)

Searches for the first line that starts with text beginning at line start.

Parameters:
start the line to start the search in
text the text to find
trim whether the line is trimmed before
Returns:
returns an iterator to the matching line. If no line matches, end() is returned
Iterator search ( const String text,
bool  trim = false 
)

Searches for the first line that starts with text.

This is an overloaded member function, provided for convenience.
It behaves essentially like the above function but the search is start at the beginning of the file

Iterator searchSuffix ( const String text,
bool  trim = false 
)

Searches for the first line that ends with text.

This is an overloaded member function, provided for convenience.

It behaves essentially like searchSuffix(const Iterator&, const String&, bool) but the search starts at the beginning of the file

ConstIterator searchSuffix ( const ConstIterator start,
const String text,
bool  trim = false 
) const

Searches for the first line that ends with text beginning at line start.

Parameters:
start the line to start the search in
text the text to find
trim whether the line is trimmed before
Returns:
returns an iterator to the matching line. If no line matches, end() is returned
ConstIterator searchSuffix ( const String text,
bool  trim = false 
) const

Searches for the first line that ends with text.

This is an overloaded member function, provided for convenience.

It behaves essentially like searchSuffix(const Iterator&, const String&, bool) but the search starts at the beginning of the file

Iterator searchSuffix ( const Iterator start,
const String text,
bool  trim = false 
)

Searches for the first line that ends with text beginning at line start.

Parameters:
start the line to start the search in
text the text to find
trim whether the line is trimmed before
Returns:
returns an iterator to the matching line. If no line matches, end() is returned
void toLower (  ) 

Transforms all contained strings to lower case.

void toUpper (  ) 

Transforms all contained strings to upper case.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const StringList p 
) [friend]

output stream operator


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1