36 #if !defined(_RunLog_Defined_) 40 #if !defined(_XmlStream_Defined_) 44 #if !defined(_XmlTag_Defined_) 102 KKStr (
const char* str);
114 KKStr (
const std::string& s);
142 bool operator== (
const char* rtStr)
const;
144 bool operator!= (
const char* rtStr)
const;
146 bool operator== (
const std::string right)
const;
148 bool operator!= (
const std::string right)
const;
158 void Append (
const char* buff);
160 void Append (
const char* buff,
168 void Append (
const std::string& str);
241 bool Empty ()
const {
return (len <= 0);}
252 bool EndsWith (
const char* value,
bool ignoreCase);
282 bool decodeEscapeCharacters
420 bool StartsWith (
const char* value,
bool ignoreCase)
const;
422 const char*
Str ()
const {
return val;}
439 const char*
Str (
const char* s);
447 const char*
StrChr (
const char* str,
int ch);
485 const char* searchStr
550 KKStr&
Trim (
const char* whiteSpaceChars =
"\n\r\t ");
552 void TrimLeft (
const char* whiteSpaceChars =
"\n\r\t ");
575 bool ValidNum (
double& value)
const;
668 KKStr& operator<< (
const char* right);
671 KKStr& operator<< (
char right);
678 KKStr& operator<< (
float right);
679 KKStr& operator<< (
double right);
694 KKStr& operator<< (std::ostream& (* mf)(std::ostream &));
699 void AllocateStrSpace (
kkuint32 size);
701 void GrowAllocatedStrSpace (
kkuint32 newAllocatedSize);
703 void ValidateLen ()
const;
728 std::ostream&
__cdecl operator<< ( std::ostream& os,
732 std::istream&
__cdecl operator>> (std::istream& is,
748 char*
STRCAT (
char* dest,
kkint32 destSize,
const char* src);
752 char*
STRDUP (
const char* src);
800 void Sort (
bool _reversedOrder);
818 const char* delChars =
",\t\n\r" 896 KKStrPtrComp (
bool _caseSensitive);
897 KKStrPtrComp (
const KKStrPtrComp& comparator);
898 bool operator() (
const KKStrConstPtr& lhs,
const KKStrConstPtr& rhs)
const;
902 typedef std::map<KKStrPtr, kkint32, KKStrPtrComp> StrIndex;
903 typedef std::pair<KKStrPtr,
kkint32> StrIndexPair;
905 typedef std::map<kkint32, KKStrPtr
const> IndexIndex;
906 typedef std::pair<
kkint32, KKStrPtr
const> IndexIndexPair;
909 KKStrPtrComp comparator;
910 IndexIndex indexIndex;
911 kkint32 memoryConsumedEstimated;
__int16 kkint16
16 bit signed integer.
KKStr(kkint32 size)
Creates a KKStr object that pre-allocates space for 'size' characters.
KKStr StrFromFloat(float f)
KKStr Wide(kkint32 width, char dir= 'R') const
Pads the string with spaces so that it is exactly 'width' characters long. Can pad either left...
VectorKKStr Split(const char *delStr="\n\r\t, ") const
Breaks up the contents of the string into tokens where the characters in 'delStr' acts as separates e...
void AppendInt32(kkint32 i)
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint16 right)
char * STRDUP(const char *src)
char operator[](kkint16 i) const
KKStr & Trim(const char *whiteSpaceChars="\n\r\t ")
KKStr(const std::string &s)
bool EqualIgnoreCase(const char *s2) const
KKStr StrFormatInt64(kkint64 val, const char *mask)
KKStr & operator+=(const KKStr &right)
void Append(const char *buff, kkuint32 buffLen)
kkint32 CompareIgnoreCase(const KKStr &s2) const
Compares with another KKStr, ignoring case.
static bool StrEqualNoCase(const char *s1, const char *s2)
kkint32 MemoryConsumedEstimated() const
KKStrList::KKStrListPtr StringListPtr
summary> Maintains a list of ordered KKStr instances that can be recalled by either string of index...
KKStr GetNextToken2(const char *delStr="\n\t\r ") const
Retrieves the first token in the string without removing any characters.
kkint32 Find(char c, kkint32 pos=0) const
wchar_t * ToWchar_t() const
KKStr operator+(kkuint16 right) const
kkint32 CountInstancesOf(char ch) const
KKStr StrFromInt64(kkint64 i)
KKStr & operator+=(kkuint16 right)
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
kkuint32 ExtractTokenUint(const char *delStr)
KKStr & TrimRight(const char *whiteSpaceChars="\n\r\t ")
VectorKKStr Parse(const char *delStr="\n\r\t, ") const
Will break up the contents of the string into tokens where one of the characters in 'delStr' separate...
kkuint32 ToUint32() const
static bool StrEqual(const char *s1, const char *s2)
KKStr ExtractToken2(const char *delStr="\n\t\r ")
Extract first Token from the string.
bool operator>=(const KKStr &right) const
const KKStr * KKStrConstPtr
void LeftPad(kkint32 width, uchar ch= ' ')
pads the string with enough 'ch' characters on the left side until the string is as long as 'width' c...
void Lower()
Make all characters in the String into lower case.
KKStrConstPtr LookUp(kkuint32 x) const
bool StringInList(KKStr &str)
KKStr ExtractToken(const char *delStr="\n\t\r ")
KKStr DecodeQuotedStr() const
Trees this KKSr instance as a QuotedStr; decodes escape sequences such as '\', '', ' ', '', and '\0' into original characters.
KKStr operator+(kkint32 right) const
kkint32 InstancesOfChar(char ch) const
char ExtractLastChar()
Removes the last character from the string and returns it to the caller.
kkint32 LocateStr(const KKStr &searchStr) const
Returns index of 1st occurrence of 'searchStr' otherwise -1.
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint32 right)
KKStr & operator+=(kkint64 right)
bool operator==(const std::string right) const
KKStr ToQuotedStr() const
KKStr ToTabDelString() const
Strings will be separated by tab() characters and in order of index.
bool operator>(const KKStr &right) const
unsigned __int16 kkuint16
16 bit unsigned integer.
KKStr operator+(float right) const
KKStr & operator=(const char *src)
bool EndsWith(const KKStr &value, bool ignoreCase)
kkint32 SPRINTF(char *buff, kkint32 buffSize, char const *formatSpec, double d)
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint32 right)
kkint32 LocateLastOccurrence(const KKStr &s) const
Returns index of last occurrence of 's' otherwise -1.
bool operator==(const char *rtStr) const
static void StrCapitalize(char *str)
KKStr StrFromUint32(kkuint32 ui)
KKStr & operator+=(kkint32 right)
static KKStr Concat(const VectorKKStr &values)
kkuint32 MaxLenSupported() const
bool operator==(const KKStrListIndexed &right)
char * STRCOPY(char *dest, kkuint16 destSize, const char *src)
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint32 precision, double d)
kkint32 STRICMP(const char *left, const char *right)
KKStr & operator+=(double right)
static const char * Str(const char *s)
std::istream &__cdecl operator>>(std::istream &is, KKStr &str)
KKStr operator+(const char *right) const
bool EqualIgnoreCase(const KKStr &s2) const
kkint32 CompareIgnoreCase(const std::string &s2) const
KKStr operator+(kkuint64 right) const
unsigned __int32 kkuint32
bool EndsWith(const char *value, bool ignoreCase)
KKStrPtr ToKKStrPtr() const
bool ValidNum(double &value) const
kkint32 MemoryConsumedEstimated() const
char * STRCAT(char *dest, kkint32 destSize, const char *src)
KKStr & operator+=(float right)
char operator[](kkuint32 i) const
KKStrList(const char *s[])
bool operator()(const KKStr &s1, const KKStr &s2)
bool Contains(const char *value)
KKStr & operator=(KKStr &&src)
bool operator!=(const char *rtStr) const
bool operator<=(const KKStr &right) const
static KKStr Concat(const char **values)
kkuint32 Len() const
Returns the number of characters in the string.
KKStr StrFromUint16(kkuint16 ui)
static void MemSet(void *dest, kkuint8 byte, kkuint32 size)
void StrReplace(char **dest, const char *src)
Replaces the contents of *dest with *src.
KKStr(double d, kkint32 precision)
summary>Constructs a KKStr instance form a stl::string instance.
KKStr & operator+=(const char *right)
KKStrPtr BinarySearch(const KKStr &searchStr)
KKStrListIndexed(bool _owner, bool _caseSensitive)
char * STRCOPY(char *dest, kkint32 destSize, const char *src)
KKStr operator+(const char *left, const KKStr &right)
static void StrDelete(char **str)
KKStr operator+(kkuint32 right) const
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint64 right)
double ExtractTokenDouble(const char *delStr)
void Append(const char *buff)
bool ExtractTokenBool(const char *delStr)
Extract the next token from the string assuming that it is a logical True/False value.
void AppendUInt32(kkuint32 i)
KKStr(const KKStr &str)
Copy Constructor.
kkint32 Compare(const std::string &s2) const
Compares with STL string.
KKStr Tail(kkint32 tailLen) const
Returns a string consisting of the 'tailLen' characters from the end of the string.
void TrimLeft(const char *whiteSpaceChars="\n\r\t ")
double ToLongitude() const
Processes string as if a standard longitude; ex: "95:32.2E" = 95.53833.
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint16 right)
bool EqualIgnoreCase(const KKStrConstPtr s2) const
XmlTag const * XmlTagConstPtr
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
kkint32 Find(const char *s, kkint32 pos=0) const
KKStr & operator+=(kkuint32 right)
KKStr SubStrPart(kkint32 firstChar, kkint32 lastChar) const
returns a SubString consisting of all characters starting at index 'firstChar' and ending at 'lastInd...
static KKStr Spaces(kkint32 c)
Returns a string of spaces 'c' characters long.
static kkint32 CompareStrings(const KKStr &s1, const KKStr &s2)
Compares to Strings and returns -1, 0, or 1, indicating if less than, equal, or greater.
unsigned char uchar
Unsigned character.
KKStr StrFromDouble(double d)
bool StrInStr(const KKStr &searchField) const
Searches for the occurrence of 'searchField' and where in the string. If found will return 'true' oth...
bool EndsWith(const char *value)
kkint32 MemoryConsumedEstimated() const
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
bool Contains(const KKStr &value)
void Upper()
Converts all characters in string to their Upper case equivalents via 'toupper'.
kkint32 LocateLastOccurrence(char ch) const
Returns index of last occurrence of 'ch' otherwise -1.
LessCaseInsensitiveOperator()
static kkint32 StrCompareIgnoreCase(const char *s1, const char *s2)
std::vector< kkint32 > VectorInt32
Vector of signed 32 bit integers.
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
static bool StrEqualN(const char *s1, const char *s2, kkuint32 len)
KKStr(const char *src, kkuint32 startPos, kkuint32 endPos)
Constructs a KKStr instance from a sub-string of 'src'.
kkint32 LocateCharacter(char ch) const
Returns index of 1st occurrence of 'ch' otherwise -1.
static const KKStr & EmptyStr()
Static method that returns an Empty String.
kkint32 STRNICMP(const char *left, const char *right, kkint32 len)
unsigned long ulong
Unsigned long.
kkint32 CompareTo(const KKStr &s2) const
kkint32 LookUp(KKStrPtr s) const
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
bool StartsWith(const char *value) const
KKStr ExtractQuotedStr(const char *delChars, bool decodeEscapeCharacters)
bool operator!=(const KKStr &right) const
char ExtractChar()
Removes the first character from the string and returns it to the caller.
void Sort(bool _reversedOrder)
void WriteXML(const KKStr &varName, std::ostream &o) const
bool EndsWith(const KKStr &value)
unsigned __int64 kkuint64
bool operator==(const KKStr &right) const
void AddString(KKStrPtr str)
kkint32 Find(const char *s, kkint32 pos, kkint32 n) const
bool StartsWith(const char *value, bool ignoreCase) const
KKStr StrFormatInt(kkint32 val, const char *mask)
KKStr & operator+=(kkuint64 right)
void WriteXML(const KKStr &varName, std::ostream &o) const
std::ostream &__cdecl operator<<(std::ostream &os, const KKStr &str)
kkint32 ExtractTokenInt(const char *delStr)
KKStr operator+(const KKStr &right) const
kkuint64 ExtractTokenUint64(const char *delStr)
bool StartsWith(const KKStr &value, bool ignoreCase) const
kkint32 Find(const KKStr &str, kkint32 pos=0) const
Will return the position where the 1st instance of 'str' after 'pos' occurs or -1 if not found...
wchar_t * StrWide() const
KKStr operator+(kkint16 right) const
static bool StrEqualNoCaseN(const char *s1, const char *s2, kkuint32 len)
const char * Str() const
Returns a pointer to a ascii string.
KKStr MaxLen(kkuint32 maxLen) const
void Append(const std::string &str)
KKStr StrFormatDouble(double val, const char *mask)
void RightPad(kkint32 width, char ch= ' ')
Pads string on the right side with specified character so that the string will be of specified length...
kkint32 LocateNthOccurrence(char ch, kkint32 x) const
KKStr & operator=(kkint32 right)
bool operator!=(const std::string right) const
double ToLatitude() const
Processes string as if a standard latitude; ex: "15:32.2S" = -15.53833.
KKStr operator+(kkint64 right) const
static const char * StrChr(const char *str, int ch)
void Append(const KKStr &str)
char operator[](kkint32 i) const
static void MemCpy(void *dest, void *src, kkuint32 size)
KKStr operator+(double right) const
KKStr & operator=(const KKStr &src)
bool operator==(KKStrConstPtr right) const
Used for logging messages.
kkint32 LookUp(const KKStr &s) const
bool operator<(const KKStr &right) const
bool StartsWith(const KKStr &value) const
KKStr StrFromInt16(kkint16 i)
bool CaseSensative() const
float ToPercentage() const
KKStrListIndexed(const KKStrListIndexed &list)
kkint32 Compare(const KKStr &s2) const
void WriteXML(const KKStr &varName, std::ostream &o) const
static KKStrListPtr ParseDelimitedString(const KKStr &str, const char *delChars=",\t\n\r")
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
bool operator!=(const KKStrListIndexed &right)
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint64 right)
VectorKKStr Split(char del) const
Splits the string up into tokens using 'del' as the separator returning them in a vector...
bool ToBool() const
Returns the bool equivalent of the string, ex 'Yes' = true, 'No' = false, 'True' = true...
void LopOff(kkint32 lastCharPos)
Trims off all characters after the 'lastCharPos' index; to make an empty string you would have to spe...
bool ValidInt(kkint32 &value)
VectorInt32 * ToVectorInt32() const
void WriteXML(const KKStr &varName, std::ostream &o) const
kkuint64 ToUint64() const
KKStr StrFromUint64(kkuint64 ui)
KKStr SubStrPart(kkint32 firstChar) const
returns a SubString consisting of all characters starting at index 'firstChar' until the end of the s...
kkint32 CompareIgnoreCase(const char *s2) const
summary>Compares to Strings and returns -1, 0, or 1, indicating if less than, equal, or greater.
char operator[](kkuint16 i) const
bool ValidMoney(float &value) const
bool operator!=(KKStrConstPtr right) const
KKStr QuotedStr() const
Returns a quoted version of string where special characters Line-Feed, Carriage Return, and Tab, are encoded as escape sequences.
VectorKKStr(const VectorKKStr &v)
KKStr & operator+=(kkint16 right)
std::pair< KKStr, KKStr > KKStrPair
KKStr StrFromInt32(kkint32 i)
KKStr operator+(const char left, const KKStr &right)
volatile const bool VolConstBool
static bool StrInStr(const char *target, const char *searchStr)
KKStrListPtr DuplicateListAndContents() const