commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
String.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2006-2014 Raphael David / CANTOR
3 //
4 
5 #ifndef CMR_STRING_INCLUDED
6 #define CMR_STRING_INCLUDED
7 
8 #include <string.h>
9 #include "Commore.h"
10 
11 namespace commore
12 {
13  class AString;
14 
18  struct RawString
19  {
23  size_t size;
27  size_t capacity;
31  Char data[4];
32  };
34 
40  class CMREXD String
41  {
42  friend class Iterator;
43 
44  public:
45  class Allocator
46  {
47  public:
48  virtual ~Allocator() {}
49  virtual PRawString allocate(size_t size) = 0;
50  virtual PRawString reallocate(PRawString p, size_t size) = 0;
51 
52  virtual void release(PRawString p) = 0;
53  virtual void assign(PRawString& dest, PRawString src) = 0;
54  };
56 
57  public:
58  typedef Char value_type;
59  typedef size_t size_type;
60  typedef Char& reference;
61  typedef const Char& const_reference;
62  typedef Char* pointer;
63  typedef const Char* const_pointer;
64 
65  enum { STRING_INCREMENT_SIZE = 16 };
66 
67  public:
68  String();
69  String(const String& str);
76  String(const String& str, size_t pos, size_t n = (size_t)npos);
82  String(const Char* str, size_t n);
87  String(const Char* str);
93  String(const AChar* str, size_t n);
98  String(const AChar* str);
105  String(size_t n, Char c);
106  String& operator = (const String& str) { return assign(str); }
107 
112  String& operator = (const AChar* str) { return assign(str); }
117  String& operator = (const Char* str) { return assign(str); }
122  String& operator = (Char c) { assign_helper(c, 1); return *this; }
123  ~String();
124 
125  public:
129  bool operator == (const AChar* str) const { return compare(str) == 0; }
133  bool operator == (const String& str) const { return compare(str) == 0; }
137  bool operator == (const Char* str) const { return compare(str) == 0; }
141  bool operator != (const AChar* str) const { return !compare(str) == 0; }
145  bool operator != (const String& str) const { return !compare(str) == 0; }
149  bool operator != (const Char* str) const { return !compare(str) == 0; }
153  String& operator += (const String& str) { return append(str); }
157  inline String operator + (const String& str) const;
158 
162  String& operator += (const Char* str) { return append(str); }
166  String& operator += (const AChar* str) { return append(str); }
170  String& operator += (Char c) { append_helper(c, 1); return *this; }
174  String& operator += (AChar c) { append_helper(c, 1); return *this; }
175 
179  inline bool operator < (const String& s) const;
183  inline bool operator > (const String& s) const;
184 
185 
189  String& append(const String& str)
190  {
191  append_helper(str, 0, (size_t)npos);
192  return *this;
193  }
194 
201  String& append(const String& str, size_t pos, size_t n)
202  {
203  append_helper(str, pos, n);
204  return *this;
205  }
211  String& append(const Char* str, size_t n)
212  {
213  append_helper(str, n);
214  return *this;
215  }
221  String& append(const AChar* str, size_t n)
222  {
223  append_helper(str, n);
224  return *this;
225  }
230  String& append(const Char* str)
231  {
232  append_helper(str, length(str));
233  return *this;
234  }
239  String& append(const AChar* str)
240  {
241  append_helper(str, length(str));
242  return *this;
243  }
244 
250  String& append(size_t n, Char c)
251  {
252  append_helper(c, n);
253  return *this;
254  }
255 
263  bool validate_range(size_t pos, size_t* len) const
264  {
265  size_t s = size();
266  if (pos > s)
267  {
268  *len = 0;
269  // ERROR OUT OF RANGE
270  return false;
271  }
272  if (*len > (s - pos))
273  {
274  *len = s - pos; // Clamp to actual length.
275  return false;
276  }
277  return true;
278  }
282  String& assign(const String& other);
286  String& assign(const String& str, size_t pos, size_t n)
287  {
288  if (str.validate_range(pos, &n))
289  {
290  assign_helper(str.data_->data + pos, n);
291  }
292  return *this;
293  }
297  String& assign(const Char* str, size_t n)
298  {
299  assign_helper(str, n);
300  return *this;
301  }
305  String& assign(const Char* str)
306  {
307  assign_helper(str, length(str));
308  return *this;
309  }
313  String& assign(size_t n, Char c)
314  {
315  assign_helper(c, n);
316  return *this;
317  }
321  String& assign(const AChar* str, size_t n)
322  {
323  assign_helper(str, n);
324  return *this;
325  }
329  String& assign(const AChar* str)
330  {
331  assign_helper(str, length(str));
332  return *this;
333  }
337  String& assign(size_t n, AChar c)
338  {
339  assign_helper(c, n);
340  return *this;
341  }
342 
346  void swap(String& str);
350  void splice(String& str);
351 
357  String& insert(size_t pos1, const String& str)
358  {
359  replace_helper(pos1, 0, str, 0, (size_t)npos);
360  return *this;
361  }
369  String& insert(size_t pos1, const String& str, size_t pos2, size_t n)
370  {
371  replace_helper(pos1, 0, str, pos2, n);
372  return *this;
373  }
380  String& insert(size_t pos, const Char* str, size_t n)
381  {
382  replace_helper(pos, 0, str, n);
383  return *this;
384  }
390  String& insert(size_t pos, const Char* str)
391  {
392  replace_helper(pos, 0, str, length(str));
393  return *this;
394  }
401  String& insert(size_t pos, size_t n, Char c)
402  {
403  replace_helper(pos, 0, c, n);
404  return *this;
405  }
406 
411  {
412  init();
413  return *this;
414  }
415 
421  String& erase(size_t pos = 0, size_t n = (size_t)npos)
422  {
423  replace_helper(pos, n, (const Char*)0, 0);
424  return *this;
425  }
426 
433  String& replace(size_t pos1, size_t n1, const String& str)
434  {
435  replace_helper(pos1, n1, str, 0, str.size());
436  return *this;
437  }
438 
447  String& replace(size_t pos1, size_t n1, const String& str, size_t pos2, size_t n2)
448  {
449  replace_helper(pos1, n1, str, pos2, n2);
450  return *this;
451  }
459  String& replace(size_t pos, size_t n1, const Char* str, size_t n2)
460  {
461  replace_helper(pos, n1, str, n2);
462  return *this;
463  }
470  String& replace(size_t pos, size_t n1, const Char* str)
471  {
472  replace_helper(pos, n1, str, length(str));
473  return *this;
474  }
482  String& replace(size_t pos, size_t n1, size_t n2, Char c)
483  {
484  replace_helper(pos, n1, c, n2);
485  return *this;
486  }
487 
492  Char operator[](size_t pos) const
493  {
494  return pos == size() ? eos() : get_at(pos);
495  }
496 
501  Char& operator[](size_t pos)
502  {
503  if (pos < size())
504  {
505  return *(data_->data + pos);
506  }
507  else
508  {
509  return *((Char*)0);
510  }
511  }
512 
516  Char at(size_t pos) const
517  {
518  return get_at(pos);
519  }
520 
524  Char& at(size_t pos)
525  {
526  return operator[](pos);
527  }
533  const Char* c_str() const
534  {
535  return data_ ? data_->data : nil_data();
536  }
540  operator const Char* () const
541  {
542  return c_str();
543  }
547  const Char* data() const
548  {
549  return data_ ? data_->data : nil_data();
550  }
554  const PAllocator& get_allocator() const
555  {
556  return allocator_;
557  }
558 
562  size_t length() const
563  {
564  return data_->size;
565  }
569  size_t size() const
570  {
571  return data_->size;
572  }
576  size_t max_size() const
577  {
578  return (size_t)npos - 1;
579  }
583  bool empty() const
584  {
585  return size() == 0;
586  }
587 
591  void resize(size_t n, Char c)
592  {
593  resize_helper(n, c);
594  }
598  void resize(size_t n)
599  {
600  resize(n, eos());
601  }
605  size_t capacity() const
606  {
607  return data_->capacity;
608  }
609 
613  void reserve(size_t size)
614  {
615  reserve_helper(size);
616  }
617 
618 
628  size_t copy(Char* str, size_t n, size_t pos = 0) const
629  {
630  if (validate_range(pos, &n))
631  {
632  copy(str, data_->data + pos, n);
633  }
634  return n;
635  }
636 
655  size_t find(const String& str, size_t pos = 0) const
656  {
657  return find(str.data(), pos, str.size());
658  }
659  size_t find(const Char* s, size_t pos, size_t n) const;
660  size_t find(const Char* str, size_t pos = 0) const
661  {
662  return find(str, pos, length(str));
663  }
664  size_t find(Char c, size_t pos = 0) const
665  {
666  return find(&c, pos, 1);
667  }
668  size_t find_first_of(const String& str, size_t pos = 0) const
669  {
670  return find_first_of(str.data(), pos, str.size());
671  }
672  size_t find_first_of(const Char* s, size_t pos, size_t n) const;
673  size_t find_first_of(const Char* str, size_t pos = 0) const
674  {
675  return find_first_of(str, pos, length(str));
676  }
677  size_t find_first_of(Char c, size_t pos = 0) const
678  {
679  return find_first_of(&c, pos, 1);
680  }
681  size_t find_first_not_of(const String& str, size_t pos = 0) const
682  {
683  return find_first_not_of(str.data(), pos, str.size());
684  }
685  size_t find_first_not_of(const Char* s, size_t pos, size_t n) const;
686  size_t find_first_not_of(Char c, size_t pos = 0) const
687  {
688  return find_first_not_of(&c, pos, 1);
689  }
690  size_t find_first_not_of(const Char* str, size_t pos = 0) const
691  {
692  return find_first_not_of(str, pos, length(str));
693  }
694  size_t rfind(const Char* str, size_t pos, size_t n) const;
695  size_t find_last_of(const Char* s, size_t pos, size_t n) const;
696  size_t find_last_not_of(const Char* s, size_t pos, size_t n) const;
697  size_t rfind(const String& str, size_t pos = (size_t)npos) const
698  {
699  return rfind(str.data(), pos, str.size());
700  }
701  size_t rfind(const Char* str, size_t pos = (size_t)npos) const
702  {
703  return rfind(str, pos, length(str));
704  }
705  size_t rfind(Char c, size_t pos = (size_t)npos) const
706  {
707  return rfind(&c, pos, 1);
708  }
709  size_t find_last_of(const String& str, size_t pos = (size_t)npos) const
710  {
711  return find_last_of(str.data(), pos, str.size());
712  }
713  size_t find_last_of(Char c, size_t pos = (size_t)npos) const
714  {
715  return find_last_of(&c, pos, 1);
716  }
717  size_t find_last_of(const Char* str, size_t pos = (size_t)npos) const
718  {
719  return find_last_of(str, pos, length(str));
720  }
721  size_t find_last_not_of(const String& str, size_t pos = (size_t)npos) const
722  {
723  return find_last_not_of(str.data(), pos, str.size());
724  }
725  size_t find_last_not_of(const Char& c, size_t pos = (size_t)npos) const
726  {
727  return find_last_not_of(&c, pos, 1);
728  }
729  size_t find_last_not_of(const Char* str, size_t pos = (size_t)npos) const
730  {
731  return find_last_not_of(str, pos, length(str));
732  }
733  String substr(size_t pos = 0, size_t n = (size_t)npos) const;
734  int compare(const String& str) const
735  {
736  return compare_helper(str, 0, (size_t)npos);
737  }
738  int compare(size_t pos, size_t n, const String& str) const
739  {
740  return compare_helper(str, pos, n);
741  }
742  int compare(size_t pos1, size_t n1, const String& str, size_t pos2, size_t n2) const
743  {
744  String temp(str, pos2, n2);
745  return compare_helper(temp, pos1, n1);
746  }
747  int compare(const Char* s) const
748  {
749  return compare_helper(s, 0, length(s));
750  }
751  int compare(const AChar* s) const
752  {
753  return compare_helper(s, 0, length(s));
754  }
755  int compare(size_t pos, size_t n1, const Char* str, size_t n2 = (size_t)npos) const;
756 
757  int icompare(const String& str) const
758  {
759  return icompare_helper(str, 0, (size_t)npos);
760  }
761  int icompare(size_t pos, size_t n, const String& str) const
762  {
763  return icompare_helper(str, pos, n);
764  }
765  int icompare(size_t pos1, size_t n1, const String& str, size_t pos2, size_t n2) const
766  {
767  String temp(str, pos2, n2);
768  return icompare_helper(temp, pos1, n1);
769  }
770  int icompare(const Char* s) const
771  {
772  return icompare_helper(s, 0, length(s));
773  }
774  int icompare(const AChar* s) const
775  {
776  return icompare_helper(s, 0, length(s));
777  }
778  int icompare(size_t pos, size_t n1, const Char* str, size_t n2 = (size_t)npos) const;
779 
780  Int to_int() const;
781  String& make_upper();
782  String& make_lower();
783  bool match(const String& pattern,
784  String& a0) const;
785  bool match(const String& pattern,
786  String& a0, String& a1) const;
787  bool match(const String& pattern,
788  String& a0, String& a1, String& a2) const;
789  bool match(const String& pattern,
790  String& a0, String& a1, String& a2, String& a3) const;
791  bool match(const String& pattern,
792  String& a0, String& a1, String& a2,
793  String& a3, String& a4) const;
794  bool match(const String& pattern,
795  String& a0, String& a1, String& a2,
796  String& a3, String& a4, String& a5) const;
797  bool match(const String& pattern,
798  String& a0, String& a1, String& a2,
799  String& a3, String& a4, String& a5,
800  String& a6) const;
801  bool match(const String& pattern,
802  String& a0, String& a1, String& a2,
803  String& a3, String& a4, String& a5,
804  String& a6, String& a7) const;
805  long write_xml(OBStream& o) const;
806  long write(CommBuffer& buffer) const;
807  long read_xml(IBStream& i);
808  long read(const CommBuffer& buffer);
809  String& from_acsii(const AChar* s);
810 
811  public:
812  static Char eos()
813  {
814  return Char();
815  }
816  static int compare(const Char* s1, const Char* s2, size_t n);
817  static int compare(const Char* s1, const AChar* s2, size_t n);
818  static int icompare(const Char* s1, const Char* s2, size_t n);
819  static const Char* find(const Char* s, int n, const Char& a);
820  static size_t length(const Char* s);
821  static size_t length(const AChar* s);
822  static Char* copy(Char* dest, const Char* src, size_t n);
823  static Char* copy(Char* dest, const AChar* src, size_t n);
824  static Char* move(Char* dest, const Char* src, size_t n);
825  static Char* assign(Char* dest, size_t n, const Char& c);
826  static void assign(Char& c1, const Char& c2)
827  {
828  c1 = c2;
829  }
830  static bool eq(const Char& c1, const Char& c2)
831  {
832  return c1 == c2;
833  }
834  static bool ne(const Char& c1, const Char& c2)
835  {
836  return !eq(c1, c2);
837  }
838  static bool lt(const Char& c1, const Char& c2)
839  {
840  return c1 < c2;
841  }
842  static bool ieq(const Char& c1, const Char& c2);
843  static bool ine(const Char& c1, const Char& c2)
844  {
845  return !ieq(c1, c2);
846  }
847  static bool ilt(const Char& c1, const Char& c2);
848 
849  private:
850  String& assign(Char c, size_t n = 1)
851  {
852  assign_helper(c, n);
853  return *this;
854  }
855 
856  String& append(Char c, size_t n = 1)
857  {
858  append_helper(c, n);
859  return *this;
860  }
861 
862  const Char& get_at(size_t pos) const
863  {
864  //if ( pos >= size_ )
865  // os_throw_out_of_range();
866  return *(data_->data + pos);
867  }
868 
869  void put_at(size_t pos, Char c);
870 
871  void assign_helper(const Char* data, size_t n);
872  void assign_helper(const AChar* data, size_t n);
873  void assign_helper(Char c, size_t n);
874 
875  void replace_helper(size_t pos, size_t n1, const Char* s, size_t n2);
876  void replace_helper(size_t pos, size_t n1, Char c, size_t n2);
877  void replace_helper(size_t pos, size_t n1, const String& str, size_t pos2, size_t n2)
878  {
879  str.validate_range(pos2, &n2);
880  replace_helper(pos, n1, str.data_->data + pos2, n2);
881  }
882 
883  void append_helper(const String& str, size_t pos, size_t n)
884  {
885  str.validate_range(pos, &n);
886  append_helper(str.data_->data + pos, n);
887  }
888 
889  void append_helper(const Char* s, size_t n);
890  void append_helper(Char c, size_t n);
891 
892  void append_helper(const AChar* s, size_t n);
893  void append_helper(AChar c, size_t n);
894 
895  int compare_helper(const String& str, size_t pos, size_t n) const;
896  int compare_helper(const Char* s, size_t pos, size_t n) const;
897  int compare_helper(const AChar* s, size_t pos, size_t n) const;
898 
899  int icompare_helper(const String& str, size_t pos, size_t n) const;
900  int icompare_helper(const Char* s, size_t pos, size_t n) const;
901 
902  void reserve_helper(size_t capacity);
903  void resize_helper(size_t new_count, Char fill_char);
904 
905  Char* allocate(size_t count);
906  void reallocate(size_t count);
907  void size(size_t n)
908  {
909  if (n <= data_->capacity)
910  {
911  data_->size = n;
912  data_->data[ data_->size ] = eos();
913  }
914  }
915 
916  private:
917  static Char* nil_data();
918  void init();
919  Char* data()
920  {
921  return data_->data;
922  }
923 
924  private:
925  RawString* data_;
926  PAllocator allocator_;
927 
928  };
929 
930 
931  inline bool String::operator < (const String& s) const
932  {
933  return compare(s) < 0;
934  }
935  inline bool String::operator > (const String& s) const
936  {
937  return compare(s) > 0;
938  }
939 
940  inline String String::operator + (const String& str) const
941  {
942  String r = *this;
943  r.append(str);
944  return r;
945  }
946  int strcmp(const Char* s1, const Char* s2);
947  int stricmp(const Char* s1, const Char* s2);
948 };
949 
950 CMREXD bool FromUTF8(commore::String& so, const commore::AChar* si);
951 
952 CMREXD void EncodeToUTF8(const commore::String& source, commore::AString& dest);
954 CMREXD void EncodeToUTF8(const commore::Char* source, commore::AString& dest);
955 CMREXD void DecodeFromUTF8(const commore::AString& source, commore::String& dest);
956 
958 
959 #endif
String & insert(size_t pos1, const String &str)
Definition: String.h:357
size_t find_first_of(const Char *str, size_t pos=0) const
Definition: String.h:673
String & append(const AChar *str)
Definition: String.h:239
int icompare(size_t pos1, size_t n1, const String &str, size_t pos2, size_t n2) const
Definition: String.h:765
void resize(size_t n)
Definition: String.h:598
String operator+(const String &str) const
Definition: String.h:940
bool validate_range(size_t pos, size_t *len) const
Definition: String.h:263
static bool ine(const Char &c1, const Char &c2)
Definition: String.h:843
String & insert(size_t pos, const Char *str)
Definition: String.h:390
Definition: AString.h:39
Char * pointer
Definition: String.h:62
String & append(const Char *str, size_t n)
Definition: String.h:211
size_t find_last_not_of(const Char &c, size_t pos=(size_t) npos) const
Definition: String.h:725
long CMREXD write_xml(const AString &sIn, OBStream &o)
Definition: AString.cpp:27
size_t find_first_not_of(const String &str, size_t pos=0) const
Definition: String.h:681
size_t find_last_of(Char c, size_t pos=(size_t) npos) const
Definition: String.h:713
bool operator<(const String &s) const
Definition: String.h:931
bool read(IBStream &str, int &num)
Definition: Time.cpp:200
void swap(C &c1, C &c2)
Definition: Commore.h:29
const Char * const_pointer
Definition: String.h:63
const Char & const_reference
Definition: String.h:61
Char & at(size_t pos)
Definition: String.h:524
int compare(size_t pos, size_t n, const String &str) const
Definition: String.h:738
int compare(const Char *s) const
Definition: String.h:747
Definition: String.h:45
const PAllocator & get_allocator() const
Definition: String.h:554
int icompare(const String &str) const
Definition: String.h:757
size_t find(const String &str, size_t pos=0) const
Find content in string Searches the string for the first occurrence of the sequence specified by its ...
Definition: String.h:655
String & append(const AChar *str, size_t n)
Definition: String.h:221
String & assign(const AChar *str, size_t n)
Definition: String.h:321
void resize(size_t n, Char c)
Definition: String.h:591
String & append(const String &str)
Definition: String.h:189
size_t find_last_not_of(const Char *str, size_t pos=(size_t) npos) const
Definition: String.h:729
const Char * data() const
Definition: String.h:547
size_t find_last_not_of(const String &str, size_t pos=(size_t) npos) const
Definition: String.h:721
char AChar
Definition: Type.h:65
CMREXD void DecodeFromUTF8(const commore::AString &source, commore::String &dest)
Definition: String.cpp:1046
String & insert(size_t pos, size_t n, Char c)
Definition: String.h:401
#define CMREXD
Definition: Compiler.h:22
size_t rfind(const Char *str, size_t pos=(size_t) npos) const
Definition: String.h:701
static bool lt(const Char &c1, const Char &c2)
Definition: String.h:838
Char & operator[](size_t pos)
Definition: String.h:501
size_t max_size() const
Definition: String.h:576
static bool eq(const Char &c1, const Char &c2)
Definition: String.h:830
size_t size
Definition: String.h:23
size_t size_type
Definition: String.h:59
String & erase(size_t pos=0, size_t n=(size_t) npos)
Definition: String.h:421
RawString * PRawString
Definition: String.h:33
void reserve(size_t size)
Definition: String.h:613
String & replace(size_t pos1, size_t n1, const String &str, size_t pos2, size_t n2)
Definition: String.h:447
size_t find_last_of(const String &str, size_t pos=(size_t) npos) const
Definition: String.h:709
static void assign(Char &c1, const Char &c2)
Definition: String.h:826
int icompare(size_t pos, size_t n, const String &str) const
Definition: String.h:761
String & replace(size_t pos, size_t n1, const Char *str, size_t n2)
Definition: String.h:459
size_t rfind(Char c, size_t pos=(size_t) npos) const
Definition: String.h:705
size_t find(Char c, size_t pos=0) const
Definition: String.h:664
int compare(const AChar *s) const
Definition: String.h:751
size_t find(const Char *str, size_t pos=0) const
Definition: String.h:660
bool operator==(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:148
size_t size() const
Definition: String.h:569
size_t find_first_of(const String &str, size_t pos=0) const
Definition: String.h:668
String & replace(size_t pos, size_t n1, const Char *str)
Definition: String.h:470
CMREXD commore::OBStream & operator<<(commore::OBStream &o, const commore::String &s)
Definition: String.cpp:891
int compare(const String &str) const
Definition: String.h:734
String & append(size_t n, Char c)
Definition: String.h:250
Definition: String.h:40
String & append(const Char *str)
Definition: String.h:230
CMREXD bool FromUTF8(commore::String &so, const commore::AChar *si)
int strcmp(const Char *s1, const Char *s2)
size_t find_first_not_of(const Char *str, size_t pos=0) const
Definition: String.h:690
Definition: String.h:18
int compare(size_t pos1, size_t n1, const String &str, size_t pos2, size_t n2) const
Definition: String.h:742
TimeDate operator+(const TimePeriod &period, const TimeDate &time_and_date)
Definition: Time.h:477
Definition: CommBuffer.h:28
String & assign(const Char *str, size_t n)
Definition: String.h:297
String & insert(size_t pos1, const String &str, size_t pos2, size_t n)
Definition: String.h:369
int Int
Definition: Type.h:37
String & insert(size_t pos, const Char *str, size_t n)
Definition: String.h:380
const unsigned int npos
Definition: Type.h:197
int stricmp(const Char *s1, const Char *s2)
String & assign(const AChar *str)
Definition: String.h:329
Char operator[](size_t pos) const
Definition: String.h:492
long CMREXD read_xml(AString &sOut, IBStream &i)
Definition: AString.cpp:65
String & replace(size_t pos, size_t n1, size_t n2, Char c)
Definition: String.h:482
size_t find_first_not_of(Char c, size_t pos=0) const
Definition: String.h:686
int icompare(const AChar *s) const
Definition: String.h:774
String & assign(const Char *str)
Definition: String.h:305
size_t copy(Char *str, size_t n, size_t pos=0) const
Copy sequence of characters from string Copies a substring of the current value of the string object ...
Definition: String.h:628
bool operator<(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:155
String & assign(size_t n, Char c)
Definition: String.h:313
size_t find_last_of(const Char *str, size_t pos=(size_t) npos) const
Definition: String.h:717
CMREXD void EncodeToUTF8(const commore::String &source, commore::AString &dest)
Definition: String.cpp:1007
size_t capacity() const
Definition: String.h:605
Char value_type
Definition: String.h:58
Definition: IOBStream.h:166
virtual ~Allocator()
Definition: String.h:48
static bool ne(const Char &c1, const Char &c2)
Definition: String.h:834
Allocator * PAllocator
Definition: String.h:55
bool empty() const
Definition: String.h:583
Definition: IOBStream.h:29
String & clear()
Definition: String.h:410
Char at(size_t pos) const
Definition: String.h:516
String & append(const String &str, size_t pos, size_t n)
Definition: String.h:201
Char & reference
Definition: String.h:60
size_t find_first_of(Char c, size_t pos=0) const
Definition: String.h:677
size_t rfind(const String &str, size_t pos=(size_t) npos) const
Definition: String.h:697
Char data[4]
Definition: String.h:31
String & replace(size_t pos1, size_t n1, const String &str)
Definition: String.h:433
bool operator>(const String &s) const
Definition: String.h:935
static Char eos()
Definition: String.h:812
const Char * c_str() const
Definition: String.h:533
size_t length() const
Definition: String.h:562
String & assign(const String &str, size_t pos, size_t n)
Definition: String.h:286
CMREXD int init()
Definition: Commore.cpp:17
size_t capacity
Definition: String.h:27
wchar_t Char
Definition: Type.h:66
String & assign(size_t n, AChar c)
Definition: String.h:337
int icompare(const Char *s) const
Definition: String.h:770