OpenMS
Loading...
Searching...
No Matches
StringListUtils Class Reference

Utilities operating on lists of Strings. More...

#include <OpenMS/DATASTRUCTURES/StringListUtils.h>

Type definitions

typedef std::vector< String >::iterator Iterator
 Mutable iterator.
 
typedef std::vector< String >::const_iterator ConstIterator
 Non-mutable iterator.
 
typedef std::vector< String >::reverse_iterator ReverseIterator
 Mutable reverse iterator.
 
typedef std::vector< String >::const_reverse_iterator ConstReverseIterator
 Non-mutable reverse iterator.
 
static StringList fromQStringList (const QStringList &rhs)
 Creates a StringList from a QStringList.
 

Search methods

static Iterator searchPrefix (const Iterator &start, const Iterator &end, const String &text, bool trim=false)
 Searches for the first line that starts with text beginning at line start.
 
static ConstIterator searchPrefix (const ConstIterator &start, const ConstIterator &end, const String &text, bool trim=false)
 Searches for the first line that starts with text beginning at line start.
 
static ConstIterator searchPrefix (const StringList &container, const String &text, bool trim=false)
 Searches for the first line that starts with text in the StringList container.
 
static Iterator searchPrefix (StringList &container, const String &text, bool trim=false)
 Searches for the first line that starts with text in the StringList container.
 
static Iterator searchSuffix (const Iterator &start, const Iterator &end, const String &text, bool trim=false)
 Searches for the first line that ends with text beginning at line start.
 
static ConstIterator searchSuffix (const ConstIterator &start, const ConstIterator &end, const String &text, bool trim=false)
 Searches for the first line that ends with text beginning at line start.
 
static ConstIterator searchSuffix (const StringList &container, const String &text, bool trim=false)
 Searches for the first line that ends with text in the StringList container.
 
static Iterator searchSuffix (StringList &container, const String &text, bool trim=false)
 Searches for the first line that ends with text in the StringList container.
 
static void toUpper (StringList &sl)
 Transforms all strings contained in the passed StringList to upper case.
 
static void toLower (StringList &sl)
 Transforms all strings contained in the passed StringList to lower case.
 
INTERNAL StringListUtils ()
 hide c'tors to avoid instantiation of utils class
 
 StringListUtils (const StringListUtils &)
 
StringListUtilsoperator= (StringListUtils &)
 

Detailed Description

Utilities operating on lists of Strings.

Member Typedef Documentation

◆ ConstIterator

typedef std::vector<String>::const_iterator ConstIterator

Non-mutable iterator.

◆ ConstReverseIterator

typedef std::vector<String>::const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.

◆ Iterator

typedef std::vector<String>::iterator Iterator

Mutable iterator.

◆ ReverseIterator

typedef std::vector<String>::reverse_iterator ReverseIterator

Mutable reverse iterator.

Constructor & Destructor Documentation

◆ StringListUtils() [1/2]

INTERNAL StringListUtils ( )
inlineprivate

hide c'tors to avoid instantiation of utils class

◆ StringListUtils() [2/2]

StringListUtils ( const StringListUtils )
inlineprivate

Member Function Documentation

◆ fromQStringList()

static StringList fromQStringList ( const QStringList &  rhs)
static

Creates a StringList from a QStringList.

◆ operator=()

StringListUtils & operator= ( StringListUtils )
inlineprivate

◆ searchPrefix() [1/4]

static ConstIterator searchPrefix ( const ConstIterator start,
const ConstIterator end,
const String text,
bool  trim = false 
)
static

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

Parameters
[in]startIterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
[in]endIterator pointing to the end final position of the sequence to search.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchPrefix() [2/4]

static Iterator searchPrefix ( const Iterator start,
const Iterator end,
const String text,
bool  trim = false 
)
static

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

Parameters
[in]startIterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
[in]endIterator pointing to the end final position of the sequence to search.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchPrefix() [3/4]

static ConstIterator searchPrefix ( const StringList container,
const String text,
bool  trim = false 
)
static

Searches for the first line that starts with text in the StringList container.

Parameters
[in]containerThe StringList that should be searched.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchPrefix() [4/4]

static Iterator searchPrefix ( StringList container,
const String text,
bool  trim = false 
)
static

Searches for the first line that starts with text in the StringList container.

Parameters
[in]containerThe StringList that should be searched.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchSuffix() [1/4]

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

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

Parameters
[in]startIterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
[in]endIterator pointing to the end final position of the sequence to search.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchSuffix() [2/4]

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

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

Parameters
[in]startIterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
[in]endIterator pointing to the end final position of the sequence to search.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchSuffix() [3/4]

static ConstIterator searchSuffix ( const StringList container,
const String text,
bool  trim = false 
)
static

Searches for the first line that ends with text in the StringList container.

Parameters
[in]containerThe StringList that should be searched.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ searchSuffix() [4/4]

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

Searches for the first line that ends with text in the StringList container.

Parameters
[in]containerThe StringList that should be searched.
[in]textThe text to find
[in]trimWhether the line is trimmed before
Returns
Returns an iterator to the matching entry. If no line matches end is returned.

◆ toLower()

static void toLower ( StringList sl)
static

Transforms all strings contained in the passed StringList to lower case.

Parameters
[in]slThe StringList to convert to lower case.

◆ toUpper()

static void toUpper ( StringList sl)
static

Transforms all strings contained in the passed StringList to upper case.

Parameters
[in]slThe StringList to convert to upper case.