KSquare Utilities
KKStr.h
Go to the documentation of this file.
1 /* KKStr.h -- String Management Class
2  * Copyright (C) 1994-2014 Kurt Kramer
3  * For conditions of distribution and use, see copyright notice in KKB.h
4  */
5 #ifndef _KKSTR_
6 #define _KKSTR_
7 //************************************************************************************
8 //* *
9 //* Developed By: Kurt A. Kramer *
10 //* *
11 //* Date: Early 90's *
12 //* *
13 //************************************************************************************
14 //* KKStr class and string manipulation routines.
15 //************************************************************************************
16 
17 #include <map>
18 #include <ostream>
19 #include <string>
20 #include <vector>
21 
22 #ifdef WIN32
23 #else
24 #define __cdecl
25 #endif
26 
27 #include "KKBaseTypes.h"
28 #include "KKQueue.h"
29 
30 #define EnterChar 13
31 #define EscapeChar 27
32 
33 
34 namespace KKB
35 {
36 #if !defined(_RunLog_Defined_)
37  class RunLog;
38 #endif
39 
40 #if !defined(_XmlStream_Defined_)
41  class XmlStream;
42 #endif
43 
44 #if !defined(_XmlTag_Defined_)
45  class XmlTag;
46  typedef XmlTag const * XmlTagConstPtr;
47 #endif
48 
49 
50 
51  class KKStr;
52 
53 
54  class VectorKKStr: public std::vector<KKStr>
55  {
56  public:
57  VectorKKStr ();
58 
59  VectorKKStr (const VectorKKStr& v);
60 
61  void ReadXML (XmlStream& s,
62  XmlTagConstPtr tag,
63  VolConstBool& cancelFlag,
64  RunLog& log
65  );
66 
67  void WriteXML (const KKStr& varName,
68  std::ostream& o
69  ) const;
70  };
71 
72 
73  ///<summary>
74  /// A string class providing safe runtime management; strings can be used as stream and StringBuilder objects. Simple
75  /// token parsing is supported as well as various translations to other formats such as 'int', 'double', and others.
76  /// Allocation is done dynamically increasing as needs warrant. All methods ensure that there is no accessing outside
77  /// the bounds of the allocated string.
78  ///</summary>
79  ///<todo> Should subclass the class from the stl class 'string'. </todo>
80  class KKStr
81  {
82  public:
83  typedef KKStr* KKStrPtr;
84  typedef const KKStr* KKStrConstPtr;
85  //typedef std::vector<KKStr> VectorKKStr;
86 
87  class LessCaseInsensitiveOperator; /**< To be used by templates as the Pred operator. */
88 
89  private:
90  static const kkuint32 KKStrIntMax;
91 
92  kkuint16 allocatedSize;
93  kkuint16 len;
94  char* val;
95 
96  public:
97 
98  KKStr ();
99 
100  ~KKStr ();
101 
102  KKStr (const char* str);
103 
104  KKStr (const KKStr& str);
105 
106  KKStr (KKStr&& str); /**< Move Constructor */
107 
108  KKStr (kkint32 size); /**< @brief Creates a KKStr object that pre-allocates space for 'size' characters. */
109 
110  ///<summary> Initializes the string with a displayable version of <paramref name='d'/> with <paramref name='precision'/> decimal points. </summary>
111  KKStr (double d, kkint32 precision);
112 
113  ///<summary>Constructs a KKStr instance form a stl::string instance.</summary>
114  KKStr (const std::string& s);
115 
116  ///<summary> Constructs an instance from a substring of the ascii-z string <paramref name="src"/>. </summary>
117  ///<param name='src'> Source string to build new instance from. </param>
118  ///<param name = 'startPos'> Index of first character that we want to include in new instance.</param>
119  ///<param name='endPos'> Index of last character that we want to include in new instance.</param>
120  KKStr (const char* src, kkuint32 startPos, kkuint32 endPos);
121 
122  //KKStr& operator= (const KKStrConstPtr src);
123 
124  KKStr& operator= (const KKStr& src);
125 
126  KKStr& operator= (KKStr&& src);
127 
128  KKStr& operator= (const char* src);
129 
130  KKStr& operator= (kkint32 right);
131 
132  KKStr& operator= (const std::vector<KKStr>& right);
133 
134  bool operator== (const KKStr& right) const;
135 
136  bool operator!= (const KKStr& right) const;
137 
138  bool operator== (KKStrConstPtr right) const;
139 
140  bool operator!= (KKStrConstPtr right) const;
141 
142  bool operator== (const char* rtStr) const;
143 
144  bool operator!= (const char* rtStr) const;
145 
146  bool operator== (const std::string right) const;
147 
148  bool operator!= (const std::string right) const;
149 
150  bool operator> (const KKStr& right) const;
151 
152  bool operator>= (const KKStr& right) const;
153 
154  bool operator< (const KKStr& right) const;
155 
156  bool operator<= (const KKStr& right) const;
157 
158  void Append (const char* buff);
159 
160  void Append (const char* buff,
161  kkuint32 buffLen
162  );
163 
164  void Append (char ch);
165 
166  void Append (const KKStr& str);
167 
168  void Append (const std::string& str);
169 
170  void AppendInt32 (kkint32 i);
171 
172  void AppendUInt32 (kkuint32 i);
173 
174  bool CharInStr (char ch); /**< Determines if 'ch' occurs anywhere in the string. */
175 
176  void ChopFirstChar (); /**< Removes the first character from the string. */
177 
178  void ChopLastChar (); /**< Removes the last character from the string. */
179 
180  kkint32 Compare (const KKStr& s2) const; /**< '-1' = less than 's2', '0' = Same as 's2', and '1' = Greater than 's2'. */
181 
182  kkint32 Compare (const std::string& s2) const; /**< '-1' = less than 's2', '0' = Same as 's2', and '1' = Greater than 's2'. */
183 
184  kkint32 CompareTo (const KKStr& s2) const {return Compare (s2);}
185 
186 
187 
188  ///<summary>Compares with another KKStr, ignoring case.</summary>
189  ///<param name='s2'> Other String to compare with.</param>
190  ///<returns> -1=less, 0=equal, 1=greater, -1, 0, or 1, indicating if less than, equal, or greater.</returns>
191  kkint32 CompareIgnoreCase (const KKStr& s2) const;
192 
193 
194  ///<summary>Compares with STL string ignoring case. </summary>
195  /// <param name='s2'> STL String std::string that we will compare with. </param>
196  ///<returns> -1=less, 0=equal, 1=greater, -1, 0, or 1, indicating if less than, equal, or greater. </returns>
197  kkint32 CompareIgnoreCase (const std::string& s2) const;
198 
199 
200 
201  ///<summary>Compares with ascii-z string ignoring case. </summary>
202  ///<param name='s2'> Ascii-z string to compare with. </param>
203  ///<returns> -1=less, 0=equal, 1=greater, -1, 0, or 1, indicating if less than, equal, or greater. </returns>
204  kkint32 CompareIgnoreCase (const char* s2) const;
205 
206 
207  ///<summary>Compares to Strings and returns -1, 0, or 1, indicating if less than, equal, or greater. </summary>
208  static kkint32 CompareStrings (const KKStr& s1, const KKStr& s2);
209 
210  ///<summary>
211  /// Concatenates the list of char* strings, stopping at first NULL. Each of these NULL terminated strings are concatenated
212  /// onto the result string; terminates when 'values[x] == NULL'.
213  ///</summary>
214  static KKStr Concat (const char** values);
215 
216  ///<summary>
217  /// Concatenates the list of char* strings, stops at first NULL Each of these NULL terminated strings are concatenated
218  /// onto the result string; terminates when 'values[x] == NULL'.
219  ///</summary>
220  static
221  KKStr Concat (const VectorKKStr& values);
222 
223  /**
224  *@brief Concatenates the list of 'std::string' strings.
225  *@details Iterates through values concatenating each one onto a result string.
226  */
227  static
228  KKStr Concat (const std::vector<std::string>& values);
229 
230 
231  bool Contains (const KKStr& value);
232 
233  bool Contains (const char* value);
234 
235  kkint32 CountInstancesOf (char ch) const;
236 
237  /** @brief Trees this KKSr instance as a QuotedStr; decodes escape sequences such as '\\', '\r', '\n', '\t', and '\0' into original characters. */
238  KKStr DecodeQuotedStr () const;
239 
240 
241  bool Empty () const {return (len <= 0);}
242 
243 
244 
245  /** @brief Static method that returns an Empty String. */
246  static
247  const KKStr& EmptyStr ();
248 
249  bool EndsWith (const KKStr& value);
250  bool EndsWith (const char* value);
251  bool EndsWith (const KKStr& value, bool ignoreCase);
252  bool EndsWith (const char* value, bool ignoreCase);
253 
254  char EnterStr ();
255 
256  bool EqualIgnoreCase (const KKStr& s2) const;
257  bool EqualIgnoreCase (const KKStrConstPtr s2) const;
258  bool EqualIgnoreCase (const char* s2) const;
259 
260  /**
261  *@brief Removes the first character from the string and returns it to the caller.
262  *@details If the String is already empty it will return 0.
263  */
264  char ExtractChar ();
265 
266 
267  /**
268  *@brief Removes the last character from the string and returns it to the caller.
269  *@details If the String is already empty it will return 0.
270  */
271  char ExtractLastChar ();
272 
273  ///<summary>
274  /// Extracts the next string token; if the string starts with a quote(&quot;) will extract until the terminating quote. Special
275  /// control characters that are encoded with back-slashes such as carriage-return, line-feed, tab, quotes, etc will be decoded.
276  /// It is the inverse of the QuotedStr or ToQuotedStr methods.
277  ///</summary>
278  ///<param nqame='delChars'> List of acceptable delimiter characters. </param>
279  ///<param name='decodeEscapeCharacters'> Indicates if escape sequences should be decoded back to their original code.</param>
280  ///<returns>Token String </returns>
281  KKStr ExtractQuotedStr (const char* delChars,
282  bool decodeEscapeCharacters
283  );
284 
285 
286  ///<summary> Extract first Token from the string. </summary>
287  ///<remarks>
288  /// Removes first Token from string and returns it skipping over any leading delimiters. Tokens will be terminated
289  /// by end of string or the first occurrence of a delimiter character. If no more tokens left will return a Empty
290  /// KKStr. Note if you do not want to skip over leading delimiter characters the use 'ExtractToken2'.
291  ///</remarks>
292  ///<param name='delStr'> List of delimiting characters. </param>
293  ///<returns> Extracted Token. </returns>
294  ///<seealso cref='ExtractToken2'/>
295  KKStr ExtractToken (const char* delStr = "\n\t\r ");
296 
297 
298  /**
299  *@brief Extract first Token from the string.
300  *@details Removes first Token from string and returns it. Unlike 'ExtractToken' it will not
301  * skip over leading delimiters. If the first character is a delimiter it will return a
302  * empty string. Tokens will be terminated by end of string or the first occurrence of a
303  * delimiter character. If no more tokens left will return a Empty KKStr.
304  *@param[in] delStr List of delimiting characters.
305  *@return Extracted Token.
306  *@see ExtractToken
307  *@see ExtractTokenInt
308  *@see ExtractTokenDouble
309  *@see ExtractTokenUint
310  *@see ExtractTokenBool
311  */
312  KKStr ExtractToken2 (const char* delStr = "\n\t\r ");
313 
314 
315  /**
316  *@brief Retrieves the first token in the string without removing any characters.
317  *@details Similar to 'ExtractToken2' except it does not remove characters from the string.
318  *@return The first token in the string.
319  */
320  KKStr GetNextToken2 (const char* delStr = "\n\t\r ") const;
321 
322  kkint32 ExtractTokenInt (const char* delStr);
323 
324  double ExtractTokenDouble (const char* delStr);
325 
326  kkuint32 ExtractTokenUint (const char* delStr);
327 
328  kkuint64 ExtractTokenUint64 (const char* delStr);
329 
330  /**
331  *@brief Extract the next token from the string assuming that it is a logical True/False value.
332  *@details This function calls 'ExtractToken2' and then returns true if the string that
333  *it extracted is equal to "Y", "Yes", "True", "T", or "1" otherwise false.
334  *@param[in] delStr List of delimiter characters.
335  *@returns 'true' or 'false'.
336  */
337  bool ExtractTokenBool (const char* delStr);
338 
339  char FirstChar () const; /**< Returns the first character in the string; if the string is empty returns 0. */
340 
341  void FreeUpUnUsedSpace (); /**< Alloocated space s significanly larger than length of string will reallocate to free up unused space. */
342 
343  kkint32 InstancesOfChar (char ch) const; /**< Returns the number of instances of 'ch' in the string. */
344 
345  /**
346  *@brief Returns a quoted version of string where special characters Line-Feed, Carriage Return,
347  * and Tab, are encoded as escape sequences.
348  *@details string where 'Line Feed(\\n'), Carriage Returns('\\r'), Tabs('\\t'), and Quotes(") are coded as escape
349  * sequences "\\n", "\\r", "t", or "\\". It is then enclosed in quotes(").
350  *@return Quoted String.
351  */
352  KKStr QuotedStr () const;
353 
354  char LastChar () const; /**< Returns the last character in the string but if the string is empty returns 0. */
355 
356  /**
357  *@brief pads the string with enough 'ch' characters on the left side until the string is
358  * as long as 'width' characters.
359  *@details if 'width' is less than the current length of the string then the string will
360  * have characters removed the beginning until its 'len' equals 'width'.
361  */
362  void LeftPad (kkint32 width,
363  uchar ch = ' '
364  );
365 
366  kkuint32 Len () const {return len;} /**< @brief Returns the number of characters in the string. */
367 
368  kkint32 LocateCharacter (char ch) const; /**< @brief Returns index of 1st occurrence of 'ch' otherwise -1. */
369 
370  kkint32 LocateLastOccurrence (char ch) const; /**< @brief Returns index of last occurrence of 'ch' otherwise -1. */
371 
372  kkint32 LocateLastOccurrence (const KKStr& s) const; /**< @brief Returns index of last occurrence of 's' otherwise -1. */
373 
374  kkint32 LocateNthOccurrence (char ch, kkint32 x) const;
375 
376  kkint32 LocateStr (const KKStr& searchStr) const; /**< @brief Returns index of 1st occurrence of 'searchStr' otherwise -1. */
377 
378  void LopOff (kkint32 lastCharPos); /**< @brief Trims off all characters after the 'lastCharPos' index; to make an empty string you would have to specify -1. */
379 
380  void Lower (); /**< @brief Make all characters in the String into lower case. */
381 
382  KKStr MaxLen (kkuint32 maxLen) const; /**< Returns a string that will not be longer that 'maxLen'; any chracters beyond that length will be chopped off. */
383 
384  kkuint32 MaxLenSupported () const; /**< Returns the maximum String Length that this string can support. */
385 
387 
388  /** @brief Will break up the contents of the string into tokens where one of the characters in 'delStr' separates each token. */
389  VectorKKStr Parse (const char* delStr = "\n\r\t, ") const;
390 
391  /**
392  *@brief Pads string on the right side with specified character so that the string will be of specified length.
393  *@param[in] width Width that string will need to be; if less than current length then the string will be truncated to 'len'.
394  *@param[in] ch Character to pad with; if not specified will default to space (' ').
395  */
396  void RightPad (kkint32 width,
397  char ch = ' '
398  );
399 
400 
401  /**@brief Returns a string of spaces 'c' characters long.
402  *@param[in] c Number of space characters to fill the string with.
403  */
404  static
405  KKStr Spaces (kkint32 c);
406 
407 
408  /**
409  *@brief Breaks up the contents of the string into tokens where the characters in 'delStr' acts as separates each token.
410  *@param[in] delStr List of characters that where any one of them can be a delimiter.
411  */
412  VectorKKStr Split (const char* delStr = "\n\r\t, ") const;
413 
414  /** @brief Splits the string up into tokens using 'del' as the separator returning them in a vector. */
415  VectorKKStr Split (char del) const;
416 
417  bool StartsWith (const KKStr& value) const;
418  bool StartsWith (const char* value) const;
419  bool StartsWith (const KKStr& value, bool ignoreCase) const;
420  bool StartsWith (const char* value, bool ignoreCase) const;
421 
422  const char* Str () const {return val;} /**< @brief Returns a pointer to a ascii string. */
423 
424  static
425  void MemCpy (void* dest, void* src, kkuint32 size);
426 
427  static
428  void MemSet (void* dest, kkuint8 byte, kkuint32 size);
429 
430 
431  void ReadXML (XmlStream& s,
432  XmlTagConstPtr tag,
433  VolConstBool& cancelFlag,
434  RunLog& log
435  );
436 
437 
438  static
439  const char* Str (const char* s);
440 
441 
442  static
443  void StrCapitalize (char* str);
444 
445 
446  static
447  const char* StrChr (const char* str, int ch);
448 
449 
450  static
451  kkint32 StrCompareIgnoreCase (const char* s1,
452  const char* s2
453  );
454 
455  static
456  void StrDelete (char** str);
457 
458 
459  static
460  bool StrEqual (const char* s1,
461  const char* s2
462  );
463 
464  static
465  bool StrEqualN (const char* s1,
466  const char* s2,
467  kkuint32 len
468  );
469 
470  static
471  bool StrEqualNoCase (const char* s1,
472  const char* s2
473  );
474 
475 
476  static
477  bool StrEqualNoCaseN (const char* s1,
478  const char* s2,
479  kkuint32 len
480  );
481 
482 
483  static
484  bool StrInStr (const char* target,
485  const char* searchStr
486  );
487 
488 
489  /**
490  *@brief Replaces the contents of *dest with *src.
491  *@details First deletes current *dest then allocates new a new string to **dest so no memory is lost.
492  */
493  void StrReplace (char** dest,
494  const char* src
495  );
496 
497 
498  //WCHAR* StrWide () const; /**< Returns a Wide Character version of the string. The caller will be responsible for deleting this string. */
499  wchar_t* StrWide () const; /**< Returns a Wide Character version of the string. The caller will be responsible for deleting this string. */
500 
501  bool StrInStr (const KKStr& searchField) const;
502 
503 
504  /**
505  *@brief returns a SubString consisting of all characters starting at index 'firstChar' until the end of the string.
506  *@details If the index 'firstChar' is past the end of the string a empty string will be returned.
507  *@param[in] firstChar First character in string to include in the sub-string.
508  *@return Sub-string.
509  */
510  KKStr SubStrPart (kkint32 firstChar) const;
511 
512 
513  /**
514  *@brief returns a SubString consisting of all characters starting at index 'firstChar' and ending at 'lastIndex'
515  *@details If the index 'firstChar' is past the end of the string a empty string will be returned. If 'lastIndex
516  *is past the end of the string then will only include characters until the end of the string.\n
517  *The length of the substring will be (lastChar - firstChar) + 1.
518  *@param[in] firstChar First character in string to include in the sub-string.
519  *@param[in] lastChar Last character in include in the string.
520  *@return Sub-string.
521  */
522  KKStr SubStrPart (kkint32 firstChar,
523  kkint32 lastChar
524  ) const;
525 
526  KKStr Tail (kkint32 tailLen) const; /**< Return back the last 'tailLen' characters. */
527 
528 
529  bool ToBool () const; /**< @brief Returns the bool equivalent of the string, ex 'Yes' = true, 'No' = false, 'True' = true, etc. */
530  double ToDouble () const;
531  float ToFloat () const;
532  kkint32 ToInt () const;
533  kkint16 ToInt16 () const;
534  kkint32 ToInt32 () const;
535  kkint64 ToInt64 () const;
536  double ToLatitude () const; /**< @brief Processes string as if a standard latitude; ex: "15:32.2S" = -15.53833. */
537  double ToLongitude () const; /**< @brief Processes string as if a standard longitude; ex: "95:32.2E" = 95.53833. */
538  long ToLong () const;
539  float ToPercentage () const;
540  KKStr ToQuotedStr () const {return QuotedStr ();}
541  kkuint32 ToUint () const;
542  ulong ToUlong () const;
543  kkuint32 ToUint32 () const;
544  kkuint64 ToUint64 () const;
545 
546  VectorInt32* ToVectorInt32 () const;
547 
548  wchar_t* ToWchar_t () const;
549 
550  KKStr& Trim (const char* whiteSpaceChars = "\n\r\t ");
551 
552  void TrimLeft (const char* whiteSpaceChars = "\n\r\t ");
553 
554  KKStr& TrimRight (const char* whiteSpaceChars = "\n\r\t ");
555 
556  void TrimRightChar ();
557 
558  KKStr ToLower () const;
559 
560  KKStrPtr ToKKStrPtr () const; /**< Instatiates a new instance of KKStr with Allocated optimized for current string length. */
561 
562  KKStr ToUpper () const;
563 
564  KKStr ToXmlStr () const;
565 
566  void Upper ();
567 
568  bool ValidInt (kkint32& value); /**< returns true if KKStr is formated as a valid integer otherwise false.
569  *@param[out] value of string as interpreted as a integer.
570  */
571 
572  bool ValidMoney (float& value) const;
573 
574 
575  bool ValidNum (double& value) const; /**< Returns true if String is a valid number, ex 1.0 or -3.123, etc */
576 
577 
578  void WriteXML (const KKStr& varName,
579  std::ostream& o
580  ) const;
581 
582 
583  //std::string methods.
584  // These methods are provided for people who are familiar with the stl version of string.
585  const char* c_str () {return Str ();}
586 
587  const char* data () {return Str ();}
588 
589  /**@todo Want to implement all the methods that the std::string class implements
590  *this way people who are familiar with the std::string class will find using
591  *this class easier.
592  */
593 
594  ///<summary> Will return the position where the 1st instance of 'str' after 'pos' occurs or -1 if not found. </summary>
595  ///<param name='str'> String that you are searching for. </param>
596  ///<param name='pos'> The starting position to start the search from. </param>
597  ///<returns> The index where 'str' first occurs at or after 'pos' otherwise -1 if not found. </returns>
598  kkint32 Find (const KKStr& str, kkint32 pos = 0) const;
599 
600  kkint32 Find (const char* s, kkint32 pos, kkint32 n) const;
601  kkint32 Find (const char* s, kkint32 pos = 0 ) const;
602  kkint32 Find (char c, kkint32 pos = 0 ) const;
603 
604 
605  /*
606  size_t Find_First_Of (const string& str, size_t pos = 0 ) const;
607  size_t Find_First_Of (const char* s, size_t pos, size_t n ) const;
608  size_t Find_First_Of (const char* s, size_t pos = 0 ) const;
609  size_t Find_First_Of (char c, size_t pos = 0 ) const;
610 
611  size_t find_last_of (const string& str, size_t pos = npos ) const;
612  size_t find_last_of (const char* s, size_t pos, size_t n ) const;
613  size_t find_last_of (const char* s, size_t pos = npos ) const;
614  size_t find_last_of (char c, size_t pos = npos ) const;
615 
616 
617  size_t find_first_not_of (const string& str, size_t pos = 0 ) const;
618  size_t find_first_not_of (const char* s, size_t pos, size_t n ) const;
619  size_t find_first_not_of (const char* s, size_t pos = 0 ) const;
620  size_t find_first_not_of (char c, size_t pos = 0 ) const;
621 
622 
623  size_t find_last_not_of (const string& str, size_t pos = npos ) const;
624  size_t find_last_not_of (const char* s, size_t pos, size_t n ) const;
625  size_t find_last_not_of (const char* s, size_t pos = npos ) const;
626  size_t find_last_not_of (char c, size_t pos = npos ) const;
627 
628  string substr (size_t pos = 0, size_t n = npos ) const;
629 
630  kkint32 compare (const string& str) const;
631  kkint32 compare ( const char* s ) const;
632  kkint32 compare ( size_t pos1, size_t n1, const string& str ) const;
633  kkint32 compare ( size_t pos1, size_t n1, const char* s) const;
634  kkint32 compare ( size_t pos1, size_t n1, const string& str, size_t pos2, size_t n2 ) const;
635  kkint32 compare ( size_t pos1, size_t n1, const char* s, size_t n2) const;
636  */
637 
638 
639 
640 
641  ///<summary>
642  /// Pads the string with spaces so that it is exactly 'width' characters long.
643  /// Can pad either left, right, or center as specified by 'dir'. If KKStr Already greater than 'width' will truncate new string.
644  ///</summary>
645  ///<param name='width'> Width of KKStr; will pad KKStr with spaces until it is width long. </param>
646  ///<param name='dir'>Direction to pad from 'L' - Pad on the left side, 'R' - Pad on the right side, and
647  /// 'C' - Pad on left and Right so that text is centered.</param>
648  KKStr Wide (kkint32 width, char dir = 'R') const;
649 
650 
651  char operator[] (kkint16 i) const; /**< Returns back the character at position 'i', if i > length of KKStr then returns back 0. */
652  char operator[] (kkuint16 i) const; /**< Returns back the character at position 'i', if i > length of KKStr then returns back 0. */
653  char operator[] (kkint32 i) const; /**< Returns back the character at position 'i', if i > length of KKStr then returns back 0. */
654  char operator[] (kkuint32 i) const; /**< Returns back the character at position 'i', if i > length of KKStr then returns back 0. */
655 
656 
657  KKStr operator+ (const char* right) const;
658  KKStr operator+ (const KKStr& right) const;
659  KKStr operator+ (kkint16 right) const;
660  KKStr operator+ (kkuint16 right) const;
661  KKStr operator+ (kkint32 right) const;
662  KKStr operator+ (kkuint32 right) const;
663  KKStr operator+ (kkint64 right) const;
664  KKStr operator+ (kkuint64 right) const;
665  KKStr operator+ (float right) const;
666  KKStr operator+ (double right) const;
667 
668  KKStr& operator<< (const char* right);
669  KKStr& operator<< (const KKStr& right);
670  KKStr& operator<< (KKStr&& right);
671  KKStr& operator<< (char right);
672  KKStr& operator<< (kkint16 right);
673  KKStr& operator<< (kkuint16 right);
674  KKStr& operator<< (kkint32 right);
675  KKStr& operator<< (kkuint32 right);
676  KKStr& operator<< (kkint64 right);
677  KKStr& operator<< (kkuint64 right);
678  KKStr& operator<< (float right);
679  KKStr& operator<< (double right);
680 
681  KKStr& operator+= (const char* right) {return *this << right;}
682  KKStr& operator+= (const KKStr& right) {return *this << right;}
683  KKStr& operator+= (kkint16 right) {return *this << right;}
684  KKStr& operator+= (kkuint16 right) {return *this << right;}
685  KKStr& operator+= (kkint32 right) {return *this << right;}
686  KKStr& operator+= (kkuint32 right) {return *this << right;}
687  KKStr& operator+= (kkint64 right) {return *this << right;}
688  KKStr& operator+= (kkuint64 right) {return *this << right;}
689  KKStr& operator+= (float right) {return *this << right;}
690  KKStr& operator+= (double right) {return *this << right;}
691 
692 
693  //friend KKB::KKStr& endl (KKStr& _s);
694  KKStr& operator<< (std::ostream& (* mf)(std::ostream &));
695 
696 
697 
698  private:
699  void AllocateStrSpace (kkuint32 size);
700 
701  void GrowAllocatedStrSpace (kkuint32 newAllocatedSize);
702 
703  void ValidateLen () const;
704 
705  public:
707  {
708  public:
710  bool operator () (const KKStr& s1,
711  const KKStr& s2
712  );
713  }; /* LessCaseInsensitiveOperator */
714  }; /* KKStr */
715 
716 
717  typedef KKStr::KKStrPtr KKStrPtr;
718  typedef KKStr::KKStrConstPtr KKStrConstPtr;
719  typedef std::pair<KKStr,KKStr> KKStrPair;
720 
721 
722  KKStr operator+ (const char left, const KKStr& right);
723  KKStr operator+ (const char* left, const KKStr& right);
724 
725 
726 
727  #ifdef WIN32
728  std::ostream& __cdecl operator<< ( std::ostream& os,
729  const KKStr& str
730  );
731 
732  std::istream& __cdecl operator>> (std::istream& is,
733  KKStr& str
734  );
735 
736  #else
737 
738  std::ostream& operator<< ( std::ostream& os,
739  const KKStr& str
740  );
741 
742  std::istream& operator>> (std::istream& os,
743  KKStr& str
744  );
745  #endif
746 
747 
748  char* STRCAT (char* dest, kkint32 destSize, const char* src);
749  char* STRCOPY (char* dest, kkint32 destSize, const char* src);
750  char* STRCOPY (char* dest, kkuint16 destSize, const char* src);
751 
752  char* STRDUP (const char* src);
753 
754 
755  kkint32 STRICMP (const char* left, const char* right);
756  kkint32 STRNICMP (const char* left, const char* right, kkint32 len);
757 
758  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkint16 right);
759  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkuint16 right);
760  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkint32 right);
761  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkuint32 right);
762  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkint64 right);
763  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkuint64 right);
764  kkint32 SPRINTF (char* buff, kkint32 buffSize, const char* formatSpec, kkint32 precision, double d );
765  kkint32 SPRINTF (char* buff, kkint32 buffSize, char const* formatSpec, double d);
766 
767 
768 
769 
770  class KKStrList: public KKQueue<KKStr>
771  {
772  public:
774 
775  KKStrList ();
776 
777  KKStrList (bool owner);
778 
779 
780 
781  ///<summary>
782  /// Creates a list from a array of NULL terminated strings; the last entry in the list has to be NULL.
783  /// <code>
784  /// Example:
785  /// const char* zed[] = {"This", "is", "a", "test", NULL};
786  /// KKStrList wordList (zed);
787  /// </code>
788  ///</summary>
789  KKStrList (const char* s[]);
790 
791 
792  void AddString (KKStrPtr str);
793 
794  KKStrPtr BinarySearch (const KKStr& searchStr);
795 
797 
799 
800  void Sort (bool _reversedOrder);
801 
802  bool StringInList (KKStr& str);
803 
804 
805  void ReadXML (XmlStream& s,
806  XmlTagConstPtr tag,
807  VolConstBool& cancelFlag,
808  RunLog& log
809  );
810 
811 
812  void WriteXML (const KKStr& varName,
813  std::ostream& o
814  ) const;
815 
816  static
818  const char* delChars = ",\t\n\r"
819  );
820 
821  private:
822  bool sorted; /**< true indicates that contents of list are sorted in order. */
823 
824  class StringComparison;
825  }; /* KKStrList */
826 
827  typedef KKStrList::KKStrListPtr KKStrListPtr;
828  typedef KKStrList::KKStrListPtr StringListPtr; /**< For comparability with previous version. */
829 
830 
831 
832 
833 
834  ///<summary> Maintains a list of ordered KKStr instances that can be recalled by either string of index. </summary>
836  {
837  public:
838  KKStrListIndexed ();
839 
840  KKStrListIndexed (bool _owner,
841  bool _caseSensitive
842  );
843 
844  KKStrListIndexed (const KKStrListIndexed& list);
845 
846  ~KKStrListIndexed ();
847 
848  ///<summary>Note that if 'owner' flag s set to true will take ownership of the strings added to index.</summary>
849  ///<param name='s'> Will add 's' into the u=index unless another string with the same value already exists. </param>
850  ///<returns> The index assigned to 's' or -1 if 's' is a duplicate of one already in the list. </returns>
851  kkint32 Add (KKStrPtr s);
852 
853  // /**
854  // *@param[in] s Will add a new instance of 's' to the index unless one with the same value already exists.
855  // *@returns The index assigned to 's' or -1 if 's' is a duplicate of one already in the list.
856  // */
857  // kkint32 Add (const KKStr& s);
858 
859  bool CaseSensative () const {return caseSensative;}
860 
861  kkint32 Delete (KKStr& s);
862 
863  void DeleteContents ();
864 
865  kkint32 LookUp (const KKStr& s) const;
866 
867  kkint32 LookUp (KKStrPtr s) const;
868 
869  KKStrConstPtr LookUp (kkuint32 x) const;
870 
872 
873  void ReadXML (XmlStream& s,
874  XmlTagConstPtr tag,
875  VolConstBool& cancelFlag,
876  RunLog& log
877  );
878 
879 
880  kkuint32 size () const;
881 
882  KKStr ToTabDelString () const; /**< Strings will be separated by tab(\t) characters and in order of index. */
883 
884  void WriteXML (const KKStr& varName,
885  std::ostream& o
886  ) const;
887 
888  bool operator== (const KKStrListIndexed& right);
889 
890  bool operator!= (const KKStrListIndexed& right);
891 
892  private:
893  class KKStrPtrComp
894  {
895  public:
896  KKStrPtrComp (bool _caseSensitive);
897  KKStrPtrComp (const KKStrPtrComp& comparator);
898  bool operator() (const KKStrConstPtr& lhs, const KKStrConstPtr& rhs) const;
899  bool caseSensitive;
900  };
901 
902  typedef std::map<KKStrPtr, kkint32, KKStrPtrComp> StrIndex;
903  typedef std::pair<KKStrPtr,kkint32> StrIndexPair;
904 
905  typedef std::map<kkint32, KKStrPtr const> IndexIndex;
906  typedef std::pair<kkint32, KKStrPtr const> IndexIndexPair;
907 
908  bool caseSensative;
909  KKStrPtrComp comparator;
910  IndexIndex indexIndex;
911  kkint32 memoryConsumedEstimated;
912  kkint32 nextIndex;
913  bool owner;
914  StrIndex* strIndex;
915  }; /* KKStrListIndexed */
916 
917 
918 
919 
920  KKStr StrFormatDouble (double val,
921  const char* mask
922  );
923 
925  const char* mask
926  );
927 
929  const char* mask
930  );
931 
932 
939  KKStr StrFromFloat (float f);
940  KKStr StrFromDouble (double d);
941 
942 } /* namespace KKB; */
943 
944 #endif
__int16 kkint16
16 bit signed integer.
Definition: KKBaseTypes.h:85
kkint32 Add(KKStrPtr s)
Definition: KKStr.cpp:5506
KKStr(kkint32 size)
Creates a KKStr object that pre-allocates space for &#39;size&#39; characters.
Definition: KKStr.cpp:655
KKStr StrFromFloat(float f)
Definition: KKStr.cpp:5219
KKStr Wide(kkint32 width, char dir= 'R') const
Pads the string with spaces so that it is exactly &#39;width&#39; characters long. Can pad either left...
Definition: KKStr.cpp:2203
VectorKKStr Split(const char *delStr="\n\r\t, ") const
Breaks up the contents of the string into tokens where the characters in &#39;delStr&#39; acts as separates e...
Definition: KKStr.cpp:3480
void AppendInt32(kkint32 i)
Definition: KKStr.cpp:1901
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint16 right)
Definition: KKStr.cpp:177
char * STRDUP(const char *src)
Definition: KKStr.cpp:62
char operator[](kkint16 i) const
Definition: KKStr.cpp:3379
KKStr & Trim(const char *whiteSpaceChars="\n\r\t ")
Definition: KKStr.cpp:1686
KKStr(KKStr &&str)
Definition: KKStr.cpp:599
KKStr * KKStrPtr
Definition: KKStr.h:83
KKStr(const std::string &s)
Definition: KKStr.cpp:677
bool EqualIgnoreCase(const char *s2) const
Definition: KKStr.cpp:1257
KKStr StrFormatInt64(kkint64 val, const char *mask)
Definition: KKStr.cpp:5013
KKStr & operator+=(const KKStr &right)
Definition: KKStr.h:682
void Append(const char *buff, kkuint32 buffLen)
Definition: KKStr.cpp:1821
kkint32 CompareIgnoreCase(const KKStr &s2) const
Compares with another KKStr, ignoring case.
Definition: KKStr.cpp:919
static bool StrEqualNoCase(const char *s1, const char *s2)
Definition: KKStr.cpp:408
kkint32 MemoryConsumedEstimated() const
Definition: KKStr.cpp:766
__int32 kkint32
Definition: KKBaseTypes.h:88
KKStrList::KKStrListPtr StringListPtr
summary> Maintains a list of ordered KKStr instances that can be recalled by either string of index...
Definition: KKStr.h:828
KKStr GetNextToken2(const char *delStr="\n\t\r ") const
Retrieves the first token in the string without removing any characters.
Definition: KKStr.cpp:3089
kkint32 Find(char c, kkint32 pos=0) const
Definition: KKStr.cpp:3952
wchar_t * ToWchar_t() const
Definition: KKStr.cpp:3703
KKStr operator+(kkuint16 right) const
Definition: KKStr.cpp:4022
kkint32 CountInstancesOf(char ch) const
Definition: KKStr.cpp:1122
KKStr StrFromInt64(kkint64 i)
Definition: KKStr.cpp:5198
KKStr & operator+=(kkuint16 right)
Definition: KKStr.h:684
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
Definition: KKStr.cpp:4438
bool CharInStr(char ch)
Definition: KKStr.cpp:2712
kkuint32 ExtractTokenUint(const char *delStr)
Definition: KKStr.cpp:3141
KKStr & TrimRight(const char *whiteSpaceChars="\n\r\t ")
Definition: KKStr.cpp:1695
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 &#39;delStr&#39; separate...
Definition: KKStr.cpp:3461
kkuint32 ToUint32() const
Definition: KKStr.cpp:3652
static bool StrEqual(const char *s1, const char *s2)
Definition: KKStr.cpp:373
KKStr ExtractToken2(const char *delStr="\n\t\r ")
Extract first Token from the string.
Definition: KKStr.cpp:3026
bool operator>=(const KKStr &right) const
Definition: KKStr.cpp:1627
const KKStr * KKStrConstPtr
Definition: KKStr.h:84
void LeftPad(kkint32 width, uchar ch= ' ')
pads the string with enough &#39;ch&#39; characters on the left side until the string is as long as &#39;width&#39; c...
Definition: KKStr.cpp:2303
void Lower()
Make all characters in the String into lower case.
Definition: KKStr.cpp:2482
KKStrConstPtr LookUp(kkuint32 x) const
Definition: KKStr.cpp:5584
bool StringInList(KKStr &str)
Definition: KKStr.cpp:4522
void ChopLastChar()
Definition: KKStr.cpp:1668
KKStr ExtractToken(const char *delStr="\n\t\r ")
Definition: KKStr.cpp:2969
KKStr DecodeQuotedStr() const
Trees this KKSr instance as a QuotedStr; decodes escape sequences such as &#39;\&#39;, &#39;&#39;, &#39; &#39;, &#39;&#39;, and &#39;\0&#39; into original characters.
Definition: KKStr.cpp:3243
KKStr operator+(kkint32 right) const
Definition: KKStr.cpp:4036
kkint32 InstancesOfChar(char ch) const
Definition: KKStr.cpp:2041
char ExtractLastChar()
Removes the last character from the string and returns it to the caller.
Definition: KKStr.cpp:3226
kkint32 LocateStr(const KKStr &searchStr) const
Returns index of 1st occurrence of &#39;searchStr&#39; otherwise -1.
Definition: KKStr.cpp:2091
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint32 right)
Definition: KKStr.cpp:193
KKStr & operator+=(kkint64 right)
Definition: KKStr.h:687
bool operator==(const std::string right) const
Definition: KKStr.cpp:1603
const char * c_str()
Definition: KKStr.h:585
KKStr ToQuotedStr() const
Definition: KKStr.h:540
void TrimRightChar()
Definition: KKStr.cpp:1723
KKStr ToTabDelString() const
Strings will be separated by tab() characters and in order of index.
Definition: KKStr.cpp:5631
bool operator>(const KKStr &right) const
Definition: KKStr.cpp:1619
unsigned __int16 kkuint16
16 bit unsigned integer.
Definition: KKBaseTypes.h:86
KKStr operator+(float right) const
Definition: KKStr.cpp:4092
KKStr & operator=(const char *src)
Definition: KKStr.cpp:1442
bool EndsWith(const KKStr &value, bool ignoreCase)
Definition: KKStr.cpp:1204
kkint32 SPRINTF(char *buff, kkint32 buffSize, char const *formatSpec, double d)
Definition: KKStr.cpp:271
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint32 right)
Definition: KKStr.cpp:208
kkint32 ToInt() const
Definition: KKStr.cpp:3565
kkint32 LocateLastOccurrence(const KKStr &s) const
Returns index of last occurrence of &#39;s&#39; otherwise -1.
Definition: KKStr.cpp:2151
bool operator==(const char *rtStr) const
Definition: KKStr.cpp:1588
char FirstChar() const
Definition: KKStr.cpp:1970
static void StrCapitalize(char *str)
Definition: KKStr.cpp:4375
KKStr StrFromUint32(kkuint32 ui)
Definition: KKStr.cpp:5187
KKStr ToUpper() const
Definition: KKStr.cpp:2517
KKStr & operator+=(kkint32 right)
Definition: KKStr.h:685
static KKStr Concat(const VectorKKStr &values)
Definition: KKStr.cpp:1057
kkuint32 MaxLenSupported() const
Definition: KKStr.cpp:2510
bool operator==(const KKStrListIndexed &right)
Definition: KKStr.cpp:5462
char * STRCOPY(char *dest, kkuint16 destSize, const char *src)
Definition: KKStr.cpp:31
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint32 precision, double d)
Definition: KKStr.cpp:255
kkint32 STRICMP(const char *left, const char *right)
Definition: KKStr.cpp:92
kkint64 ToInt64() const
Definition: KKStr.cpp:3598
KKStr & operator+=(double right)
Definition: KKStr.h:690
static const char * Str(const char *s)
Definition: KKStr.cpp:286
std::istream &__cdecl operator>>(std::istream &is, KKStr &str)
Definition: KKStr.cpp:4287
KKStr operator+(const char *right) const
Definition: KKStr.cpp:3986
bool EqualIgnoreCase(const KKStr &s2) const
Definition: KKStr.cpp:1250
kkint32 CompareIgnoreCase(const std::string &s2) const
Definition: KKStr.cpp:998
KKStr operator+(kkuint64 right) const
Definition: KKStr.cpp:4078
unsigned __int32 kkuint32
Definition: KKBaseTypes.h:89
bool EndsWith(const char *value, bool ignoreCase)
Definition: KKStr.cpp:1223
KKStrPtr ToKKStrPtr() const
Definition: KKStr.cpp:2541
kkint16 ToInt16() const
Definition: KKStr.cpp:3576
bool ValidNum(double &value) const
Definition: KKStr.cpp:2653
kkint32 MemoryConsumedEstimated() const
Definition: KKStr.cpp:5454
char * STRCAT(char *dest, kkint32 destSize, const char *src)
Definition: KKStr.cpp:74
KKStr & operator+=(float right)
Definition: KKStr.h:689
__int64 kkint64
Definition: KKBaseTypes.h:90
char operator[](kkuint32 i) const
Definition: KKStr.cpp:3430
KKStrList(const char *s[])
Definition: KKStr.cpp:4493
bool operator()(const KKStr &s1, const KKStr &s2)
Definition: KKStr.cpp:501
bool Contains(const char *value)
Definition: KKStr.cpp:1112
KKStr & operator=(KKStr &&src)
Definition: KKStr.cpp:1369
kkint32 Delete(KKStr &s)
Definition: KKStr.cpp:5529
bool operator!=(const char *rtStr) const
Definition: KKStr.cpp:1596
bool operator<=(const KKStr &right) const
Definition: KKStr.cpp:1642
static KKStr Concat(const char **values)
Definition: KKStr.cpp:1031
char LastChar() const
Definition: KKStr.cpp:2007
kkuint32 Len() const
Returns the number of characters in the string.
Definition: KKStr.h:366
KKStr StrFromUint16(kkuint16 ui)
Definition: KKStr.cpp:5164
static void MemSet(void *dest, kkuint8 byte, kkuint32 size)
Definition: KKStr.cpp:4362
void StrReplace(char **dest, const char *src)
Replaces the contents of *dest with *src.
Definition: KKStr.cpp:456
KKStr(double d, kkint32 precision)
summary>Constructs a KKStr instance form a stl::string instance.
Definition: KKStr.cpp:617
KKTHread * KKTHreadPtr
KKStr & operator+=(const char *right)
Definition: KKStr.h:681
KKStrPtr BinarySearch(const KKStr &searchStr)
Definition: KKStr.cpp:4607
KKStrListIndexed(bool _owner, bool _caseSensitive)
Definition: KKStr.cpp:5381
void Append(char ch)
Definition: KKStr.cpp:1863
char * STRCOPY(char *dest, kkint32 destSize, const char *src)
Definition: KKStr.cpp:46
KKStr operator+(const char *left, const KKStr &right)
Definition: KKStr.cpp:3976
kkuint32 ToUint() const
Definition: KKStr.cpp:3636
static void StrDelete(char **str)
Definition: KKStr.cpp:296
KKStr operator+(kkuint32 right) const
Definition: KKStr.cpp:4050
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkuint64 right)
Definition: KKStr.cpp:239
double ExtractTokenDouble(const char *delStr)
Definition: KKStr.cpp:3180
void Append(const char *buff)
Definition: KKStr.cpp:1783
bool ExtractTokenBool(const char *delStr)
Extract the next token from the string assuming that it is a logical True/False value.
Definition: KKStr.cpp:3165
void AppendUInt32(kkuint32 i)
Definition: KKStr.cpp:1940
KKStr(const KKStr &str)
Copy Constructor.
Definition: KKStr.cpp:561
kkint32 Compare(const std::string &s2) const
Compares with STL string.
Definition: KKStr.cpp:881
unsigned __int8 kkuint8
Definition: KKBaseTypes.h:84
char EnterStr()
Definition: KKStr.cpp:2394
KKStr Tail(kkint32 tailLen) const
Returns a string consisting of the &#39;tailLen&#39; characters from the end of the string.
Definition: KKStr.cpp:2847
KKStrList * KKStrListPtr
Definition: KKStr.h:773
void TrimLeft(const char *whiteSpaceChars="\n\r\t ")
Definition: KKStr.cpp:1745
double ToLongitude() const
Processes string as if a standard longitude; ex: "95:32.2E" = 95.53833.
Definition: KKStr.cpp:3819
bool Empty() const
Definition: KKStr.h:241
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint16 right)
Definition: KKStr.cpp:162
bool EqualIgnoreCase(const KKStrConstPtr s2) const
Definition: KKStr.cpp:1244
XmlTag const * XmlTagConstPtr
Definition: KKStr.h:45
Manages the reading and writing of objects in a simple XML format. For a class to be supported by Xml...
Definition: XmlStream.h:46
kkint32 Find(const char *s, kkint32 pos=0) const
Definition: KKStr.cpp:3945
KKStr & operator+=(kkuint32 right)
Definition: KKStr.h:686
KKStr SubStrPart(kkint32 firstChar, kkint32 lastChar) const
returns a SubString consisting of all characters starting at index &#39;firstChar&#39; and ending at &#39;lastInd...
Definition: KKStr.cpp:2802
static KKStr Spaces(kkint32 c)
Returns a string of spaces &#39;c&#39; characters long.
Definition: KKStr.cpp:4329
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.
Definition: KKStr.cpp:4714
kkint32 ToInt32() const
Definition: KKStr.cpp:3587
unsigned char uchar
Unsigned character.
Definition: KKBaseTypes.h:77
KKStr StrFromDouble(double d)
Definition: KKStr.cpp:5229
bool StrInStr(const KKStr &searchField) const
Searches for the occurrence of &#39;searchField&#39; and where in the string. If found will return &#39;true&#39; oth...
Definition: KKStr.cpp:2731
bool EndsWith(const char *value)
Definition: KKStr.cpp:1197
kkint32 MemoryConsumedEstimated() const
Definition: KKStr.cpp:4511
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
bool Contains(const KKStr &value)
Definition: KKStr.cpp:1103
void Upper()
Converts all characters in string to their Upper case equivalents via &#39;toupper&#39;.
Definition: KKStr.cpp:2461
kkint32 LocateLastOccurrence(char ch) const
Returns index of last occurrence of &#39;ch&#39; otherwise -1.
Definition: KKStr.cpp:2118
static kkint32 StrCompareIgnoreCase(const char *s1, const char *s2)
Definition: KKStr.cpp:318
std::vector< kkint32 > VectorInt32
Vector of signed 32 bit integers.
Definition: KKBaseTypes.h:144
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
Definition: KKStr.cpp:5595
static bool StrEqualN(const char *s1, const char *s2, kkuint32 len)
Definition: KKStr.cpp:388
KKStr(const char *src, kkuint32 startPos, kkuint32 endPos)
Constructs a KKStr instance from a sub-string of &#39;src&#39;.
Definition: KKStr.cpp:693
kkint32 LocateCharacter(char ch) const
Returns index of 1st occurrence of &#39;ch&#39; otherwise -1.
Definition: KKStr.cpp:2021
static const KKStr & EmptyStr()
Static method that returns an Empty String.
Definition: KKStr.cpp:3453
kkint32 STRNICMP(const char *left, const char *right, kkint32 len)
Definition: KKStr.cpp:126
unsigned long ulong
Unsigned long.
Definition: KKBaseTypes.h:80
kkint32 CompareTo(const KKStr &s2) const
Definition: KKStr.h:184
kkint32 LookUp(KKStrPtr s) const
Definition: KKStr.cpp:5572
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
Definition: KKStr.cpp:4537
bool StartsWith(const char *value) const
Definition: KKStr.cpp:1144
KKStr ExtractQuotedStr(const char *delChars, bool decodeEscapeCharacters)
Definition: KKStr.cpp:3282
bool operator!=(const KKStr &right) const
Definition: KKStr.cpp:1558
long ToLong() const
Definition: KKStr.cpp:3611
char ExtractChar()
Removes the first character from the string and returns it to the caller.
Definition: KKStr.cpp:3197
void Sort(bool _reversedOrder)
Definition: KKStr.cpp:4770
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: KKStr.cpp:5319
bool EndsWith(const KKStr &value)
Definition: KKStr.cpp:1190
unsigned __int64 kkuint64
Definition: KKBaseTypes.h:91
bool operator==(const KKStr &right) const
Definition: KKStr.cpp:1550
void AddString(KKStrPtr str)
Definition: KKStr.cpp:4651
kkint32 Find(const char *s, kkint32 pos, kkint32 n) const
Definition: KKStr.cpp:3938
bool StartsWith(const char *value, bool ignoreCase) const
Definition: KKStr.cpp:1169
KKStr StrFormatInt(kkint32 val, const char *mask)
Definition: KKStr.cpp:5004
KKStr(const char *str)
Definition: KKStr.cpp:537
KKStr & operator+=(kkuint64 right)
Definition: KKStr.h:688
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: KKStr.cpp:4420
double ToDouble() const
Definition: KKStr.cpp:3541
std::ostream &__cdecl operator<<(std::ostream &os, const KKStr &str)
kkint32 ExtractTokenInt(const char *delStr)
Definition: KKStr.cpp:3129
KKStr operator+(const KKStr &right) const
Definition: KKStr.cpp:3998
kkuint64 ExtractTokenUint64(const char *delStr)
Definition: KKStr.cpp:3153
bool StartsWith(const KKStr &value, bool ignoreCase) const
Definition: KKStr.cpp:1150
kkint32 Find(const KKStr &str, kkint32 pos=0) const
Will return the position where the 1st instance of &#39;str&#39; after &#39;pos&#39; occurs or -1 if not found...
Definition: KKStr.cpp:3931
wchar_t * StrWide() const
Definition: KKStr.cpp:1264
KKStr operator+(kkint16 right) const
Definition: KKStr.cpp:4010
static bool StrEqualNoCaseN(const char *s1, const char *s2, kkuint32 len)
Definition: KKStr.cpp:436
const char * Str() const
Returns a pointer to a ascii string.
Definition: KKStr.h:422
KKStr MaxLen(kkuint32 maxLen) const
Definition: KKStr.cpp:2499
void Append(const std::string &str)
Definition: KKStr.cpp:1894
KKStr StrFormatDouble(double val, const char *mask)
Definition: KKStr.cpp:4819
void RightPad(kkint32 width, char ch= ' ')
Pads string on the right side with specified character so that the string will be of specified length...
Definition: KKStr.cpp:2239
kkint32 LocateNthOccurrence(char ch, kkint32 x) const
Definition: KKStr.cpp:2179
void ChopFirstChar()
Definition: KKStr.cpp:1649
KKStr & operator=(kkint32 right)
Definition: KKStr.cpp:1478
bool operator!=(const std::string right) const
Definition: KKStr.cpp:1611
KKStr ToXmlStr() const
Definition: KKStr.cpp:2929
double ToLatitude() const
Processes string as if a standard latitude; ex: "15:32.2S" = -15.53833.
Definition: KKStr.cpp:3725
ulong ToUlong() const
Definition: KKStr.cpp:3644
KKStr operator+(kkint64 right) const
Definition: KKStr.cpp:4064
KKStrList(bool owner)
Definition: KKStr.cpp:4485
static const char * StrChr(const char *str, int ch)
Definition: KKStr.cpp:308
void Append(const KKStr &str)
Definition: KKStr.cpp:1887
char operator[](kkint32 i) const
Definition: KKStr.cpp:3413
static void MemCpy(void *dest, void *src, kkuint32 size)
Definition: KKStr.cpp:4338
KKStr operator+(double right) const
Definition: KKStr.cpp:4107
KKStr & operator=(const KKStr &src)
Definition: KKStr.cpp:1390
bool operator==(KKStrConstPtr right) const
Definition: KKStr.cpp:1566
Used for logging messages.
Definition: RunLog.h:49
kkint32 LookUp(const KKStr &s) const
Definition: KKStr.cpp:5558
bool operator<(const KKStr &right) const
Definition: KKStr.cpp:1635
bool StartsWith(const KKStr &value) const
Definition: KKStr.cpp:1137
KKStr StrFromInt16(kkint16 i)
Definition: KKStr.cpp:5152
bool CaseSensative() const
Definition: KKStr.h:859
float ToPercentage() const
Definition: KKStr.cpp:3623
KKStrListIndexed(const KKStrListIndexed &list)
Definition: KKStr.cpp:5397
void FreeUpUnUsedSpace()
Definition: KKStr.cpp:1980
kkint32 Compare(const KKStr &s2) const
Definition: KKStr.cpp:844
const char * data()
Definition: KKStr.h:587
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: KKStr.cpp:4577
static KKStrListPtr ParseDelimitedString(const KKStr &str, const char *delChars=",\t\n\r")
Definition: KKStr.cpp:4659
float ToFloat() const
Definition: KKStr.cpp:3553
void ReadXML(XmlStream &s, XmlTagConstPtr tag, VolConstBool &cancelFlag, RunLog &log)
Definition: KKStr.cpp:5277
bool operator!=(const KKStrListIndexed &right)
Definition: KKStr.cpp:5499
kkint32 SPRINTF(char *buff, kkint32 buffSize, const char *formatSpec, kkint64 right)
Definition: KKStr.cpp:223
VectorKKStr Split(char del) const
Splits the string up into tokens using &#39;del&#39; as the separator returning them in a vector...
Definition: KKStr.cpp:3500
bool ToBool() const
Returns the bool equivalent of the string, ex &#39;Yes&#39; = true, &#39;No&#39; = false, &#39;True&#39; = true...
Definition: KKStr.cpp:3523
void LopOff(kkint32 lastCharPos)
Trims off all characters after the &#39;lastCharPos&#39; index; to make an empty string you would have to spe...
Definition: KKStr.cpp:2866
bool ValidInt(kkint32 &value)
Definition: KKStr.cpp:2548
VectorInt32 * ToVectorInt32() const
Definition: KKStr.cpp:3671
kkuint32 size() const
Definition: KKStr.cpp:5447
void WriteXML(const KKStr &varName, std::ostream &o) const
Definition: KKStr.cpp:5645
kkuint64 ToUint64() const
Definition: KKStr.cpp:3660
KKStr StrFromUint64(kkuint64 ui)
Definition: KKStr.cpp:5209
KKStr SubStrPart(kkint32 firstChar) const
returns a SubString consisting of all characters starting at index &#39;firstChar&#39; until the end of the s...
Definition: KKStr.cpp:2780
kkint32 CompareIgnoreCase(const char *s2) const
summary>Compares to Strings and returns -1, 0, or 1, indicating if less than, equal, or greater.
Definition: KKStr.cpp:955
char operator[](kkuint16 i) const
Definition: KKStr.cpp:3396
bool ValidMoney(float &value) const
Definition: KKStr.cpp:2594
bool operator!=(KKStrConstPtr right) const
Definition: KKStr.cpp:1577
KKStr QuotedStr() const
Returns a quoted version of string where special characters Line-Feed, Carriage Return, and Tab, are encoded as escape sequences.
Definition: KKStr.cpp:2890
VectorKKStr(const VectorKKStr &v)
Definition: KKStr.cpp:5270
KKStr & operator+=(kkint16 right)
Definition: KKStr.h:683
std::pair< KKStr, KKStr > KKStrPair
Definition: KKStr.h:719
KKStr ToLower() const
Definition: KKStr.cpp:2529
KKStr StrFromInt32(kkint32 i)
Definition: KKStr.cpp:5175
KKStr operator+(const char left, const KKStr &right)
Definition: KKStr.cpp:3964
volatile const bool VolConstBool
Definition: KKBaseTypes.h:163
static bool StrInStr(const char *target, const char *searchStr)
Definition: KKStr.cpp:4391
KKStrListPtr DuplicateListAndContents() const
Definition: KKStr.cpp:4779