Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Strings Class Reference
[Miscellaneous Library Utilities]

#include <Strings.hh>

List of all members.


Detailed Description

Utility class to implement an arbitrary size array of strings.

The Strings class implements an arbitrary size array of strings. It is not very efficient as it internally allocates memory for array storage, but it is convenient for passing arrays of strings to and from functions.


Public Member Functions

 Strings (int in_count, const char *n=NULL)
 Strings (char **in_array, int size, const char *n=NULL)
 Strings (const char *n=NULL)
 Strings (const Strings &in)
 ~Strings (void)
Strings & operator= (const Strings &rhs)
char * get (int index) const
void set (int index, char *s)
int getCount (void) const
char ** getArray (void) const
void print (void)


Constructor & Destructor Documentation

Strings::Strings (  int  in_count,
const char *  n = NULL
) 
 

This constructor creates an array of size "in_count", with name "n"

Strings::Strings (  char **  in_array,
int  size,
const char *  n = NULL
) 
 

This constructor creates an array of size "size", with name "n" whose contents are copied from the contents of "in_array". Strings in "in_array" are duplicated.

Strings::Strings (  const char *  n = NULL  )  [inline]
 

This constructor creates an array of size 0, with name "n"

Strings::Strings (  const Strings &  in  ) 
 

This is the copy constructor

Strings::~Strings (  void   ) 
 

The destructor frees up all the internal memory allocated at creation or resizing


Member Function Documentation

char* Strings::get (  int  index  )  const
 

This method returns a pointer to the string at location "index" in the string array

char** Strings::getArray (  void   )  const [inline]
 

This method returns a pointer to the internal array of strings. Use with caution, preferably for read-only purposes.

int Strings::getCount (  void   )  const [inline]
 

This method returns the number of strings in the array

Strings& Strings::operator= (  const Strings &  rhs  ) 
 

Assignment operator

void Strings::print (  void   ) 
 

Debugging method to print out contents of array

void Strings::set (  int  index,
char *  s
) 
 

This method sets the string at location "index" to the string in "s". The input string is duplicated and the old string is deleted, so this is an expensive function call.


RHexLib Reference Documentation