Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
StringList Class Reference

String list. More...

#include <OpenMS/DATASTRUCTURES/StringList.h>

Inheritance diagram for StringList:
TextFile CsvFile

Public Types

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

Public Member Functions

template<typename StringType >
StringListoperator<< (const StringType &string)
 Operator for appending entries with less code. More...
 
bool contains (const String &s) const
 Returns if a string is contained in the list. More...
 
void toUpper ()
 Transforms all contained strings to upper case. More...
 
void toLower ()
 Transforms all contained strings to lower case. More...
 
String concatenate (const String &glue="") const
 Concatenate the string elements and putting the glue string between elements. More...
 
Constructors and assignment operators
 StringList ()
 Default constructor. More...
 
 StringList (const StringList &rhs)
 Copy constructor. More...
 
 StringList (const std::vector< String > &rhs)
 Constructor from vector<String> More...
 
 StringList (const std::vector< std::string > &rhs)
 Constructor from vector<string> More...
 
 StringList (const QStringList &rhs)
 Constructor from QStringList. More...
 
StringListoperator= (const StringList &rhs)
 Assignment operator. More...
 
StringListoperator= (const std::vector< String > &rhs)
 Assignment operator from vector<String> More...
 
StringListoperator= (const std::vector< std::string > &rhs)
 Assignment operator vector<string> More...
 
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. More...
 
Iterator search (const String &text, bool trim=false)
 Searches for the first line that starts with text. More...
 
Iterator searchSuffix (const Iterator &start, const String &text, bool trim=false)
 Searches for the first line that ends with text beginning at line start. More...
 
Iterator searchSuffix (const String &text, bool trim=false)
 Searches for the first line that ends with text. More...
 
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. More...
 
ConstIterator search (const String &text, bool trim=false) const
 Searches for the first line that starts with text. More...
 
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. More...
 
ConstIterator searchSuffix (const String &text, bool trim=false) const
 Searches for the first line that ends with text. More...
 

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!) More...
 
static StringList create (const char *const *list, UInt size)
 Returns a list that is created from an array of char*. More...
 

Friends

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

Additional Inherited Members

- Public Attributes inherited from vector< T >
elements
 STL member. More...
 

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

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 RNPxlReportRow::getString(), and RNPxlReportRowHeader::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 String list,
const char  splitter = ',' 
)
static
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 StringList rhs)

Assignment operator.

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

Assignment operator from vector<String>

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

Assignment operator vector<string>

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
startthe line to start the search in
textthe text to find
trimwhether 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

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
startthe line to start the search in
textthe text to find
trimwhether the line is trimmed before
Returns
returns an iterator to the matching line. If no line matches, end() is returned
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

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
startthe line to start the search in
textthe text to find
trimwhether the line is trimmed before
Returns
returns an iterator to the matching line. If no line matches, end() is returned
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
startthe line to start the search in
textthe text to find
trimwhether 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

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.11.1 Documentation generated on Thu Nov 14 2013 11:19:29 using doxygen 1.8.5