6 #ifndef CMR_ASTRING_INCLUDED
7 #define CMR_ASTRING_INCLUDED
41 friend class Iterator;
83 AString(
const void* v,
size_t n,
size_t base = 16);
126 enum { STRING_INCREMENT_SIZE = 16 };
134 return compare(str) == 0;
141 return compare(str) == 0;
148 return !compare(str) == 0;
153 bool operator != (
const AChar* str)
const
155 return !compare(str) == 0;
162 return compare(str) < 0;
169 return compare(str) > 0;
204 append_helper(str, 0, (
size_t)
npos);
216 append_helper(str, pos, n);
226 append_helper(str, n);
235 append_helper(str, length(str));
266 if (*len > (s - pos))
284 assign_helper(str.data_->
data + pos, n);
293 assign_helper(str, n);
301 assign_helper(str, length(str));
329 replace_helper(pos1, 0, str, 0, (
size_t)
npos);
341 replace_helper(pos1, 0, str, pos2, n);
352 replace_helper(pos, 0, str, n);
362 replace_helper(pos, 0, str, length(str));
373 replace_helper(pos, 0, c, n);
392 replace_helper(pos, n, (
const AChar*)0, 0);
398 void Delete(
size_t pos = 0,
size_t n = 1)
400 replace_helper(pos, n, (
const AChar*)0, 0);
410 replace_helper(pos1, n, str, 0, str.
size());
424 replace_helper(pos1, n1, str, pos2, n2);
436 replace_helper(pos1, n1, str, n2);
447 replace_helper(pos, n1, str, length(str));
459 replace_helper(pos, n1, c, n2);
473 return replace(s1, s2, case_sensitive);
482 return pos == size() ? eos() : get_at(pos);
492 return *(data_->data + pos);
505 return pos == (int)size() ? eos() : get_at((
size_t)pos);
513 if (pos < (
int)size())
515 return *(data_->data + pos);
535 return operator[](pos);
544 return data_ ? data_->data : nil_data();
551 return data_ ? data_->data : nil_data();
578 return (
size_t)
npos - 1;
619 return data_->capacity;
634 reserve_helper(size);
645 return allocate(size);
658 if (validate_range(pos, &n))
660 copy(str, data_->data + pos, n);
684 size_t find(
const AChar* s,
size_t pos,
size_t n)
const;
685 size_t find(
const AChar* str,
size_t pos = 0)
const {
return find(str, pos, length(str)); }
688 size_t find_first_of(
const AChar* s,
size_t pos,
size_t n)
const;
692 size_t find_first_not_of(
const AChar* s,
size_t pos,
size_t n)
const;
695 size_t rfind(
const AChar* str,
size_t pos,
size_t n)
const;
696 size_t find_last_of(
const AChar* s,
size_t pos,
size_t n)
const;
697 size_t find_last_not_of(
const AChar* s,
size_t pos,
size_t n)
const;
716 AString substr(
size_t pos = 0,
size_t n = (
size_t)
npos)
const;
740 int compare(
size_t pos,
size_t n,
const AString& str)
const {
return compare_helper(str, pos, n); }
741 int compare(
size_t pos1,
size_t n1,
const AString& str,
size_t pos2,
size_t n2)
const
744 return compare_helper(temp, pos1, n1);
748 return compare_helper(s, 0, length(s));
750 int compare(
size_t pos,
size_t n1,
const AChar* str,
size_t n2 = (
size_t)
npos)
const;
759 return icompare_helper(str, 0, (
size_t)
npos);
763 return icompare_helper(str, pos, n);
765 int icompare(
size_t pos1,
size_t n1,
const AString& str,
size_t pos2,
size_t n2)
const
768 return icompare_helper(temp, pos1, n1);
772 return icompare_helper(s, 0, length(s));
774 int icompare(
size_t pos,
size_t n1,
const AChar* str,
size_t n2 = (
size_t)
npos)
const;
778 return icompare_helper(s, 0, length(s));
805 bool match(
const AString& pattern)
const;
839 static int compare(
const AChar* s1,
const AChar* s2,
size_t n);
843 static int icompare(
const AChar* s1,
const AChar* s2,
size_t n);
851 static size_t length(
const AChar* s);
882 static bool ieq(
const AChar& c1,
const AChar& c2);
887 static bool ilt(
const AChar& c1,
const AChar& c2);
896 AString& append(
AChar c,
size_t n = 1)
902 const AChar& get_at(
size_t pos)
const
906 return *(data_->data + pos);
910 return *(
const AChar*)0;
914 void put_at(
size_t pos,
AChar c);
916 void assign_helper(
const AChar* data,
size_t n);
917 void assign_helper(
AChar c,
size_t n);
918 void replace_helper(
size_t pos,
size_t n1,
const AChar* s,
size_t n2);
919 void replace_helper(
size_t pos,
size_t n1,
AChar c,
size_t n2);
920 void replace_helper(
size_t pos,
size_t n1,
const AString& str,
size_t pos2,
size_t n2);
921 void append_helper(
const AString& str,
size_t pos,
size_t n);
922 void append_helper(
const AChar* s,
size_t n);
923 void append_helper(
AChar c,
size_t n);
925 int compare_helper(
const AString& str,
size_t pos,
size_t n)
const;
926 int compare_helper(
const AChar* s,
size_t pos,
size_t n)
const;
928 int icompare_helper(
const AString& str,
size_t pos,
size_t n)
const;
929 int icompare_helper(
const AChar* s,
size_t pos,
size_t n)
const;
931 void reserve_helper(
size_t capacity);
932 void resize_helper(
size_t new_count,
AChar fill_char);
934 AChar* allocate(
size_t count);
935 void reallocate(
size_t count);
952 static AChar* nil_data();
954 AString& Format(
const AChar* format, ...);
size_t find_last_not_of(const AChar *str, size_t pos=(size_t) npos) const
Definition: AString.h:706
AChar operator[](int pos) const
Definition: AString.h:503
AString & insert(size_t pos1, const AString &str, size_t pos2, size_t n)
Definition: AString.h:339
CMREXD commore::AString operator+(const commore::AString &string1, const commore::AString &string2)
Definition: AString.cpp:913
size_t capacity
Definition: AString.h:26
void Delete(size_t pos=0, size_t n=1)
Definition: AString.h:398
AString & MakeLower()
Definition: AString.h:795
int icompare(size_t pos, size_t n, const AString &str) const
Definition: AString.h:761
RawAString * PRawAString
Definition: AString.h:32
AString & replace(size_t pos, size_t n1, size_t n2, AChar c)
Definition: AString.h:457
size_t find_first_of(const AChar *str, size_t pos=0) const
Definition: AString.h:689
AString & erase(size_t pos=0, size_t n=(size_t) npos)
Definition: AString.h:390
AChar operator[](size_t pos) const
Definition: AString.h:480
const AChar * data() const
Definition: AString.h:549
size_t find(const AChar *str, size_t pos=0) const
Definition: AString.h:685
AChar value_type
Definition: AString.h:119
AString & Replace(const AChar *s1, const AChar *s2, bool case_sensitive=true)
Definition: AString.h:471
long CMREXD write_xml(const AString &sIn, OBStream &o)
Definition: AString.cpp:27
int compare(size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
Definition: AString.h:741
size_t find_first_not_of(AChar c, size_t pos=0) const
Definition: AString.h:693
static bool ine(const AChar &c1, const AChar &c2)
Definition: AString.h:883
int icompare(size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
Definition: AString.h:765
AString & replace(size_t pos1, size_t n, const AString &str)
Definition: AString.h:408
AString & insert(size_t pos1, const AString &str)
Definition: AString.h:327
void swap(C &c1, C &c2)
Definition: Commore.h:29
AString & append(const AString &str, size_t pos, size_t n)
Definition: AString.h:214
AString & append(size_t n, AChar c)
Definition: AString.h:244
size_t length() const
Definition: AString.h:566
size_t find_last_of(const AString &str, size_t pos=(size_t) npos) const
Definition: AString.h:701
bool is_empty() const
Definition: AString.h:583
static void assign(AChar &c1, const AChar &c2)
Definition: AString.h:866
bool validate_range(size_t pos, size_t *len) const
Definition: AString.h:257
char AChar
Definition: Type.h:65
size_t max_size() const
Definition: AString.h:576
size_t find_last_of(const AChar *str, size_t pos=(size_t) npos) const
Definition: AString.h:703
size_t capacity() const
Return size of allocated storage.
Definition: AString.h:617
size_t find_last_of(AChar c, size_t pos=(size_t) npos) const
Definition: AString.h:702
AString CMREXD create_cmr_guid()
Definition: AString-linux.cpp:47
AChar & operator[](int pos)
Definition: AString.h:511
#define CMREXD
Definition: Compiler.h:22
AString & insert(size_t pos, const AChar *str)
Definition: AString.h:360
void resize(size_t n, AChar c)
Definition: AString.h:598
AString & append(const AChar *str)
Definition: AString.h:233
static bool lt(const AChar &c1, const AChar &c2)
Definition: AString.h:878
AChar & reference
Definition: AString.h:121
int compare(const AString &str) const
Compare string.
Definition: AString.h:739
bool operator==(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:148
char * set_buffer(size_t size)
Definition: AString.h:643
size_t find(AChar c, size_t pos=0) const
Definition: AString.h:686
size_t find(const AString &str, size_t pos=0) const
Find content in string Searches the string for the first occurrence of the sequence specified by its ...
Definition: AString.h:683
const AChar * c_str() const
Definition: AString.h:542
AString & clear()
Definition: AString.h:380
const AChar & const_reference
Definition: AString.h:122
size_t copy(AChar *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: AString.h:656
int compare(size_t pos, size_t n, const AString &str) const
Definition: AString.h:740
AString & assign(const AChar *str)
Definition: AString.h:299
static bool eq(const AChar &c1, const AChar &c2)
Definition: AString.h:870
int icompare(const AString &str) const
Compare string but do not care caracter case (acii charecter only)
Definition: AString.h:757
size_t size_type
Definition: AString.h:120
size_t find_first_of(AChar c, size_t pos=0) const
Definition: AString.h:690
size_t rfind(const AChar *str, size_t pos=(size_t) npos) const
Definition: AString.h:699
size_t find_first_not_of(const AString &str, size_t pos=0) const
Definition: AString.h:691
TimeDate operator+(const TimePeriod &period, const TimeDate &time_and_date)
Definition: Time.h:477
int CompareNoCase(const AChar *s) const
Definition: AString.h:776
int Int
Definition: Type.h:37
size_t rfind(const AString &str, size_t pos=(size_t) npos) const
Definition: AString.h:698
AString & replace(size_t pos, size_t n1, const AChar *str)
Definition: AString.h:445
AChar * pointer
Definition: AString.h:123
const unsigned int npos
Definition: Type.h:197
AString & insert(size_t pos, const AChar *str, size_t n)
Definition: AString.h:350
static AChar eos()
Definition: AString.h:830
AString & append(const AChar *str, size_t n)
Definition: AString.h:224
long CMREXD read_xml(AString &sOut, IBStream &i)
Definition: AString.cpp:65
AString & MakeUpper()
Definition: AString.h:792
const AChar * const_pointer
Definition: AString.h:124
size_t find_first_of(const AString &str, size_t pos=0) const
Definition: AString.h:687
AString & replace(size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2)
Definition: AString.h:422
void reserve(size_t size)
Request a change in capacity Requests that the string capacity be adapted to a planned change in size...
Definition: AString.h:632
AString & assign(size_t n, AChar c)
Definition: AString.h:307
size_t size() const
Definition: AString.h:559
bool operator<(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:155
size_t find_last_not_of(const AChar &c, size_t pos=(size_t) npos) const
Definition: AString.h:705
AString & assign(const AChar *str, size_t n)
Definition: AString.h:291
AChar & operator[](size_t pos)
Definition: AString.h:488
size_t size
Definition: AString.h:22
AString & assign(const AString &str, size_t pos, size_t n)
Definition: AString.h:280
AChar & at(size_t pos)
Definition: AString.h:533
AChar data[4]
Definition: AString.h:30
Definition: IOBStream.h:166
AString & insert(size_t pos, size_t n, AChar c)
Definition: AString.h:371
AString & append(const AString &str)
Definition: AString.h:202
Definition: IOBStream.h:29
AString & replace(size_t pos1, size_t n1, const AChar *str, size_t n2)
Definition: AString.h:434
size_t rfind(AChar c, size_t pos=(size_t) npos) const
Definition: AString.h:700
CMREXD void DecodeFromUTF8(const commore::AString &source, commore::AString &dest)
Definition: AString.cpp:989
size_t find_last_not_of(const AString &str, size_t pos=(size_t) npos) const
Definition: AString.h:704
size_t find_first_not_of(const AChar *str, size_t pos=0) const
Definition: AString.h:694
int icompare(const AChar *s) const
Definition: AString.h:770
CMREXD commore::IBStream & operator>>(commore::IBStream &i, commore::AString &s)
Definition: IOBStream.cpp:1174
static bool ne(const AChar &c1, const AChar &c2)
Definition: AString.h:874
void resize(size_t n)
Definition: AString.h:602
int compare(const AChar *s) const
Definition: AString.h:746
CMREXD commore::OBStream & operator<<(commore::OBStream &o, const commore::AString &s)
Definition: AString.cpp:19
AString CMREXD create_guid()
Definition: AString-linux.cpp:73
AChar at(size_t pos) const
Definition: AString.h:525
CMREXD int init()
Definition: Commore.cpp:17
wchar_t Char
Definition: Type.h:66