feisty meow concerns codebase  2.140
structures::string_array Class Reference

An array of strings with some additional helpful methods. More...

#include <string_array.h>

Inheritance diagram for structures::string_array:
Collaboration diagram for structures::string_array:

Public Member Functions

 string_array (int number=0, const basis::astring *initial_contents=NULL_POINTER)
 Constructs an array of "number" strings. More...
 
 string_array (int number, const char *initial_contents[])
 a constructor that operates on an array of char pointers. More...
 
 string_array (const basis::array< basis::astring > &to_copy)
 copy constructor that takes a templated array of astring. More...
 
 DEFINE_CLASS_NAME ("string_array")
 
basis::astring text_format (const basis::astring &separator=",", const basis::astring &delimiter="\"") const
 Prints out a formatted view of the contained strings and returns it. More...
 
basis::astring text_form () const
 A synonym for the text_format() method. More...
 
bool equal_to (const equalizable &to_compare) const
 Compares this string array for equality with "to_compare". More...
 
int find (const basis::astring &to_find) const
 locates string specified and returns its index, or negative if missing. More...
 
bool prefix_compare (const string_array &second) const
 Returns true if all of the elements in this are the same in "second". More...
 
virtual void pack (basis::byte_array &packed_form) const
 Packs this string array into the "packed_form" byte array. More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Unpacks a string array from the "packed_form" byte array. More...
 
virtual int packed_size () const
 Returns the number of bytes this string array would consume if packed. More...
 
- Public Member Functions inherited from basis::array< basis::astring >
 DEFINE_CLASS_NAME ("array")
 
 array (int number=0, const basis::astring *init=NULL_POINTER, int flags=EXPONENTIAL_GROWTH|FLUSH_INVISIBLE)
 Constructs an array with room for "number" objects. More...
 
 array (const array< basis::astring > &copy_from)
 copies the contents & sizing information from "copy_from". More...
 
virtual ~array ()
 destroys the memory allocated for the objects. More...
 
void reset (int number=0, const basis::astring *initial_contents=NULL_POINTER)
 Resizes this array and sets the contents from an array of contents. More...
 
arrayoperator= (const array< basis::astring > &copy_from)
 Copies the array in "copy_from" into this. More...
 
int length () const
 Returns the current reported length of the allocated C array. More...
 
int last () const
 Returns the last valid element in the array. More...
 
int flags () const
 Provides the raw flags value, without interpreting what it means. More...
 
bool exponential () const
 Returns true if this allocator will grow exponentially on resize. More...
 
bool simple () const
 Reports whether the templated object is a simple type or not. More...
 
const basis::astringget (int index) const
 Accesses individual objects stored in "this" at the "index" position. More...
 
basis::astringuse (int index)
 A non-constant version of get(); the returned object can be modified. More...
 
const basis::astringoperator[] (int index) const
 Synonym for get that provides the expected array indexing syntax. More...
 
basis::astringoperator[] (int index)
 Synonym for use that provides the expected array indexing syntax. More...
 
outcome put (int index, const basis::astring &to_put)
 Stores an object at the index "index" in the array. More...
 
array concatenation (const array &to_concatenate) const
 Returns the concatenation of "this" and the array "to_concatenate". More...
 
array concatenation (const basis::astring &to_concatenate) const
 Returns the concatenation of "this" and the object "to_concatenate". More...
 
arrayconcatenate (const array &to_concatenate)
 Appends the array "to_concatenate" onto "this" and returns "this". More...
 
arrayconcatenate (const basis::astring &to_concatenate)
 Appends the object "to_concatenate" onto "this" and returns "this". More...
 
arrayconcatenate (const basis::astring *to_concatenate, int length)
 Concatenates a C-array "to_concatenate" onto "this" and returns "this". More...
 
array operator+ (const array &to_cat) const
 Synonym for concatenation. More...
 
array operator+ (const basis::astring &to_concatenate) const
 Synonym for concatenation. More...
 
arrayoperator+= (const array &to_concatenate)
 Synonym for concatenate that modifies "this". More...
 
arrayoperator+= (const basis::astring &to_concatenate)
 Synonym for concatenate that modifies "this". More...
 
const basis::astringobserve () const
 Returns a pointer to the underlying C array of data. More...
 
basis::astringaccess ()
 A non-constant access of the underlying C-array. BE REALLY CAREFUL. More...
 
void swap_contents (array< basis::astring > &other)
 Exchanges the contents of "this" and "other". More...
 
void snarf (array &new_contents)
 Drops "this" array's contents into the dustbin and uses "new_contents". More...
 
array subarray (int start, int end) const
 Returns the array segment between the indices "start" and "end". More...
 
outcome insert (int index, int new_indices)
 Adds "new_indices" new positions for objects into the array at "index". More...
 
outcome overwrite (int index, const array &write_with, int count=-1)
 Stores the array "write_with" into the current array at the "index". More...
 
outcome stuff (int length, basis::astring *to_stuff) const
 Copies at most "length" elements from this into the array "to_stuff". More...
 
outcome resize (int new_size, how_to_copy way=NEW_AT_END)
 Changes the size of the C array to "new_size". More...
 
outcome zap (int start, int end)
 Deletes from "this" the objects inclusively between "start" and "end". More...
 
outcome shrink ()
 Cuts loose any allocated space that is beyond the real length. More...
 
outcome retrain (int new_size, const basis::astring *to_copy)
 Resizes the C array and stuffs it with the contents in "to_copy". More...
 
void shift_data (shift_directions where)
 The valid portion of the array is moved to the left or right. More...
 
int internal_real_length () const
 Gritty Internal: the real allocated length. More...
 
int internal_offset () const
 Gritty Internal: the offset from real start to stored data. More...
 
const basis::astringinternal_block_start () const
 Gritty Internal: constant peek at the real allocated pointer. More...
 
basis::astringinternal_block_start ()
 Gritty Internal: the real allocated pointer made accessible. More...
 
basis::astring *const * internal_offset_mem () const
 Gritty Internal: the start of the actual stored data. More...
 
- Public Member Functions inherited from basis::equalizable
virtual bool equal_to (const equalizable &s2) const =0
 
virtual bool operator== (const equalizable &s2) const
 the virtual method for object equality. More...
 

Additional Inherited Members

- Public Types inherited from basis::array< basis::astring >
enum  specialc_flags
 the flags specify how the array treats its contents and its length. More...
 
enum  how_to_copy
 
enum  shift_directions
 

Detailed Description

An array of strings with some additional helpful methods.

Definition at line 28 of file string_array.h.

Constructor & Destructor Documentation

◆ string_array() [1/3]

structures::string_array::string_array ( int  number = 0,
const basis::astring initial_contents = NULL_POINTER 
)
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 astrings with at least as many entries as "number".

Definition at line 34 of file string_array.h.

◆ string_array() [2/3]

structures::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 44 of file string_array.h.

◆ string_array() [3/3]

structures::string_array::string_array ( const basis::array< basis::astring > &  to_copy)
inline

copy constructor that takes a templated array of astring.

Definition at line 51 of file string_array.h.

Member Function Documentation

◆ DEFINE_CLASS_NAME()

structures::string_array::DEFINE_CLASS_NAME ( "string_array"  )

◆ equal_to()

bool structures::string_array::equal_to ( const equalizable &  to_compare) const
inline

Compares this string array for equality with "to_compare".

Definition at line 77 of file string_array.h.

◆ find()

int structures::string_array::find ( const basis::astring to_find) const
inline

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

Definition at line 88 of file string_array.h.

Referenced by versions::version_ini::write_assembly().

◆ pack()

virtual void structures::string_array::pack ( basis::byte_array packed_form) const
inlinevirtual

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

Implements basis::packable.

Definition at line 107 of file string_array.h.

Referenced by octopi::unhandled_request::pack(), and structures::version::pack().

◆ packed_size()

virtual int structures::string_array::packed_size ( ) const
inlinevirtual

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

Implements basis::packable.

Definition at line 115 of file string_array.h.

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

◆ prefix_compare()

bool structures::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 98 of file string_array.h.

Referenced by octopi::octopus::evaluate(), and synchronic::list_synchronizer::update().

◆ text_form()

◆ text_format()

basis::astring structures::string_array::text_format ( const basis::astring separator = ",",
const basis::astring delimiter = "\"" 
) const
inline

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

Definition at line 58 of file string_array.h.

Referenced by text_form().

◆ unpack()

virtual bool structures::string_array::unpack ( basis::byte_array packed_form)
inlinevirtual

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

Implements basis::packable.

Definition at line 111 of file string_array.h.

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


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