CCAFFEINE
0.8.8
|
#include <StringVector.h>
Public Member Functions | |
CDELETE | StringVector (int initialCapacity) |
CDELETE | StringVector (int initialCapacity, int increment) |
void | add (char *str) |
void | addElement (char *str) |
int | capacity () |
CDELETE Object * | clone () |
boolean | contains (char *elem) |
char * | elementAt (int index) |
CDELETE StringEnumeration * | elements () |
void | ensureCapacity (int newCapacity) |
char * | firstElement () |
char * | get (int idx) |
int | indexOf (char *elem) |
int | indexOf (char *elem, int index) |
void | insertElementAt (char *str, int index) |
boolean | isEmpty () |
char * | lastElement () |
int | lastIndexOf (char *elem) |
int | lastIndexOf (char *elem, int index) |
CFREE char * | remove (int idx) |
void | removeAllElements () |
boolean | removeElement (char *str) |
void | removeElementAt (int index) |
void | setElementAt (char *str, int index) |
void | setSize (int newSize) |
int | size () |
char * | toString () |
void | trimToSize () |
void | doAll (StringIterated &) |
CFREE char ** | toArgv (int &argc) |
void | copyOut (char **array, int length) |
void | sort () |
Protected Attributes | |
int | capacityIncrement |
int | elementCount |
CFREE char ** | elementData |
int | elementData_length |
Private Member Functions | |
void | increaseCapacity () |
Static Private Attributes | |
static const int | DEFAULTCAP |
A vector class with interface similar to the Java vector, but this class is concrete, not an interface spec and not really expected to be subclassed.
CDELETE jcpp::StringVector::StringVector | ( | int | initialCapacity, |
int | increment | ||
) |
0 increment indicates doubling on reallocation
int jcpp::StringVector::indexOf | ( | char * | elem, |
int | index | ||
) |
elem must be in vector, not just have same value of some element, except in the case of strings.
CFREE char* jcpp::StringVector::remove | ( | int | idx | ) |
delete element at index specified and return that element. memory of returned element becomes callers responsibility.
the use of this function may not be too bright, as it does not call any destructors on the elements as they are removed.
boolean jcpp::StringVector::removeElement | ( | char * | str | ) |
the use of this function may not be too bright, as it does not call any destructors on the elements as they are removed.
void jcpp::StringVector::removeElementAt | ( | int | index | ) |
the use of this function may not be too bright, as it does not call any destructors on the elements as they are removed.
void jcpp::StringVector::setElementAt | ( | char * | str, |
int | index | ||
) |
the use of this function may not be too bright, as it does not call any destructors on the elements as they are overwritten.
void jcpp::StringVector::doAll | ( | StringIterated & | ) |
apply the StringIterated do() given to all elements of the the vector. The user is expected to know what they are doing.
CFREE char** jcpp::StringVector::toArgv | ( | int & | argc | ) |
Return an array of pointers to vector elements and set argc to the length of the array. If malloc fails, argc -> -1, return NULL. free the return value, not the data in its pointers. This is not a classical argv ala C in that it is not NULL-terminated.
void jcpp::StringVector::copyOut | ( | char ** | array, |
int | length | ||
) |
Copy char *s from vector into users array, which must be at least as long as the size of the vector. length is the space available in the array given. If array is bigger than vector, its remaining entries will be set to NULL.
void jcpp::StringVector::sort | ( | ) |
sort strings by strcmp + qsort.
int jcpp::StringVector::capacityIncrement [protected] |
expansion size
int jcpp::StringVector::elementCount [protected] |
number of actual entries
int jcpp::StringVector::elementData_length [protected] |
total capacity