Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CharPtrArray Class Referenceabstract

#include <arb_strarray.h>

Inheritance diagram for CharPtrArray:
Inheritance graph
Collaboration diagram for CharPtrArray:
Collaboration graph

Public Member Functions

void reserve (size_t forElems)
void optimize_space ()
size_t size () const
bool empty () const
const charoperator[] (int i) const
void swap (int i1, int i2)
void move (int from, int to)
void remove (int i)
void safe_remove (int i)
void resize (int newsize)
void clear ()
void sort (CharPtrArray_compare_fun compare, void *client_data)
void uniq (CharPtrArray_compare_fun compare, void *client_data)
void sort_and_uniq (CharPtrArray_compare_fun compare, void *client_data)
int index_of (const char *search_for) const

Protected Member Functions

bool ok () const
bool elem_index (int i) const
bool allocated_index (int i) const
void set_space (size_t new_allocated)
void reserve_space (size_t forElems, bool alloc_ahead)
 CharPtrArray ()
virtual ~CharPtrArray ()
virtual void free_elem (int i)=0
void erase_elems ()

Protected Attributes

char ** str
size_t elems

Detailed Description

Definition at line 31 of file arb_strarray.h.

Constructor & Destructor Documentation

CharPtrArray::CharPtrArray ( )

Definition at line 67 of file arb_strarray.h.

virtual CharPtrArray::~CharPtrArray ( )

Definition at line 68 of file arb_strarray.h.

Member Function Documentation

bool CharPtrArray::ok ( ) const
bool CharPtrArray::elem_index ( int  i) const

Definition at line 45 of file arb_strarray.h.

References elems.

Referenced by remove(), FINAL_TYPE< SEQTYPE >::replace(), ConstStrArray::replace(), safe_remove(), and swap().

bool CharPtrArray::allocated_index ( int  i) const

Definition at line 46 of file arb_strarray.h.

Referenced by FINAL_TYPE< SEQTYPE >::put(), and ConstStrArray::put().

void CharPtrArray::set_space ( size_t  new_allocated)

Definition at line 48 of file arb_strarray.h.

References arb_assert, ARB_calloc(), ARB_recalloc(), and ok().

Referenced by optimize_space(), and reserve_space().

void CharPtrArray::reserve_space ( size_t  forElems,
bool  alloc_ahead 

Definition at line 60 of file arb_strarray.h.

References set_space().

Referenced by FINAL_TYPE< SEQTYPE >::put(), ConstStrArray::put(), and reserve().

virtual void CharPtrArray::free_elem ( int  i)
protectedpure virtual

Referenced by erase_elems(), and remove().

void CharPtrArray::erase_elems ( )

Definition at line 72 of file arb_strarray.h.

References arb_assert, elems, empty(), free_elem(), and ok().

Referenced by FINAL_TYPE< SEQTYPE >::erase(), and ConstStrArray::erase().

void CharPtrArray::reserve ( size_t  forElems)

Definition at line 82 of file arb_strarray.h.

References reserve_space().

Referenced by GBT_get_configuration_names(), GBT_get_tree_names(), and GEN_read_position().

void CharPtrArray::optimize_space ( )

Definition at line 83 of file arb_strarray.h.

References set_space().

size_t CharPtrArray::size ( ) const
bool CharPtrArray::empty ( ) const
const char* CharPtrArray::operator[] ( int  i) const

Definition at line 88 of file arb_strarray.h.

References arb_assert, NULp, and ok().

void CharPtrArray::swap ( int  i1,
int  i2 

Definition at line 94 of file arb_strarray.h.

References arb_assert, elem_index(), ok(), and swap().

Referenced by move().

void CharPtrArray::move ( int  from,
int  to 

moves an array-entry from 'oidx' to 'nidx' (entries between get shifted by one) -1 means "last entry" if 'nidx' is out of bounds, it'll be moved to start of array

Definition at line 134 of file arb_strarray.cxx.

References arb_assert, size(), and swap().

Referenced by add_selected_cb(), lower_reference_cb(), move_field_cb(), FINAL_TYPE< SEQTYPE >::put_before(), ConstStrArray::put_before(), and raise_reference_cb().

void CharPtrArray::remove ( int  i)
void CharPtrArray::safe_remove ( int  i)

like remove, but does NOOP if index out of bounds

Definition at line 114 of file arb_strarray.h.

References elem_index().

Referenced by clear_comment_cb(), and del_reference_cb().

void CharPtrArray::resize ( int  newsize)

Definition at line 119 of file arb_strarray.h.

References size().

Referenced by clear().

void CharPtrArray::clear ( )

Definition at line 125 of file arb_strarray.h.

References resize().

Referenced by AW_getColorRangeNames(), and clear_comment_cb().

void CharPtrArray::sort ( CharPtrArray_compare_fun  compare,
void *  client_data 

sort the array

See also
sort_and_uniq for parameters

Definition at line 18 of file arb_strarray.cxx.

References GB_sort(), and size().

Referenced by sort_and_uniq().

void CharPtrArray::uniq ( CharPtrArray_compare_fun  compare,
void *  client_data 

remove consecutive equal elements

See also
sort_and_uniq for parameters

Definition at line 25 of file arb_strarray.cxx.

References size().

Referenced by sort_and_uniq().

void CharPtrArray::sort_and_uniq ( CharPtrArray_compare_fun  compare,
void *  client_data 

sort the array and remove all duplicates

comparefunction defining order on elements (
See also
e.g. GB_string_comparator)
client_datauser parameter forwarded to compare

Definition at line 129 of file arb_strarray.h.

References sort(), and uniq().

Referenced by get_SAI_groups().

int CharPtrArray::index_of ( const char search_for) const

Member Data Documentation

char** CharPtrArray::str

Definition at line 35 of file arb_strarray.h.

size_t CharPtrArray::elems

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