AuxPort 0.2
Modules for Audio Software Development
Loading...
Searching...
No Matches
AuxPort::String Class Reference

Abstraction over C-Style Strings for ease of use. More...

#include <AuxString.h>

Inheritance diagram for AuxPort::String:
AuxPort::ILog AuxPort::ICasters AuxPort::Casters

Public Member Functions

 String ()
 Creates an empty String object.
 
 String (char character)
 Initializes a String object with a character.
 
 String (const uint32 &string)
 Initializes a String object with a integer.
 
 String (char *string)
 Initializes a String object with a C-Style String.
 
 String (const char *string)
 Initializes a String object with a constant C-Style String.
 
 String (const String &string)
 Intializes a String with another const String Object.
 
 String (String &string)
 Intializes a String with a String Object.
 
 String (const std::string &string)
 Intializes a String with a std::string Object.
 
 String (std::string &string)
 Intializes a String with a std::string Object.
 
 ~String ()
 Default Destructor. Safely Deallocates memory before destroying the String object.
 
size_t length () const
 Returns Length of String.
 
bool Empty () const
 Checks whether the String is Empty or not.
 
char * getCString () const
 Casts the String object to a C-Style String and returns it.
 
char getFirstCharacter () const
 Returns the first character in the string.
 
void operator= (const String &c)
 Overloaded the Assignment Operator.
 
void operator= (const char *c)
 Overloaded the Assignment Operator.
 
void operator= (const std::string &c)
 Overloaded the Assignment Operator.
 
String operator+ (const char *c)
 Overloaded + operator for String Concatenation with a const C-Style String.
 
String operator+ (const String &c)
 Overloaded + operator for String Concatenation with a const C-Style String.
 
String operator+ (const std::string &c)
 Overloaded + operator for String Concatenation with a const C-Style String.
 
Stringoperator+= (const char &c)
 Overloaded the += Operator.
 
Stringoperator+= (const char *c)
 Overloaded the += Operator.
 
Stringoperator+= (const std::string &c)
 Overloaded the += Operator.
 
Stringoperator+= (const String &c)
 Overloaded the += Operator.
 
void replaceCharacter (const char characterToReplace, const char replacementCharacter)
 Searches for all instance of a character in a String and replaces it with the character provided.
 
void pushBack (const char c)
 Concatenates a character to the end of String.
 
void pushBack (const char *c)
 Concatenates a C-Style String to the end of String.
 
void pushBack (const String &c)
 Concatenates a String object to the end of String.
 
void pushBack (const std::string &c)
 Concatenates an std::String to the end of String.
 
String substring (const uint32 &start=0, const uint32 &end=1) const
 Returns the Substring in a String.
 
void Log () override
 Overrides the Logging Module to Handle String Object Logging.
 
int32 toInt32 () override
 Casts the String into a signed 32-bit Integer (Only handles Numerical Strings)
 
uint32 toUInt32 () override
 Casts the String into a unsigned 32-bit Integer (Only handles Numerical Strings)
 
std::string toStdString () override
 Casts the String object to std::string.
 
double toDouble () override
 Casts the String into a double (Only handles Numerical Strings)
 

Static Public Member Functions

static String subtract (String &string1, String &string2)
 Allows you to substract two AuxPort::Strings and get the resulted "Difference" as an AuxPort::String;.
 
static std::string subtract (std::string string1, std::string string2)
 Allows you to substract two std::strings and get the resulted "Difference" as a std::string;.
 

Friends

std::ostream & operator<< (std::ostream &out, const String &c)
 Overloaded << operator to allow console printing of String object using ostream

 
std::ostream & operator<< (std::ostream &out, String *c)
 Overloaded >> operator to allow console printing of String object using ostream.
 

Additional Inherited Members

- Protected Member Functions inherited from AuxPort::ILog
void setColour (const ColourType &colourType)
 This function allows you to set text colour for the text to be printed onto the console.
 

Detailed Description

Abstraction over C-Style Strings for ease of use.

Example :

AuxPort::String string = "Hello There";
Abstraction over C-Style Strings for ease of use.
Definition AuxString.h:55

Definition at line 54 of file AuxString.h.

Constructor & Destructor Documentation

◆ String() [1/9]

AuxPort::String::String ( )

Creates an empty String object.

Definition at line 56 of file AuxString.cpp.

◆ String() [2/9]

AuxPort::String::String ( char character)

Initializes a String object with a character.

Definition at line 62 of file AuxString.cpp.

◆ String() [3/9]

AuxPort::String::String ( const uint32 & string)

Initializes a String object with a integer.

Definition at line 85 of file AuxString.cpp.

◆ String() [4/9]

AuxPort::String::String ( char * string)

Initializes a String object with a C-Style String.

Definition at line 102 of file AuxString.cpp.

◆ String() [5/9]

AuxPort::String::String ( const char * string)

Initializes a String object with a constant C-Style String.

Definition at line 111 of file AuxString.cpp.

◆ String() [6/9]

AuxPort::String::String ( const String & string)

Intializes a String with another const String Object.

Definition at line 120 of file AuxString.cpp.

◆ String() [7/9]

AuxPort::String::String ( String & string)

Intializes a String with a String Object.

Definition at line 129 of file AuxString.cpp.

◆ String() [8/9]

AuxPort::String::String ( const std::string & string)

Intializes a String with a std::string Object.

Definition at line 138 of file AuxString.cpp.

◆ String() [9/9]

AuxPort::String::String ( std::string & string)

Intializes a String with a std::string Object.

Definition at line 147 of file AuxString.cpp.

◆ ~String()

AuxPort::String::~String ( )

Default Destructor. Safely Deallocates memory before destroying the String object.

Definition at line 156 of file AuxString.cpp.

Member Function Documentation

◆ Empty()

bool AuxPort::String::Empty ( ) const

Checks whether the String is Empty or not.

Definition at line 170 of file AuxString.cpp.

◆ getCString()

char * AuxPort::String::getCString ( ) const

Casts the String object to a C-Style String and returns it.

Definition at line 45 of file AuxString.cpp.

◆ getFirstCharacter()

char AuxPort::String::getFirstCharacter ( ) const

Returns the first character in the string.

Definition at line 50 of file AuxString.cpp.

◆ length()

size_t AuxPort::String::length ( ) const

Returns Length of String.

Definition at line 165 of file AuxString.cpp.

◆ Log()

void AuxPort::String::Log ( )
overridevirtual

Overrides the Logging Module to Handle String Object Logging.

Reimplemented from AuxPort::ILog.

Definition at line 310 of file AuxString.cpp.

◆ operator+() [1/3]

String AuxPort::String::operator+ ( const char * c)

Overloaded + operator for String Concatenation with a const C-Style String.

Definition at line 337 of file AuxString.cpp.

◆ operator+() [2/3]

String AuxPort::String::operator+ ( const std::string & c)

Overloaded + operator for String Concatenation with a const C-Style String.

Definition at line 354 of file AuxString.cpp.

◆ operator+() [3/3]

String AuxPort::String::operator+ ( const String & c)

Overloaded + operator for String Concatenation with a const C-Style String.

Definition at line 346 of file AuxString.cpp.

◆ operator+=() [1/4]

String * AuxPort::String::operator+= ( const char & c)

Overloaded the += Operator.

You can add a character to the end of the string.

String str='a';
str+='b';

Definition at line 362 of file AuxString.cpp.

◆ operator+=() [2/4]

String * AuxPort::String::operator+= ( const char * c)

Overloaded the += Operator.

You can concatenate a C-Style String to the end of the string.

String string="Hello";
string+=" World";

Definition at line 368 of file AuxString.cpp.

◆ operator+=() [3/4]

String * AuxPort::String::operator+= ( const std::string & c)

Overloaded the += Operator.

You can concatenate a std::string to the end of the string.

String str="Hello";
std::string str2=" World";
str += str2;

Definition at line 374 of file AuxString.cpp.

◆ operator+=() [4/4]

String * AuxPort::String::operator+= ( const String & c)

Overloaded the += Operator.

You can concatenate a AuxPort::String to the end of the string.

String str="Hello";
String str2=" World";
str += str2;

Definition at line 380 of file AuxString.cpp.

◆ operator=() [1/3]

void AuxPort::String::operator= ( const char * c)

Overloaded the Assignment Operator.

You can assign/initialize a String like:

String string = "Hello There"

Definition at line 195 of file AuxString.cpp.

◆ operator=() [2/3]

void AuxPort::String::operator= ( const std::string & c)

Overloaded the Assignment Operator.

You can assign/initialize a String like:

String string = "Hello There"

Definition at line 200 of file AuxString.cpp.

◆ operator=() [3/3]

void AuxPort::String::operator= ( const String & c)

Overloaded the Assignment Operator.

You can assign/initialize a String like:

String string = "Hello There"

Definition at line 175 of file AuxString.cpp.

◆ pushBack() [1/4]

void AuxPort::String::pushBack ( const char * c)

Concatenates a C-Style String to the end of String.

Definition at line 246 of file AuxString.cpp.

◆ pushBack() [2/4]

void AuxPort::String::pushBack ( const char c)

Concatenates a character to the end of String.

Definition at line 230 of file AuxString.cpp.

◆ pushBack() [3/4]

void AuxPort::String::pushBack ( const std::string & c)

Concatenates an std::String to the end of String.

Definition at line 289 of file AuxString.cpp.

◆ pushBack() [4/4]

void AuxPort::String::pushBack ( const String & c)

Concatenates a String object to the end of String.

Definition at line 267 of file AuxString.cpp.

◆ replaceCharacter()

void AuxPort::String::replaceCharacter ( const char characterToReplace,
const char replacementCharacter )

Searches for all instance of a character in a String and replaces it with the character provided.

Definition at line 221 of file AuxString.cpp.

◆ substring()

String AuxPort::String::substring ( const uint32 & start = 0,
const uint32 & end = 1 ) const

Returns the Substring in a String.

Definition at line 392 of file AuxString.cpp.

◆ subtract() [1/2]

std::string AuxPort::String::subtract ( std::string string1,
std::string string2 )
static

Allows you to substract two std::strings and get the resulted "Difference" as a std::string;.

Definition at line 317 of file AuxString.cpp.

◆ subtract() [2/2]

String AuxPort::String::subtract ( String & string1,
String & string2 )
static

Allows you to substract two AuxPort::Strings and get the resulted "Difference" as an AuxPort::String;.

Definition at line 332 of file AuxString.cpp.

◆ toDouble()

double AuxPort::String::toDouble ( )
overridevirtual

Casts the String into a double (Only handles Numerical Strings)

Implements AuxPort::ICasters.

Definition at line 532 of file AuxString.cpp.

◆ toInt32()

int32 AuxPort::String::toInt32 ( )
overridevirtual

Casts the String into a signed 32-bit Integer (Only handles Numerical Strings)

Example :

String string = "123423";

This can be cast into an signed 32 bit Integer.

Implements AuxPort::ICasters.

Definition at line 487 of file AuxString.cpp.

◆ toStdString()

std::string AuxPort::String::toStdString ( )
overridevirtual

Casts the String object to std::string.

Implements AuxPort::ICasters.

Definition at line 386 of file AuxString.cpp.

◆ toUInt32()

uint32 AuxPort::String::toUInt32 ( )
overridevirtual

Casts the String into a unsigned 32-bit Integer (Only handles Numerical Strings)

Example :

String string = "123423";

This can be cast into an signed Unsigned 32-bit Integer.

Implements AuxPort::ICasters.

Definition at line 515 of file AuxString.cpp.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & out,
const String & c )
friend

Overloaded << operator to allow console printing of String object using ostream

Definition at line 205 of file AuxString.cpp.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & out,
String * c )
friend

Overloaded >> operator to allow console printing of String object using ostream.

Definition at line 213 of file AuxString.cpp.


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