Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

clawsoft.String Class Reference

#include <String.h>

Inheritance diagram for clawsoft.String:

Inheritance graph
[legend]
Collaboration diagram for clawsoft.String:

Collaboration graph
[legend]

Detailed Description

This a string treatment class, it has a lot of methods and the main idea is eliminate de use of the common tricks we use everyday while we work with strings.

Many times when we work with strings we leave BIG memory leaks in our programs, the main idea here is to help the programmer by providing here a very complete strig treatment tool for everyday use.

Definition at line 23 of file String.h.

Public Methods

 String ()
 Default constructor, it initializes buffer and len to zero.

 String (String &s)
 transforms and concatenates s to the current String

 String (const char *s)
 This constructor initializes an instance of this class by taking an array of chars.

 String (const int n)
 This constructor initializes an instance of this class by transforming an integer to an array of chars and then calling assign(const char *s);.

 String (const unsigned int n)
 This constructor initializes an instance of this class by transforming an unsigned integer to an array of chars and then calling assign(const char *s);.

 String (const float n)
 This constructor initializes an instance of this class by transforming a float to an array of chars and then calling assign(const char *s);.

 String (const double n)
 This constructor initializes an instance of this class by transforming a double to an array of chars and then calling assign(const char *s);.

 String (const long double n)
 This constructor initializes an instance of this class by transforming a long double to an array of chars and then calling assign(const char *s);.

 String (const long long n)
 This constructor initializes an instance of this class by transforming a long long to an array of chars and then calling assign(const char *s);.

 ~String ()
 Destructor, eliminates the contents of buffer and sets len to zero by calling the method destroy();.

const char * toCharPtr ()
 returns a pointer to buffer

void concat (const char *s)
 transforms and concatenates s to the current String

void concat (String &s)
 transforms and concatenates s to the current String

void concat (const int n)
 transforms and concatenates n to the current String

void concat (const unsigned int n)
 transforms and concatenates n to the current String

void concat (const float n)
 transforms and concatenates n to the current String

void concat (const double n)
 transforms and concatenates n to the current String

void concat (const long double n)
 transforms and concatenates n to the current String

void concat (const long long n)
 transforms and concatenates n to the current String

String & operator= (const char *s)
 Assigns s to buffer by calling assign(const char *);.

String & operator= (const int n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator= (const unsigned int n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator= (const float n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator= (const double n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator= (const long double n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator= (const long long n)
 Transforms n and assigns it to buffer by calling assign(const char *);.

String & operator+ (String &s)
 Concatenates s to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const char *s)
 Concatenates s to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const int n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const unsigned int n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const float n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const double n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const long double n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+ (const long long n)
 Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

String & operator+= (String &s)
 Concatenates s to itself.

String & operator+= (const char *s)
 Concatenates s to itself.

String & operator+= (const int n)
 Transforms n and concatenates it to the current String.

String & operator+= (const unsigned int n)
 Transforms n and concatenates it to the current String.

String & operator+= (const float n)
 Transforms n and concatenates it to the current String.

String & operator+= (const double n)
 Transforms n and concatenates it to the current String.

String & operator+= (const long double n)
 Transforms n and concatenates it to the current String.

String & operator+= (const long long n)
 Transforms n and concatenates it to the current String.

const char charAt (int i)
 Returns the character at position i.

const char operator[] (int i)
 Returns the character at position i by overriding the operator[].

void deleteString ()
 This just calls destroy, so you can delete the contents in buffer without the need of delete the object itself.

String & trimLeft (const char c='')
 Eliminates all ocurrences of the c character that appears at left of the string.

String & trimRight (const char c='')
 Eliminates all ocurrences of the c character that appears at right of the string.

String & trim (const char c='')
 Eliminates all ocurrences of the c character that appears at the beginning and the end of the string.

String & toUpperCase ()
 Transforms the string to uppercase letters only.

String & toLowerCase ()
 Transforms the string to lowercase letters only.

const unsigned int lenght ()
 Returns the lenght of the string which is stored in len.

const unsigned int size ()
 Returns the lenght of the string which is stored in len.

const int toInt ()
 Transforms the contents of the string to an integer if the string can't be translated to a number then the exception NumberException is thrown.

const unsigned int toUInt ()
 Transforms the contents of the string to an unsigned integer if the string can't be translated to a number then the exception NumberException is thrown.

const float toFloat ()
 Transforms the contents of the string to a float if the string can't be translated to a number then the exception NumberException is thrown.

const double toDouble ()
 Transforms the contents of the string to a double if the string can't be translated to a number then the exception NumberException is thrown.

const long double toLongDouble ()
 Transforms the contents of the string to a long double if the string can't be translated to a number then the exception NumberException is thrown.

const long long toLongLong ()
 Transforms the contents of the string to a long long if the string can't be translated to a number then the exception NumberException is thrown.

bool operator== (String &s)
 Checks if the parameter s is equal to buffer.

bool operator== (const char *s)
 Checks if the parameter s is equal to buffer.

bool operator== (const int n)
 Transforms and checks if the parameter n is equal to buffer.

bool operator== (const unsigned int n)
 Transforms and checks if the parameter n is equal to buffer.

bool operator== (const float n)
 Transforms and checks if the parameter n is equal to buffer.

bool operator== (const double n)
 Transforms and checks if the parameter n is equal to buffer.

bool operator== (const long double n)
 Transforms and checks if the parameter n is equal to buffer.

bool operator== (const long long n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (String &s)
 Checks if the parameter s is equal to buffer.

bool equals (const char *s)
 Checks if the parameter s is equal to buffer.

bool equals (const int n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (const unsigned int n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (const float n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (const double n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (const long double n)
 Transforms and checks if the parameter n is equal to buffer.

bool equals (const long long n)
 Transforms and checks if the parameter n is equal to buffer.

bool hasSubstring (String &s)
 Tells if the substring s is inside the current String.

bool hasSubstring (const char *s)
 Tells if the substring s is inside the current String.

String & deleteFirst ()
 Deletes the first character in buffer.

String & deleteLast ()
 Deletes the last character in buffer.

const int index (String &s, int start=0)
 Returns the leftmost position for string s inside buffer starting at byte start.

const int index (const char *s, int start=0)
 Returns the leftmost position for string s inside buffer starting at byte start.

const int index (const char c, int start=0)
 Returns the leftmost position for string s inside buffer starting at byte start.

const int rindex (String &s, int end=0)
 Returns the rightmost position for string s inside buffer starting at byte end from right to left.

const int rindex (const char *s, int end=0)
 Returns the rightmost position for string s inside buffer starting at byte end from right to left.

const int rindex (const char c, int end=0)
 Returns the rightmost position for string s inside buffer starting at byte end from right to left.

bool startsWith (String &s)
 This method checks if the current string starts with the string stored in s.

bool startsWith (const char *s)
 This method checks if the current string starts with the string stored in s.

bool endsWith (String &s)
 This method checks if the current string ends with the string stored in s.

bool endsWith (const char *s)
 This method checks if the current string ends with the string stored in s.

String & deleteCharAt (const int pos)
 With this you can delete a character at a given position pos, positions start at 0.

String & insertCharAt (const int pos, const char c)
 Use this method when you need to add a given character c at position pos.

char * getClassName ()
 Returns the name of the current class.


Protected Methods

void setClassName (char *n)
 Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.


Private Methods

void assign (const char *s)
 Assigns the contents of s to buffer.

void assign (const int n)
 Transforms and concatenates n to the current String.

void assign (const unsigned int n)
 Transforms and concatenates n to the current String.

void assign (const float n)
 Transforms and concatenates n to the current String.

void assign (const double n)
 Transforms and concatenates n to the current String.

void assign (const long double n)
 Transforms and concatenates n to the current String.

void assign (const long long n)
 Transforms and concatenates n to the current String.

void destroy ()
 Eliminates the contents of buffer and sets len to zero.


Private Attributes

char * buffer
 Holds the string itself as and array of chars by default it points to null whixh also means empty String.

int len
 Holds the dimensions of the string plus one, the reserved address is for storing the termination character \0.


Friends

std::ostream & operator<< (std::ostream &stream, String s)
 The main idea behind this is take advantage of the << operator of the ostream class, this way, you can use this class with streams
String a = "hello world";
you would normally do:
cout << a.toCharPtr() << endl;
with this operator you can just:
cout << a << endl;.



Constructor & Destructor Documentation

clawsoft.String::String  
 

Default constructor, it initializes buffer and len to zero.

Definition at line 58 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String String &    s
 

transforms and concatenates s to the current String

Definition at line 67 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const char *    s
 

This constructor initializes an instance of this class by taking an array of chars.

Definition at line 73 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const int    n
 

This constructor initializes an instance of this class by transforming an integer to an array of chars and then calling assign(const char *s);.

Definition at line 79 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const unsigned int    n
 

This constructor initializes an instance of this class by transforming an unsigned integer to an array of chars and then calling assign(const char *s);.

Definition at line 85 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const float    n
 

This constructor initializes an instance of this class by transforming a float to an array of chars and then calling assign(const char *s);.

Definition at line 91 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const double    n
 

This constructor initializes an instance of this class by transforming a double to an array of chars and then calling assign(const char *s);.

Definition at line 97 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const long double    n
 

This constructor initializes an instance of this class by transforming a long double to an array of chars and then calling assign(const char *s);.

Definition at line 103 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::String const long long    n
 

This constructor initializes an instance of this class by transforming a long long to an array of chars and then calling assign(const char *s);.

Definition at line 109 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, and clawsoft.String.len.

clawsoft.String::~String  
 

Destructor, eliminates the contents of buffer and sets len to zero by calling the method destroy();.

Definition at line 54 of file String.cpp.

References clawsoft.String.destroy().


Member Function Documentation

void clawsoft.String::assign const long long    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 179 of file String.cpp.

References clawsoft.String.assign(), and clawsoft.claw_delete_array().

void clawsoft.String::assign const long double    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 171 of file String.cpp.

References clawsoft.String.assign(), and clawsoft.claw_delete_array().

void clawsoft.String::assign const double    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 163 of file String.cpp.

References clawsoft.String.assign(), and clawsoft.claw_delete_array().

void clawsoft.String::assign const float    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 155 of file String.cpp.

References clawsoft.String.assign(), and clawsoft.claw_delete_array().

void clawsoft.String::assign const unsigned int    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 147 of file String.cpp.

References clawsoft.String.assign(), and clawsoft.claw_delete_array().

void clawsoft.String::assign const int    n [private]
 

Transforms and concatenates n to the current String.

Definition at line 139 of file String.cpp.

References clawsoft.String.assign(), clawsoft.claw_delete_array(), and clawsoft.int2char().

void clawsoft.String::assign const char *    s [private]
 

Assigns the contents of s to buffer.

Definition at line 123 of file String.cpp.

References clawsoft.String.buffer, clawsoft.String.destroy(), and clawsoft.String.len.

Referenced by clawsoft.String.assign(), clawsoft.String.concat(), clawsoft.String.operator=(), clawsoft.String.String(), and clawsoft.String.trimLeft().

const char clawsoft.String::charAt int    i
 

Returns the character at position i.

Definition at line 385 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.len.

Referenced by clawsoft.String.deleteCharAt(), clawsoft.String.endsWith(), clawsoft.String.equals(), clawsoft.String.index(), clawsoft.String.insertCharAt(), clawsoft.String.operator[](), clawsoft.String.rindex(), and clawsoft.String.startsWith().

void clawsoft.String::concat const long long    n
 

transforms and concatenates n to the current String

Definition at line 257 of file String.cpp.

References clawsoft.claw_delete_array(), and clawsoft.String.concat().

void clawsoft.String::concat const long double    n
 

transforms and concatenates n to the current String

Definition at line 249 of file String.cpp.

References clawsoft.claw_delete_array(), and clawsoft.String.concat().

void clawsoft.String::concat const double    n
 

transforms and concatenates n to the current String

Definition at line 241 of file String.cpp.

References clawsoft.claw_delete_array(), and clawsoft.String.concat().

void clawsoft.String::concat const float    n
 

transforms and concatenates n to the current String

Definition at line 233 of file String.cpp.

References clawsoft.claw_delete_array(), and clawsoft.String.concat().

void clawsoft.String::concat const unsigned int    n
 

transforms and concatenates n to the current String

Definition at line 225 of file String.cpp.

References clawsoft.claw_delete_array(), and clawsoft.String.concat().

void clawsoft.String::concat const int    n
 

transforms and concatenates n to the current String

Definition at line 217 of file String.cpp.

References clawsoft.claw_delete_array(), clawsoft.String.concat(), and clawsoft.int2char().

void clawsoft.String::concat String &    s
 

transforms and concatenates s to the current String

Definition at line 213 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.concat().

void clawsoft.String::concat const char *    s
 

transforms and concatenates s to the current String

Definition at line 187 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, clawsoft.claw_delete_array(), and clawsoft.String.len.

Referenced by clawsoft.String.concat(), clawsoft.String.operator+(), and clawsoft.String.operator+=().

String & clawsoft.String::deleteCharAt const int    pos
 

With this you can delete a character at a given position pos, positions start at 0.

Definition at line 993 of file String.cpp.

References clawsoft.String.buffer, clawsoft.String.charAt(), clawsoft.claw_delete_array(), clawsoft.String.len, and clawsoft.String.size().

String & clawsoft.String::deleteFirst  
 

Deletes the first character in buffer.

Definition at line 767 of file String.cpp.

References clawsoft.String.buffer, clawsoft.String.destroy(), clawsoft.String.len, and clawsoft.String.size().

String & clawsoft.String::deleteLast  
 

Deletes the last character in buffer.

Definition at line 789 of file String.cpp.

References clawsoft.String.buffer, clawsoft.String.destroy(), clawsoft.String.len, and clawsoft.String.size().

Referenced by clawsoft.TextBox.checkKeyEvents().

void clawsoft.String::deleteString  
 

This just calls destroy, so you can delete the contents in buffer without the need of delete the object itself.

Definition at line 395 of file String.cpp.

References clawsoft.String.destroy().

Referenced by clawsoft.provideCard(), and clawsoft.BingoCard.request().

void clawsoft.String::destroy   [private]
 

Eliminates the contents of buffer and sets len to zero.

Definition at line 116 of file String.cpp.

References clawsoft.String.buffer, clawsoft.claw_delete_array(), and clawsoft.String.len.

Referenced by clawsoft.String.assign(), clawsoft.String.deleteFirst(), clawsoft.String.deleteLast(), clawsoft.String.deleteString(), clawsoft.String.trimLeft(), and clawsoft.String.~String().

bool clawsoft.String::endsWith const char *    s
 

This method checks if the current string ends with the string stored in s.

Definition at line 973 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

bool clawsoft.String::endsWith String &    s
 

This method checks if the current string ends with the string stored in s.

Definition at line 960 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

bool clawsoft.String::equals const long long    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 740 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const long double    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 735 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const double    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 730 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const float    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 725 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const unsigned int    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 720 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const int    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 715 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::equals const char *    s
 

Checks if the parameter s is equal to buffer.

Definition at line 701 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

bool clawsoft.String::equals String &    s
 

Checks if the parameter s is equal to buffer.

Definition at line 691 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

Referenced by clawsoft.String.equals(), and clawsoft.String.operator==().

char * clawsoft.Object::getClassName   [inherited]
 

Returns the name of the current class.

Definition at line 18 of file Object.cpp.

References clawsoft.Object.__cls_name.

bool clawsoft.String::hasSubstring const char *    s
 

Tells if the substring s is inside the current String.

Definition at line 756 of file String.cpp.

References clawsoft.String.buffer.

bool clawsoft.String::hasSubstring String &    s
 

Tells if the substring s is inside the current String.

Definition at line 745 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.toCharPtr().

const int clawsoft.String::index const char    c,
int    start = 0
 

Returns the leftmost position for string s inside buffer starting at byte start.

Definition at line 846 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

const int clawsoft.String::index const char *    s,
int    start = 0
 

Returns the leftmost position for string s inside buffer starting at byte start.

Definition at line 824 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

const int clawsoft.String::index String &    s,
int    start = 0
 

Returns the leftmost position for string s inside buffer starting at byte start.

Definition at line 806 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

String & clawsoft.String::insertCharAt const int    pos,
const char    c
 

Use this method when you need to add a given character c at position pos.

Definition at line 1010 of file String.cpp.

References clawsoft.String.buffer, clawsoft.String.charAt(), clawsoft.claw_delete_array(), clawsoft.String.len, and clawsoft.String.size().

const unsigned int clawsoft.String::lenght  
 

Returns the lenght of the string which is stored in len.

Definition at line 455 of file String.cpp.

References clawsoft.String.len.

String & clawsoft.String::operator+ const long long    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 335 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const long double    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 330 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const double    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 325 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const float    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 320 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const unsigned int    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 315 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const int    n
 

Transforms and concatenates n to the current String by overriding the + operator returning an instance of itself.

Definition at line 310 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ const char *    s
 

Concatenates s to the current String by overriding the + operator returning an instance of itself.

Definition at line 305 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+ String &    s
 

Concatenates s to the current String by overriding the + operator returning an instance of itself.

Definition at line 300 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const long long    n
 

Transforms n and concatenates it to the current String.

Definition at line 375 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const long double    n
 

Transforms n and concatenates it to the current String.

Definition at line 370 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const double    n
 

Transforms n and concatenates it to the current String.

Definition at line 365 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const float    n
 

Transforms n and concatenates it to the current String.

Definition at line 360 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const unsigned int    n
 

Transforms n and concatenates it to the current String.

Definition at line 355 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const int    n
 

Transforms n and concatenates it to the current String.

Definition at line 350 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= const char *    s
 

Concatenates s to itself.

Definition at line 345 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator+= String &    s
 

Concatenates s to itself.

Definition at line 340 of file String.cpp.

References clawsoft.String.concat().

String & clawsoft.String::operator= const long long    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 295 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const long double    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 290 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const double    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 285 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const float    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 280 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const unsigned int    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 275 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const int    n
 

Transforms n and assigns it to buffer by calling assign(const char *);.

Definition at line 270 of file String.cpp.

References clawsoft.String.assign().

String & clawsoft.String::operator= const char *    s
 

Assigns s to buffer by calling assign(const char *);.

Definition at line 265 of file String.cpp.

References clawsoft.String.assign().

bool clawsoft.String::operator== const long long    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 687 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const long double    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 683 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const double    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 679 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const float    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 675 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const unsigned int    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 671 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const int    n
 

Transforms and checks if the parameter n is equal to buffer.

Definition at line 668 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== const char *    s
 

Checks if the parameter s is equal to buffer.

Definition at line 664 of file String.cpp.

References clawsoft.String.equals().

bool clawsoft.String::operator== String &    s
 

Checks if the parameter s is equal to buffer.

Definition at line 660 of file String.cpp.

References clawsoft.String.equals().

const char clawsoft.String::operator[] int    i
 

Returns the character at position i by overriding the operator[].

Definition at line 391 of file String.cpp.

References clawsoft.String.charAt().

const int clawsoft.String::rindex const char    c,
int    end = 0
 

Returns the rightmost position for string s inside buffer starting at byte end from right to left.

Definition at line 914 of file String.cpp.

References clawsoft.String.charAt(), clawsoft.String.len, and clawsoft.String.size().

const int clawsoft.String::rindex const char *    s,
int    end = 0
 

Returns the rightmost position for string s inside buffer starting at byte end from right to left.

Definition at line 885 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

const int clawsoft.String::rindex String &    s,
int    end = 0
 

Returns the rightmost position for string s inside buffer starting at byte end from right to left.

Definition at line 857 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

void clawsoft.Object::setClassName char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.

Definition at line 14 of file Object.cpp.

References clawsoft.Object.__cls_name.

Referenced by clawsoft.ArrayOutOfBoundsException.ArrayOutOfBoundsException(), clawsoft.BrokenPipeException.BrokenPipeException(), clawsoft.Dialog.CancelButton.CancelButton(), clawsoft.CantLoadDSOException.CantLoadDSOException(), clawsoft.CantUnloadDSOException.CantUnloadDSOException(), clawsoft.ConnectionRefusedException.ConnectionRefusedException(), clawsoft.ConnectionTimeoutException.ConnectionTimeoutException(), clawsoft.Dialog.Dialog(), clawsoft.DSOException.DSOException(), clawsoft.DSOSymbolException.DSOSymbolException(), clawsoft.ElementNotFoundException.ElementNotFoundException(), clawsoft.Font.Font(), clawsoft.GameSelector.GameSelector(), clawsoft.Dialog.HelpButton.HelpButton(), clawsoft.IOException.IOException(), clawsoft.KeyboardEvent.KeyboardEvent(), clawsoft.LoginDialog.LoginDialog(), clawsoft.Mutex.Mutex(), clawsoft.MutexException.MutexException(), clawsoft.NetworkException.NetworkException(), clawsoft.NetworkUnreachableException.NetworkUnreachableException(), clawsoft.NoMoreTokensException.NoMoreTokensException(), clawsoft.NullPointerException.NullPointerException(), clawsoft.NumberException.NumberException(), clawsoft.Object.Object(), clawsoft.Dialog.OKButton.OKButton(), clawsoft.Plugin.Plugin(), clawsoft.ProcOutOfFileDescriptorsException.ProcOutOfFileDescriptorsException(), Random.Random(), clawsoft.ServerSocket.ServerSocket(), clawsoft.Socket.Socket(), clawsoft.SocketAlreadyBoundedException.SocketAlreadyBoundedException(), clawsoft.SocketAlreadyUsedException.SocketAlreadyUsedException(), clawsoft.SocketUnableToReadException.SocketUnableToReadException(), clawsoft.SocketUnableToWriteException.SocketUnableToWriteException(), clawsoft.SysOutOfFileDescriptorsException.SysOutOfFileDescriptorsException(), clawsoft.TextBox.TextBox(), clawsoft.TextButton.TextButton(), clawsoft.TextField.TextField(), clawsoft.Thread.Thread(), clawsoft.UnableToLockMutexException.UnableToLockMutexException(), clawsoft.UnableToUnlockMutexException.UnableToUnlockMutexException(), and clawsoft.Window.Window().

const unsigned int clawsoft.String::size  
 

Returns the lenght of the string which is stored in len.

Definition at line 459 of file String.cpp.

References clawsoft.String.len.

Referenced by clawsoft.TextBox.checkKeyEvents(), clawsoft.String.deleteCharAt(), clawsoft.String.deleteFirst(), clawsoft.String.deleteLast(), clawsoft.TextBox.draw(), clawsoft.String.endsWith(), clawsoft.String.equals(), clawsoft.String.index(), clawsoft.String.insertCharAt(), clawsoft.Socket.operator<<(), clawsoft.String.rindex(), clawsoft.String.startsWith(), clawsoft.String.toDouble(), and clawsoft.String.toLongDouble().

bool clawsoft.String::startsWith const char *    s
 

This method checks if the current string starts with the string stored in s.

Definition at line 940 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

bool clawsoft.String::startsWith String &    s
 

This method checks if the current string starts with the string stored in s.

Definition at line 927 of file String.cpp.

References clawsoft.String.charAt(), and clawsoft.String.size().

const char * clawsoft.String::toCharPtr  
 

returns a pointer to buffer

Definition at line 50 of file String.cpp.

References clawsoft.String.buffer.

Referenced by clawsoft.Socket.CreateSocket(), clawsoft.TextBox.draw(), clawsoft.Font.Font(), clawsoft.Plugin.getSymbol(), clawsoft.String.hasSubstring(), clawsoft.Plugin.load(), clawsoft.Font.load(), clawsoft.Socket.operator<<(), clawsoft.Font.render(), clawsoft.Font.renderText(), and clawsoft.Tokenizer.Tokenizer().

const double clawsoft.String::toDouble  
 

Transforms the contents of the string to a double if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 525 of file String.cpp.

References clawsoft.__power(), clawsoft.String.buffer, clawsoft.String.len, clawsoft.String.size(), and clawsoft.String.toInt().

Referenced by clawsoft.String.toFloat().

const float clawsoft.String::toFloat  
 

Transforms the contents of the string to a float if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 521 of file String.cpp.

References clawsoft.String.toDouble().

const int clawsoft.String::toInt  
 

Transforms the contents of the string to an integer if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 471 of file String.cpp.

References clawsoft.__power(), clawsoft.String.buffer, and clawsoft.String.len.

Referenced by clawsoft.String.toDouble().

const long double clawsoft.String::toLongDouble  
 

Transforms the contents of the string to a long double if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 580 of file String.cpp.

References clawsoft.__power(), clawsoft.String.buffer, clawsoft.String.len, clawsoft.String.size(), and clawsoft.String.toLongLong().

const long long clawsoft.String::toLongLong  
 

Transforms the contents of the string to a long long if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 634 of file String.cpp.

References clawsoft.__power(), clawsoft.String.buffer, and clawsoft.String.len.

Referenced by clawsoft.String.toLongDouble().

String & clawsoft.String::toLowerCase  
 

Transforms the string to lowercase letters only.

Definition at line 447 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.len.

const unsigned int clawsoft.String::toUInt  
 

Transforms the contents of the string to an unsigned integer if the string can't be translated to a number then the exception NumberException is thrown.

Definition at line 497 of file String.cpp.

References clawsoft.__power(), clawsoft.String.buffer, and clawsoft.String.len.

Referenced by clawsoft.BingoCard.request().

String & clawsoft.String::toUpperCase  
 

Transforms the string to uppercase letters only.

Definition at line 439 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.len.

String & clawsoft.String::trim const char    c = ''
 

Eliminates all ocurrences of the c character that appears at the beginning and the end of the string.

Definition at line 433 of file String.cpp.

References clawsoft.String.trimLeft(), and clawsoft.String.trimRight().

String & clawsoft.String::trimLeft const char    c = ''
 

Eliminates all ocurrences of the c character that appears at left of the string.

Definition at line 399 of file String.cpp.

References clawsoft.String.assign(), clawsoft.String.buffer, clawsoft.claw_delete_array(), clawsoft.String.destroy(), and clawsoft.String.len.

Referenced by clawsoft.String.trim().

String & clawsoft.String::trimRight const char    c = ''
 

Eliminates all ocurrences of the c character that appears at right of the string.

Definition at line 420 of file String.cpp.

References clawsoft.String.buffer, and clawsoft.String.len.

Referenced by clawsoft.String.trim().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    stream,
String    s
[friend]
 

The main idea behind this is take advantage of the << operator of the ostream class, this way, you can use this class with streams
String a = "hello world";
you would normally do:
cout << a.toCharPtr() << endl;
with this operator you can just:
cout << a << endl;.

Definition at line 380 of file String.cpp.


Field Documentation

char* clawsoft.String.buffer [private]
 

Holds the string itself as and array of chars by default it points to null whixh also means empty String.

Definition at line 29 of file String.h.

Referenced by clawsoft.String.assign(), clawsoft.String.charAt(), clawsoft.String.concat(), clawsoft.String.deleteCharAt(), clawsoft.String.deleteFirst(), clawsoft.String.deleteLast(), clawsoft.String.destroy(), clawsoft.String.hasSubstring(), clawsoft.String.insertCharAt(), clawsoft.operator<<(), clawsoft.String.String(), clawsoft.String.toCharPtr(), clawsoft.String.toDouble(), clawsoft.String.toInt(), clawsoft.String.toLongDouble(), clawsoft.String.toLongLong(), clawsoft.String.toLowerCase(), clawsoft.String.toUInt(), clawsoft.String.toUpperCase(), clawsoft.String.trimLeft(), and clawsoft.String.trimRight().

int clawsoft.String.len [private]
 

Holds the dimensions of the string plus one, the reserved address is for storing the termination character \0.

Definition at line 34 of file String.h.

Referenced by clawsoft.String.assign(), clawsoft.String.charAt(), clawsoft.String.concat(), clawsoft.String.deleteCharAt(), clawsoft.String.deleteFirst(), clawsoft.String.deleteLast(), clawsoft.String.destroy(), clawsoft.String.insertCharAt(), clawsoft.String.lenght(), clawsoft.String.rindex(), clawsoft.String.size(), clawsoft.String.String(), clawsoft.String.toDouble(), clawsoft.String.toInt(), clawsoft.String.toLongDouble(), clawsoft.String.toLongLong(), clawsoft.String.toLowerCase(), clawsoft.String.toUInt(), clawsoft.String.toUpperCase(), clawsoft.String.trimLeft(), and clawsoft.String.trimRight().


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

Powered by:

SourceForge Logo