1#ifndef Cpl_Text_String_h_
2#define Cpl_Text_String_h_
15#include "colony_map.h"
98 virtual void copyIn(
const char*
string,
int n ) = 0;
109 virtual void insertAt(
int insertOffset,
const char* stringToInsert ) = 0;
167 virtual void appendTo(
const char*
string,
int n ) = 0;
175 virtual operator char()
const = 0;
181 inline operator const char* ( )
const {
return getString(); }
252 virtual int compare(
const char*
string )
const = 0;
263 virtual bool isEqualSubstring(
int startOffset,
int endOffset,
const char*
string )
const = 0;
277 virtual bool startsWith(
const char*
string,
int startOffset )
const = 0;
282 virtual bool endsWith(
const char*
string )
const = 0;
298 virtual int indexOf(
char c,
int startOffset )
const = 0;
305 virtual int indexOf(
const char*
string )
const = 0;
313 virtual int indexOf(
const char*
string,
int startOffset )
const = 0;
323 virtual int count(
char c )
const = 0;
405 virtual void cut(
int startOffset,
int endOffset ) = 0;
421 virtual void setChar(
int atOffset,
char newchar ) = 0;
428 virtual int replace(
char targetChar,
char newChar ) = 0;
This abstract class defines the interface that a contained object must support if it has comparable k...
Definition Key.h:32
This abstract class defines the operations that can be before on a NULL terminated string.
Definition String.h:40
const char * operator()() const
Returns a Read-only pointer to the "raw" (short-hand for getString())
Definition String.h:184
virtual void formatOpt(bool appendFlag, const char *format,...)=0
This method is the same as format(), except when 'appendFlag' is true then it behaves as formatAppend...
virtual void removeTrailingSpaces()=0
Removes any trailing white-space from the string (white-space is defined by the standard isspace() fu...
virtual bool startsWith(const char *string, int startOffset) const =0
Sames as starsWith(), but begins the search at index 'startOffset'.
virtual void removeTrailingChars(const char *charsSet)=0
Removes the specified trailing characters from the string.
virtual void removeLeadingChars(const char *charsSet)=0
Removes the specified leading characters from the string.
virtual void insertAt(int insertOffset, const char *stringToInsert)=0
This method inserts the specified string starting at the specified offset.
virtual void format(const char *format,...)=0
Allows "printf" formatting of the string.
virtual bool truncated() const =0
Returns true if the last String "write" operation caused the String contents to be truncated.
virtual Cpl::Text::String & operator+=(const Cpl::Text::String &string)=0
Append a string.
virtual bool isEqualSubstring(int startOffset, int endOffset, const char *string) const =0
Compares the specified substring with the specified string.
virtual void appendTo(const char *string, int n)=0
This method appends the content of the source string, up to 'n' characters, into internal storage of ...
virtual bool isEqualIgnoreCase(const char *string) const =0
Compares two strings independently of case and return true if equal NOTE: if 'string' is a null point...
virtual Cpl::Text::String & operator=(unsigned long long num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual int count(char c) const =0
Returns the number of times the specified character appears in the string.
virtual void copyIn(const char *string, int n)=0
This method copies the content of the source string, up to 'n' characters, into internal storage of t...
void trimLeft(int n)
Removes 'n' characters from the start-of-string.
Definition String.h:410
virtual void removeLeadingSpaces()=0
Removes any leading white-space from the string (white-space is defined by the standard isspace() fun...
virtual ~String()
Virtual destructor!
Definition String.h:43
virtual void vformatOpt(bool appendFlag, const char *format, va_list ap)=0
This method is the same as vformat(), except when 'appendFlag' is true then it behaves as vformatAppe...
virtual char * getBuffer(int &maxAllowedLength)=0
Returns a "writable" pointer to the string's internal storage.
virtual int indexOf(char c) const =0
Returns the index of the first match for the specified character.
virtual const char * toUpper()=0
Forces the entire string to upper case characters.
virtual void vformatAppend(const char *format, va_list ap)=0
Same as formatAppend(), except that it is called with a va_list instead of a variable number of argum...
virtual void vformat(const char *format, va_list ap)=0
Same as format(), except that it is called with a va_list instead of a variable number of arguments.
virtual int indexOf(char c, int startOffset) const =0
Same as indexOf(char), but starts at 'startOffset' instead of the beginning of the string.
virtual Cpl::Text::String & operator=(char c)=0
Assigns the character to first position in string and then NULL terminates the string.
virtual void cut(int startOffset, int endOffset)=0
Removes the characters beginning with 'startOffset' and ending with 'endOffset'.
virtual bool operator==(const char *string) const =0
Compares two Strings and returns true if they are equal NOTE: if 'string' is a null pointer,...
virtual Cpl::Text::String & operator=(const String &string)=0
Assignment of a string.
virtual void formatAppend(const char *format,...)=0
Same as format() - but appends "formatting" to the end of the string.
virtual Cpl::Text::String & operator=(long num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual bool isEqualSubstringIgnoreCase(int startOffset, int endOffset, const char *string) const =0
Same as above, except case insensitive comparison.
virtual Cpl::Text::String & operator=(long long num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual int compareIgnoreCase(const char *string) const =0
Same as compare(), but case insensitive.
virtual int indexOf(const char *string) const =0
Returns the index (of the starting character) of the first match for the specified sub-string.
virtual int indexOf(const char *string, int startOffset) const =0
Same as indexOf(const char*), but starts at 'startOffset' instead of the beginning of the string.
virtual bool operator!=(const char *string) const =0
Compares two Strings and returns true if they are NOT equal NOTE: if 'string' is a null pointer,...
virtual bool isEmpty() const =0
Returns true if the string is empty (i.e. string[0] == '\0')
virtual void setChar(int atOffset, char newchar)=0
Replaces the character at index 'atOffset' with 'newchar'.
virtual void trimRight(int n)=0
Removes 'n' characters from the end-of-string.
virtual Cpl::Text::String & operator=(int num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual Cpl::Text::String & operator=(unsigned int num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual const char * toLower()=0
Forces the entire string to lower case characters.
virtual const char * getString() const =0
Read-only Access to the "raw" string.
virtual bool endsWith(const char *string) const =0
Returns true if the string ends with the specified sub-string.
char operator[](int i) const
Returns the specified character. If n is out-bounds, then '\0' is returned.
Definition String.h:187
int availLength()
Returns the available space left in the internal buffer.
Definition String.h:209
virtual int replace(char targetChar, char newChar)=0
Replaces all instances of targetChar in the string with newChar.
virtual int compare(const char *string) const =0
Compares two strings and returns <0, 0, >0 if this string is less than, equal, or greater than respec...
virtual int maxLength() const =0
Returns the max allowed size of the string.
virtual int lastIndexOf(char c) const =0
Returns the index of the last match for the specified character.
virtual Cpl::Text::String & operator=(unsigned long num)=0
Converts the 'number' to a string and stores its in the internal storage of the object.
virtual Cpl::Text::String & operator=(const char *string)=0
Assignment of a string.
virtual void clear()=0
Clears the internal string (i.e.
virtual int length() const =0
Returns the length, in bytes, of the string.
virtual bool startsWith(const char *string) const =0
Returns true if the string starts with the specified sub-string.
The 'Cpl' namespace is the root name space for the Colony.
Definition Api16.h:20