feisty meow concerns codebase  2.140
structures::string_set Class Reference

A simple object that wraps a templated set of strings. More...

#include <set.h>

Inheritance diagram for structures::string_set:
Collaboration diagram for structures::string_set:

Public Member Functions

 string_set ()
 Constructs an empty set of strings. More...
 
 string_set (const set< basis::astring > &to_copy)
 Constructs a copy of the "to_copy" array. More...
 
 string_set (const string_array &to_copy)
 
 DEFINE_CLASS_NAME ("string_set")
 
bool operator== (const string_set &compare) const
 
 operator string_array () const
 
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form". More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form". More...
 
virtual int packed_size () const
 Estimates the space needed for the packed structure. More...
 
- Public Member Functions inherited from structures::set< basis::astring >
 set (int num=0, const basis::astring *init=NULL_POINTER, basis::un_short flags=basis::array< basis::astring >::EXPONE)
 Constructs a set with "num" elements, copying them from "init". More...
 
 ~set ()
 Destroys any storage held for the set. More...
 
int elements () const
 Returns the number of elements in this set. More...
 
bool empty () const
 Returns true if the set has no elements. More...
 
bool non_empty () const
 Returns true if the set has some elements. More...
 
void clear ()
 Empties out this set. More...
 
bool member (const basis::astring &to_test) const
 Returns true if the item "to_test" is a member of this set. More...
 
bool add (const basis::astring &to_add)
 Adds a new element "to_add" to the set. More...
 
setoperator+= (const basis::astring &to_add)
 An algebraic operator synonym for add() that operates on the contents. More...
 
setoperator+= (const set &to_add)
 An algebraic operator synonym for add() that operates on a set. More...
 
bool remove (const basis::astring &to_remove)
 Removes the item "to_remove" from the set. More...
 
setoperator-= (const basis::astring &to_zap)
 An algebraic operator synonym for remove that operates on the contents. More...
 
setoperator-= (const set &to_zap)
 An algebraic operator synonym for remove that operates on a set. More...
 
set set_union (const set &union_with) const
 Implements the set union of "this" with "union_with". More...
 
void unionize (const set &union_with)
 Makes "this" set a union of "this" and "union_with". More...
 
set operator+ (const set &uw) const
 A synonym for set_union. More...
 
set intersection (const set &intersect_with) const
 Returns the intersection of "this" with the set in "intersect_with". More...
 
set operator* (const set &iw) const
 A synonym for intersection. More...
 
set difference (const set &differ_with) const
 Returns the difference of this with "differ_with". More...
 
void differentiate (const set &differ_with)
 Makes "this" set equal to the difference of "this" and "differ_with". More...
 
set operator- (const set &dw) const
 A synonym for difference. More...
 
int find (const basis::astring &to_find) const
 Returns the integer index of the item "to_find" in this set. More...
 
bool remove_index (int index)
 Zaps the entry at the specified "index". 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...
 

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

A simple object that wraps a templated set of strings.

Definition at line 167 of file set.h.

Constructor & Destructor Documentation

◆ string_set() [1/3]

structures::string_set::string_set ( )
inline

Constructs an empty set of strings.

Definition at line 170 of file set.h.

◆ string_set() [2/3]

structures::string_set::string_set ( const set< basis::astring > &  to_copy)
inline

Constructs a copy of the "to_copy" array.

Definition at line 172 of file set.h.

◆ string_set() [3/3]

structures::string_set::string_set ( const string_array to_copy)
inline

Member Function Documentation

◆ DEFINE_CLASS_NAME()

structures::string_set::DEFINE_CLASS_NAME ( "string_set"  )

◆ operator string_array()

structures::string_set::operator string_array ( ) const
inline

◆ operator==()

bool structures::string_set::operator== ( const string_set compare) const
inline

◆ pack()

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

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements basis::packable.

Definition at line 195 of file set.h.

References structures::pack().

◆ packed_size()

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

Estimates the space needed for the packed structure.

Implements basis::packable.

Definition at line 199 of file set.h.

References basis::array< basis::astring >::get(), basis::array< basis::astring >::length(), and basis::astring::length().

◆ unpack()

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

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements basis::packable.

Definition at line 197 of file set.h.

References structures::unpack().


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