string_array Class Reference

A simple array of strings with some additional helpful methods. More...

#include <string_array.h>

Inheritance diagram for string_array:

Inheritance graph
[legend]
Collaboration diagram for string_array:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 string_array (int number=0, const istring *initial_contents=NIL)
 Constructs an array of "number" strings.
 string_array (int number, const char *initial_contents[])
 a constructor that operates on an array of char pointers.
 string_array (const array< istring > &to_copy)
 copy constructor that takes a templated array of istring.
 IMPLEMENT_CLASS_NAME ("string_array")
istring text_format (const istring &separator=",", const istring &delimiter="\"") const
 Prints out a formatted view of the contained strings and returns it.
istring text_form () const
 A synonym for the text_format() method.
bool operator== (const string_array &to_compare) const
 Compares this string array for equality with "to_compare".
bool operator!= (const string_array &to_compare) const
 Compares this string array for non-equality with "to_compare".
int find (const istring &to_find) const
 locates string specified and returns its index, or negative if missing.
bool prefix_compare (const string_array &second) const
 Returns true if all of the elements in this are the same in "second".
virtual void pack (byte_array &packed_form) const
 Packs this string array into the "packed_form" byte array.
virtual bool unpack (byte_array &packed_form)
 Unpacks a string array from the "packed_form" byte array.
virtual int packed_size () const
 Returns the number of bytes this string array would consume if packed.

Detailed Description

A simple array of strings with some additional helpful methods.

Definition at line 25 of file string_array.h.


Constructor & Destructor Documentation

string_array::string_array ( int  number = 0,
const istring initial_contents = NIL 
) [inline]

Constructs an array of "number" strings.

creates a list of strings based on an initial "number" of entries and some "initial_contents", which should be a regular C array of istrings with at least as many entries as "number".

Definition at line 29 of file string_array.h.

string_array::string_array ( int  number,
const char *  initial_contents[] 
) [inline]

a constructor that operates on an array of char pointers.

be very careful with the array to ensure that the right number of elements is provided.

Definition at line 39 of file string_array.h.

string_array::string_array ( const array< istring > &  to_copy  )  [inline]

copy constructor that takes a templated array of istring.

Definition at line 46 of file string_array.h.


Member Function Documentation

string_array::IMPLEMENT_CLASS_NAME ( "string_array"   ) 

istring string_array::text_format ( const istring separator = ",",
const istring delimiter = "\"" 
) const [inline]

Prints out a formatted view of the contained strings and returns it.

Definition at line 53 of file string_array.h.

Referenced by text_form().

istring string_array::text_form (  )  const [inline, virtual]

A synonym for the text_format() method.

Reimplemented from object_base.

Definition at line 66 of file string_array.h.

References text_format().

Referenced by octopus::add_tentacle(), tcpip_stack::enumerate_adapters(), octopus::evaluate(), main(), tentacle::propel_arm(), octopus::restore(), and run_test_36().

bool string_array::operator== ( const string_array to_compare  )  const [inline]

Compares this string array for equality with "to_compare".

Definition at line 72 of file string_array.h.

bool string_array::operator!= ( const string_array to_compare  )  const [inline]

Compares this string array for non-equality with "to_compare".

Definition at line 81 of file string_array.h.

int string_array::find ( const istring to_find  )  const [inline]

locates string specified and returns its index, or negative if missing.

Definition at line 85 of file string_array.h.

Referenced by byte_format::parse_dump(), grid_processor::reset_data_fields(), and version_ini::write_assembly().

bool string_array::prefix_compare ( const string_array second  )  const [inline]

Returns true if all of the elements in this are the same in "second".

The array "second" can have more elements, but must have all of the items listed in this string array.

Definition at line 95 of file string_array.h.

virtual void string_array::pack ( byte_array packed_form  )  const [inline, virtual]

Packs this string array into the "packed_form" byte array.

Implements packable.

Definition at line 104 of file string_array.h.

Referenced by unhandled_request::pack(), version::pack(), and file_transfer_infoton::package_tree_info().

virtual bool string_array::unpack ( byte_array packed_form  )  [inline, virtual]

Unpacks a string array from the "packed_form" byte array.

Implements packable.

Definition at line 108 of file string_array.h.

Referenced by unhandled_request::unpack(), and version::unpack().

virtual int string_array::packed_size (  )  const [inline, virtual]

Returns the number of bytes this string array would consume if packed.

Reimplemented from packable.

Definition at line 112 of file string_array.h.

Referenced by infoton::fast_pack_overhead(), and unhandled_request::packed_size().


The documentation for this class was generated from the following file:
Generated on Fri Oct 10 04:30:32 2008 for HOOPLE Libraries by  doxygen 1.5.1