ARB
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
[legend]
Collaboration diagram for CharPtrArray:
Collaboration graph
[legend]

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 ( )
inlineprotected

Definition at line 67 of file arb_strarray.h.

virtual CharPtrArray::~CharPtrArray ( )
inlineprotectedvirtual

Definition at line 68 of file arb_strarray.h.

Member Function Documentation

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

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
inlineprotected

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)
inlineprotected

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 
)
inlineprotected

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 ( )
inlineprotected

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)
inline

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 ( )
inline

Definition at line 83 of file arb_strarray.h.

References set_space().

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

Definition at line 88 of file arb_strarray.h.

References arb_assert, NULp, and ok().

void CharPtrArray::swap ( int  i1,
int  i2 
)
inline

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)
inline
void CharPtrArray::safe_remove ( int  i)
inline

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)
inline

Definition at line 119 of file arb_strarray.h.

References size().

Referenced by clear().

void CharPtrArray::clear ( )
inline

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 
)
inline

sort the array and remove all duplicates

Parameters
comparefunction defining order on elements (
See also
e.g. GB_string_comparator)
Parameters
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
protected

Definition at line 35 of file arb_strarray.h.

size_t CharPtrArray::elems
protected

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