Relacs  0.9.8
Public Member Functions | Static Public Attributes | Friends | List of all members
StrQueue Class Reference

#include <strqueue.h>

Inheritance diagram for StrQueue:
Inheritance graph
[legend]
Collaboration diagram for StrQueue:
Collaboration graph
[legend]

Public Member Functions

 StrQueue (void)
 
 StrQueue (const StrQueue &sq)
 
 StrQueue (const Str &s, const string &separator)
 
 StrQueue (const Str &s, const string &separator, const string &brackets)
 
 ~StrQueue (void)
 
StrQueueoperator= (const StrQueue &sq)
 
StrQueueoperator= (const string &s)
 
StrQueueassign (const string &s)
 
StrQueueassign (const Str &s, const string &separator)
 
StrQueueassign (const Str &s, const string &separator, const string &brackets)
 
StrQueueappend (const Str &s, const string &separator)
 
StrQueueappend (const Str &s, const string &separator, const string &brackets)
 
StrQueuecopy (string &s, const string &separator)
 
int size (void) const
 
bool empty (void) const
 
void resize (int n, const Str &s=Str())
 
void clear (void)
 
Stroperator[] (int index)
 
const Stroperator[] (int index) const
 
int find (const string &strg, int index=0) const
 
void add (const string &s)
 
void add (const StrQueue &sq)
 
void insert (const string &s)
 
void insert (const StrQueue &sq)
 
iterator erase (iterator pos)
 
void erase (int index)
 
iterator erase (iterator first, iterator last)
 
iterator erase (int from, int to)
 
void reverse (void)
 
void sort (void)
 
StrQueuestrip (void)
 
StrQueuestripComments (const string &comment=Str::comment())
 
StrQueue strippedComments (const string &comment=Str::comment()) const
 
string save (const string &separator=" ") const
 
istream & load (istream &str, const string &stop="", string *line=0)
 
ostream & save (ostream &str, const string &start="") const
 

Static Public Attributes

static string StopEmpty = "EMPTY"
 

Friends

bool operator== (const StrQueue &sq1, const StrQueue &sq2)
 
ostream & operator<< (ostream &str, const StrQueue &sq)
 

Detailed Description

A list of strings.

Author
Jan Benda
Version
1.0

Constructor & Destructor Documentation

StrQueue ( void  )
inline

Constructs an empty list of strings.

Referenced by StrQueue::strippedComments().

StrQueue ( const StrQueue sq)
inline

Copy constructor.

StrQueue ( const Str s,
const string &  separator 
)

Assign the fields of s separated by separator to the StrQueue.

References StrQueue::assign().

StrQueue ( const Str s,
const string &  separator,
const string &  brackets 
)

Assign the fields of s separated by separator to the StrQueue while respecting brackets.

References StrQueue::assign().

~StrQueue ( void  )
inline

Deconstructs a StrQueue.

Member Function Documentation

StrQueue& operator= ( const StrQueue sq)
inline

Assigns sq to the list.

StrQueue& operator= ( const string &  s)
inline

Create a list with the single element s.

StrQueue & assign ( const string &  s)
StrQueue & assign ( const Str s,
const string &  separator 
)

Assign the fields of s separated by separator to the StrQueue.

References StrQueue::append(), and StrQueue::clear().

StrQueue & assign ( const Str s,
const string &  separator,
const string &  brackets 
)

Assign the fields of s separated by separator to the StrQueue while respecting brackets.

References StrQueue::append(), and StrQueue::clear().

StrQueue & append ( const Str s,
const string &  separator 
)

Append the fields of s separated by separator to the StrQueue.

References StrQueue::add(), Str::mid(), and Str::nextField().

Referenced by StrQueue::assign(), and RELACSWidget::RELACSWidget().

StrQueue & append ( const Str s,
const string &  separator,
const string &  brackets 
)

Append the fields of s separated by separator to the StrQueue while respecting brackets.

References StrQueue::add(), Str::findSeparator(), and Str::mid().

StrQueue & copy ( string &  s,
const string &  separator 
)

Write the elements of the StrQueue into s separated by separator.

int size ( void  ) const
inline
bool empty ( void  ) const
inline
void resize ( int  n,
const Str s = Str() 
)
inline

Inserts or erases elements s at the end such that the size becomes n.

Referenced by Parameter::assign(), Parameter::clear(), and Parameter::setNumbers().

void clear ( void  )
inline
Str& operator[] ( int  index)
inline

Returns the string at index index.

const Str& operator[] ( int  index) const
inline

Returns the string at index index.

int find ( const string &  strg,
int  index = 0 
) const

Return the index of the string that matches strg. If there is no matching strg -1 is returned. Searching is started at the index-th element.

References StrQueue::empty(), and StrQueue::size().

Referenced by Parameter::assign(), Options::find(), Parameter::index(), and Parameter::selectText().

void add ( const string &  s)
inline
void add ( const StrQueue sq)

Add StrQueue sq to the list.

void insert ( const string &  s)
inline

Insert string s at the beginning of the list.

Referenced by Parameter::selectText().

void insert ( const StrQueue sq)

Insert StrQueue sq at the beginning of the list.

StrQueue::iterator erase ( iterator  pos)
void erase ( int  index)

Erases the string at index index.

StrQueue::iterator erase ( iterator  first,
iterator  last 
)

Erases all strings within the range first to last exclusively.

StrQueue::iterator erase ( int  from,
int  to 
)

Erases all strings within the range from to to exclusively.

References StrQueue::size().

void reverse ( void  )

Reverses the order of strings in the list.

void sort ( void  )

Sort the strings in the list.

StrQueue & strip ( void  )
StrQueue & stripComments ( const string &  comment = Str::comment())

Removes comments from each string. If comment is set to 'XXX' everything behind 'XXX' inclusively is erased from each string. If comment is set to '-XXX' everything before 'XXX' inclusively is erased from each string.

Referenced by OutData::load().

StrQueue strippedComments ( const string &  comment = Str::comment()) const

Returns the StrQueue with comments removed. If comment is set to 'XXX' everything behind 'XXX' inclusively is erased from each string. If comment is set to '-XXX' everything before 'XXX' inclusively is erased from each string.

References StrQueue::add(), and StrQueue::StrQueue().

string save ( const string &  separator = " ") const

Referenced by relacs::operator<<().

istream & load ( istream &  str,
const string &  stop = "",
string *  line = 0 
)

Read from stream str until end of file or a line beginning with stop is reached. If stop equals the StopEmpty string, reading is stopped at an empty line. Each line is appended to the list. If line does not equal zero then the last read line is returned in line.

References StrQueue::add(), and StrQueue::StopEmpty.

Referenced by ConfigureClasses::read().

ostream & save ( ostream &  str,
const string &  start = "" 
) const

Friends And Related Function Documentation

bool operator== ( const StrQueue sq1,
const StrQueue sq2 
)
friend

Compare two StrQueue. Returns true if they contain the same number of strings and all of the strings are equal.

ostream& operator<< ( ostream &  str,
const StrQueue sq 
)
friend

Write the whole StrQueue into stream str.

Member Data Documentation

string StopEmpty = "EMPTY"
static

Stop-string for load() to stop reading at an empty line.

Referenced by StrQueue::load(), Options::load(), and Options::read().


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