feisty meow concerns codebase  2.140
basis::a_sprintf Class Reference

a_sprintf is a specialization of astring that provides printf style support. More...

#include <astring.h>

Inheritance diagram for basis::a_sprintf:
Collaboration diagram for basis::a_sprintf:

Public Member Functions

 a_sprintf ()
 
 a_sprintf (const char *initial,...)
 
 a_sprintf (const astring &s)
 
- Public Member Functions inherited from basis::astring
 astring ()
 constructs an empty string. More...
 
 astring (const char *initial)
 constructs a copy of the string passed in "initial". More...
 
 astring (char c, int repeat)
 constructs a string with "repeat" characters of "c" in it. More...
 
 astring (const astring &s)
 Constructs a copy of the string "s". More...
 
 astring (const base_string &initial)
 constructs a string from the base class. More...
 
 astring (special_flag way, const char *s,...)
 constructor that sports a few variable parameter constructions. More...
 
virtual ~astring ()
 destroys any storage for the string. More...
 
 DEFINE_CLASS_NAME ("astring")
 
virtual int comparator (const astring &s2) const
 helps to fulfill orderable contract. More...
 
int length () const
 Returns the current length of the string. More...
 
int end () const
 returns the index of the last (non-null) character in the string. More...
 
bool empty () const
 empty() reports if the string is empty, that is, of zero length(). More...
 
bool non_empty () const
 non_empty() reports if the string has some contents. More...
 
bool operator! () const
 the negation operator returns true if the string is empty. More...
 
bool t () const
 t() is a shortcut for the string being "true", as in non-empty. More...
 
virtual const char * observe () const
 observes the underlying pointer to the zero-terminated string. More...
 
const char * c_str () const
 synonym for observe. mimics the STL method name. More...
 
const char * s () const
 synonym for observe. the 's' stands for "string", if that helps. More...
 
virtual char get (int index) const
 a constant peek at the string's internals at the specified index. More...
 
virtual char * access ()
 provides access to the actual string held. More...
 
char * c_str ()
 synonym for access. mimics the STL method. More...
 
char * s ()
 synonym for access. More...
 
char & operator[] (int position)
 accesses individual characters in "this" string. More...
 
const char & operator[] (int position) const
 observes individual characters in "this" string. More...
 
virtual void put (int position, char to_put)
 stores the character "to_put" at index "position" in the string. More...
 
astringsprintf (const char *s,...)
 similar to the SPRINTF constructor, but works on an existing string. More...
 
int convert (int default_value) const
 Converts the string into a corresponding integer. More...
 
long convert (long default_value) const
 converts the string to a long integer. More...
 
float convert (float default_value) const
 converts the string to a floating point number. More...
 
double convert (double default_value) const
 converts the string to a double precision floating point number. More...
 
bool equal_to (const char *that) const
 returns true if "that" is equal to this. More...
 
bool iequals (const astring &that) const
 returns true if this is case-insensitively equal to "that". More...
 
bool iequals (const char *that) const
 returns true if this is case-insensitively equal to "that". More...
 
bool compare (const astring &to_compare, int start_first, int start_second, int count, bool case_sensitive) const
 Compares "this" string with "to_compare". More...
 
bool begins (const astring &maybe_prefix) const
 Returns true if "this" string begins with "maybe_prefix". More...
 
bool ibegins (const astring &maybe_prefix) const
 a case-insensitive method similar to begins(). More...
 
bool ends (const astring &maybe_suffix) const
 returns true if this string ends with "maybe_suffix". More...
 
bool iends (const astring &maybe_suffix) const
 
astringoperator= (const astring &s)
 Sets the contents of this string to "s". More...
 
astringoperator= (const char *s)
 Sets the contents of this string to "s". More...
 
void reset ()
 clears out the contents string. More...
 
void reset (special_flag way, const char *s,...)
 operates like the constructor that takes a 'special_flag'. More...
 
void copy (char *to_stuff, int count) const
 Copies a maximum of "count" characters from this into "to_stuff". More...
 
void stuff (char *to_stuff, int count) const
 a synonym for copy(). More...
 
astring operator+ (const astring &s) const
 Returns the concatenation of "this" and "s". More...
 
astringoperator+= (const astring &s)
 Modifies "this" by concatenating "s" onto it. More...
 
astringoperator+= (const char *s)
 
astring operator+ (const char *s) const
 < synonym for the concatenation operator but uses a char pointer instead. More...
 
astringoperator+= (char c)
 concatenater for single characters. More...
 
int find (char to_find, int position=0, bool reverse=false) const
 Locates "to_find" in "this". More...
 
int find (const astring &to_find, int posn=0, bool reverse=false) const
 finds "to_find" in this string. More...
 
int ifind (char to_find, int position=0, bool reverse=false) const
 like the find() methods above, but case-insensitive. More...
 
int ifind (const astring &to_find, int posn=0, bool reverse=false) const
 like the find() methods above, but case-insensitive. More...
 
int find_any (const char *to_find, int position=0, bool reverse=false) const
 searches for any of the characters in "to_find". More...
 
int ifind_any (const char *to_find, int position=0, bool reverse=false) const
 searches case-insensitively for any of the characters in "to_find". More...
 
int find_non_match (const char *to_find, int position=0, bool reverse=false) const
 searches for any character that is not in "to_find" and returns index. More...
 
bool contains (const astring &to_find) const
 Returns true if "to_find" is contained in this string or false if not. More...
 
bool substring (astring &target, int start, int end) const
 a version that stores the substring in an existing "target" string. More...
 
astring substring (int start, int end) const
 Returns the segment of "this" between the indices "start" and "end". More...
 
astring middle (int start, int count)
 returns the middle of the string from "start" with "count" characters. More...
 
astring left (int count)
 returns the left "count" characters from the string. More...
 
astring right (int count)
 returns the right "count" characters from the string. More...
 
void pad (int length, char padding=' ')
 makes the string "length" characters long. More...
 
void trim (int length)
 shortens the string to "length" if it's longer than that. More...
 
void insert (int position, const astring &to_insert)
 Copies "to_insert" into "this" at the "position". More...
 
virtual void zap (int start, int end)
 Deletes the characters between "start" and "end" inclusively. More...
 
void to_lower ()
 to_lower modifies "this" by replacing capitals with lower-case. More...
 
void to_upper ()
 to_upper does the opposite of to_lower (that is, q becomes Q). More...
 
astring lower () const
 like to_lower(), but returns a new string rather than modifying this. More...
 
astring upper () const
 like to_upper(), but returns a new string rather than modifying this. More...
 
bool replace (const astring &tag, const astring &replacement)
 replaces the first occurrence of "tag" text with the "replacement". More...
 
bool replace_all (char to_replace, char new_char)
 changes all occurrences of "to_replace" with "new_char". More...
 
bool replace_all (const astring &to_replace, const astring &new_string)
 
void shrink ()
 changes all occurrences of "to_replace" into "new_string". More...
 
void strip (const astring &strip_list, how_to_strip way=FROM_BOTH_SIDES)
 strips all chars from "strip_list" out of "this" given the "way". More...
 
void strip_spaces (how_to_strip way=FROM_BOTH_SIDES)
 removes excess space characters from string's beginning, end or both. More...
 
void strip_white_spaces (how_to_strip way=FROM_BOTH_SIDES)
 like strip_spaces, but includes tabs in the list to strip. More...
 
int packed_size () const
 Reports the size required to pack this string into a byte array. More...
 
void pack (byte_array &target) const
 stores this string in the "target". it can later be unpacked again. More...
 
bool unpack (byte_array &source)
 retrieves a string (packed with pack()) from "source" into this string. More...
 
virtual bool equal_to (const equalizable &s2) const
 < provides a case insensitive comparison routine. More...
 
virtual bool less_than (const orderable &s2) const
 
virtual base_stringconcatenate_string (const base_string &s)
 Modifies "this" by concatenating "s" onto it. More...
 
virtual base_stringconcatenate_char (char c)
 concatenater for single characters. More...
 
virtual base_stringassign (const base_string &s)
 Sets the contents of this string to "s". More...
 
virtual base_stringupgrade (const char *s)
 Sets the contents of this string to "s". More...
 
virtual bool sub_string (base_string &target, int start, int end) const
 Gets the segment of "this" between the indices "start" and "end". More...
 
virtual bool sub_compare (const base_string &to_compare, int start_first, int start_second, int count, bool case_sensitive) const
 Compares "this" string with "to_compare". More...
 
virtual void insert (int position, const base_string &to_insert)
 Copies "to_insert" into "this" at the "position". More...
 
virtual void text_form (base_string &state_fill) const
 Provides a text view of all the important info owned by this object. More...
 
astringbase_sprintf (const char *s, va_list &args)
 
byte_arrayget_implementation ()
 
- Public Member Functions inherited from basis::base_string
virtual base_stringoperator= (const base_string &to_copy)
 sets this string's contents equal to the contents of "to_copy". More...
 
- Public Member Functions inherited from basis::orderable
virtual bool operator< (const orderable &s2) const
 the virtual method for object ordering. More...
 
- Public Member Functions inherited from basis::equalizable
virtual bool operator== (const equalizable &s2) const
 the virtual method for object equality. More...
 
- Public Member Functions inherited from basis::text_formable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Additional Inherited Members

- Public Types inherited from basis::astring
enum  special_flag { UNTERMINATED = 62 , SPRINTF = 84 }
 
enum  how_to_strip { FROM_FRONT = 1 , FROM_END = 2 , FROM_BOTH_SIDES = 3 }
 
- Static Public Member Functions inherited from basis::astring
static const astringempty_string ()
 useful wherever empty strings are needed, e.g., function defaults. More...
 
static bool matches (const astring &match_list, char to_match)
 returns true if "to_match" is found in the "match_list" string. More...
 

Detailed Description

a_sprintf is a specialization of astring that provides printf style support.

it makes it much easier to call the SPRINTF style constructor but is otherwise identical to an astring.

Definition at line 439 of file astring.h.

Constructor & Destructor Documentation

◆ a_sprintf() [1/3]

basis::a_sprintf::a_sprintf ( )

int astring::icompare(const astring &to_compare, int length_in) const { return icompare(to_compare.observe(), length_in); }

Definition at line 999 of file astring.cpp.

◆ a_sprintf() [2/3]

basis::a_sprintf::a_sprintf ( const char *  initial,
  ... 
)

Definition at line 1003 of file astring.cpp.

References basis::astring::base_sprintf().

◆ a_sprintf() [3/3]

basis::a_sprintf::a_sprintf ( const astring s)

Definition at line 1001 of file astring.cpp.


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