string_list_ty Class Reference
[String_List]

#include <str_list.h>


Public Member Functions

 ~string_list_ty ()
 string_list_ty ()
 string_list_ty (const string_list_ty &)
string_list_tyoperator= (const string_list_ty &)
bool member (string_ty *arg) const
bool member_nocase (string_ty *arg) const
size_t size () const
bool empty () const
string_tyoperator[] (size_t n) const
string_tyunsplit (size_t start, size_t finish, const char *sep) const
string_tyunsplit (const char *sep=0) const
void push_front (string_ty *arg)
void push_front (const string_list_ty &arg)
void push_back (string_ty *arg)
void push_back_unique (string_ty *arg)
void push_back (const string_list_ty &arg)
void push_back_unique (const string_list_ty &arg)
void split (string_ty *arg, const char *sep=0, bool white=false)
void remove (string_ty *arg)
void remove (const string_list_ty &arg)
void clear ()
string_tyfront ()
string_tyback ()
void pop_front ()
void pop_back ()
bool equal (const string_list_ty &arg) const
bool subset (const string_list_ty &arg) const
void sort ()
void sort_nocase ()
void sort_version ()
string_list_ty quote_shell () const
bool validate () const
string_list_ty intersection (const string_list_ty &rhs) const

Data Fields

size_t nstrings
size_t nstrings_max
string_ty ** string


Detailed Description

The string_list_ty type is used to represent a list of string (string_ty *) values.

Definition at line 35 of file str_list.h.


Constructor & Destructor Documentation

string_list_ty::~string_list_ty (  ) 

The destructor.

string_list_ty::string_list_ty (  ) 

The default constructor. This list will be initialised as being empty.

string_list_ty::string_list_ty ( const string_list_ty  ) 

The copy constructor.


Member Function Documentation

string_list_ty& string_list_ty::operator= ( const string_list_ty  ) 

The assignment operator.

bool string_list_ty::member ( string_ty arg  )  const

The member method is used to test whether a given string value is a member of the string list.

Parameters:
arg The string value to search for.
Returns:
bool: true if the string is present, false if it is not.

bool string_list_ty::member_nocase ( string_ty arg  )  const

The member_nocase method is used to test whether a given string value is a member of the string list. The conparison is performed in a case-INsensitive way.

Parameters:
arg The string value to search for.
Returns:
bool: true if the string is present, false if it is not.

size_t string_list_ty::size (  )  const [inline]

The size method is used to obtain the number of string in the list.

Definition at line 86 of file str_list.h.

bool string_list_ty::empty (  )  const [inline]

The empty method i used to determine if the list is empty (contains no strings) or not.

Returns:
bool: true if the list contains no strings, false if the list contains one or more strings.

Definition at line 96 of file str_list.h.

string_ty* string_list_ty::operator[] ( size_t  n  )  const [inline]

The [] operator may be used to extract a list member. It may only be used as an r-value.

Definition at line 102 of file str_list.h.

string_ty* string_list_ty::unsplit ( size_t  start,
size_t  finish,
const char *  sep 
) const

The unsplit method is used to form a string from a word list.

Parameters:
start The first string in the list to start from.
finish One past the last string in the list be be used.
sep The seapator string between words. If yoy give NULL, it will use a single space.
Returns:
A pointer to the newly formed string in dynamic memory.
Note:
It is the responsibility of the caller to ensure that the new string is freed when finished with, by a call to str_free().

string_ty* string_list_ty::unsplit ( const char *  sep = 0  )  const

The unsplit method is used to form a string from a word list.

Parameters:
sep The seapator string between words. If yoy give NULL, it will use a single space.
Returns:
A pointer to the newly formed string in dynamic memory.
Note:
It is the responsibility of the caller to ensure that the new string is freed when finished with, by a call to str_free().

void string_list_ty::push_front ( string_ty arg  ) 

The push_front method is used to prepend a string to the list.

Parameters:
arg The string to be appended.
Note:
This is not terribly efficient, try not to use it too often, because it has to shuffle all of the string contents up by one.

void string_list_ty::push_front ( const string_list_ty arg  ) 

The push_front method is used to prepend a string to the list.

Parameters:
arg The list of string to be appended.
Note:
This is not terribly efficient, try not to use it too often, because it has to shuffle all of the string contents up first.

void string_list_ty::push_back ( string_ty arg  ) 

The push_back method is used to append a string to the list. This has O(1) insert times.

Parameters:
arg The string to be appended.

void string_list_ty::push_back_unique ( string_ty arg  ) 

The push_back method is used to append a string to the list, but only if it isn't already in the list. This has O(n) insert times.

Parameters:
arg The string to be appended.

void string_list_ty::push_back ( const string_list_ty arg  ) 

The push_back method is used to append all the strings string in one list to the end of this list. This has O(1) insert times.

Parameters:
arg The strings to be appended.

void string_list_ty::push_back_unique ( const string_list_ty arg  ) 

The push_back method is used to append all the strings string in one list to the end of this list. This has O(n*m) insert times.

Parameters:
arg The strings to be appended.

void string_list_ty::split ( string_ty arg,
const char *  sep = 0,
bool  white = false 
)

The split method is used to convert a string to a word list. The string list is cleared()ed before the string is split into it.

Parameters:
arg The string to be split into pieces.
sep Separator characters; sequences of noe or more of these characters seaprate each part. Defaults to " " if NULL is given.
white if true, supress extra white space around separators
Note:
Quoting is not understood.

void string_list_ty::remove ( string_ty arg  ) 

The remove method is used to remove a string. It is not an error if the string is not present. This has O(n) behaviour.

Parameters:
arg The string value to be removed.

void string_list_ty::remove ( const string_list_ty arg  ) 

The remove method is used to remove a set of string. It is not an error if one or more of the strings are not present. This has O(n*m) behaviour.

Parameters:
arg The string values to be removed.

void string_list_ty::clear (  ) 

The clear method is used to remove all list elements. This has O(n) behaviour. Afterwards, the list is once again empty.

string_ty* string_list_ty::front (  )  [inline]

The front method is used to obtain the first string value in the list.

Definition at line 245 of file str_list.h.

string_ty* string_list_ty::back (  )  [inline]

The back method is used to obtain the last string value in the list.

Definition at line 251 of file str_list.h.

void string_list_ty::pop_front (  ) 

The pop_front method is used to discard the first value in the list. This has O(n) behaviour.

void string_list_ty::pop_back (  ) 

The pop_back method is used to discard the last value in the list. This has O(1) behaviour.

bool string_list_ty::equal ( const string_list_ty arg  )  const

The equal method is used to determine if this string list is equal to another string list. Two lists are considered equal if they both contains the same strings, regardless of order.

Returns:
bool: true if equal, false if not

bool string_list_ty::subset ( const string_list_ty arg  )  const

The subset method is used to determine if this string list is a subset of another string list, regardless of order.

Parameters:
arg strings list to test against, i.e. that is (*this is-a-subset-of arg).
Returns:
bool: true if subset, false if not
Note:
By subset, this also includes improper subsets (equality).

void string_list_ty::sort (  ) 

The sort method is used to perform an in situ sort the string list values in a string list. The comparison function used is strcmp.

void string_list_ty::sort_nocase (  ) 

The sort method is used to perform an in situ sort the string list values in a string list. The comparison function used is strcasecmp.

void string_list_ty::sort_version (  ) 

The sort method is used to perform an in situ sort the string list values in a string list. The comparison function used is strverscmp.

string_list_ty string_list_ty::quote_shell (  )  const

The quote_shell method is used to produce a new string list by quoting the strings of this string list.

bool string_list_ty::validate (  )  const

The validate method is used to validate a string list. Usually used for debugging, usually with assert.

Returns:
bool: true if the string list is valis, false if not.

string_list_ty string_list_ty::intersection ( const string_list_ty rhs  )  const

The intersection method is used to calculate the set intersection between this set of strings and the rhs set of strings.


Field Documentation

Definition at line 334 of file str_list.h.

Definition at line 335 of file str_list.h.

Definition at line 336 of file str_list.h.


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

Generated on Wed Mar 12 23:37:44 2008 for Aegis by  doxygen 1.5.5