From: <sp...@us...> - 2004-03-10 12:50:47
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14960/rtk Modified Files: String.h Log Message: Added the macro RTK_API in front of each method (this is needed to build rtk in symbian) Index: String.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/String.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** String.h 28 Feb 2004 07:39:43 -0000 1.6 --- String.h 10 Mar 2004 12:24:53 -0000 1.7 *************** *** 102,106 **** @endcode */ ! String() : sh(NULL) { } /** Create string filled with chracter c. --- 102,106 ---- @endcode */ ! RTK_API String() : sh(NULL) { } /** Create string filled with chracter c. *************** *** 108,112 **** * @param repeater How many time 'c' is repeated in string */ ! String(RCHAR c, int repeater); /** Create string from ascii/mb character string. --- 108,112 ---- * @param repeater How many time 'c' is repeated in string */ ! RTK_API String(RCHAR c, int repeater); /** Create string from ascii/mb character string. *************** *** 114,118 **** * @param maxlen Length to copy, if 0 whole string is copied */ ! String(const char *s, int maxlen=0); /** Create string from wide character string. --- 114,118 ---- * @param maxlen Length to copy, if 0 whole string is copied */ ! RTK_API String(const char *s, int maxlen=0); /** Create string from wide character string. *************** *** 120,146 **** * @param maxlen Length to copy, if 0 whole string is copied */ ! String(const wchar_t *s, int maxlen=0); /** Copy constructor. */ ! String(const String &s); ! ~String(); // = Operators ! String& operator = (const String& s); ! String& operator = (const wchar_t *s); ! String& operator = (const char *s); // + Operators ! String operator + (const String& s) const; ! String operator + (const RCHAR s) const; ! String operator + (const char *s) const; ! String operator + (const wchar_t *s) const; // += Operators ! String& operator += (const String& s); ! String& operator += (const wchar_t *s); ! String& operator += (const char *s); ! String& operator += (const RCHAR s); /** Append text to the string. --- 120,146 ---- * @param maxlen Length to copy, if 0 whole string is copied */ ! RTK_API String(const wchar_t *s, int maxlen=0); /** Copy constructor. */ ! RTK_API String(const String &s); ! RTK_API ~String(); // = Operators ! RTK_API String& operator = (const String& s); ! RTK_API String& operator = (const wchar_t *s); ! RTK_API String& operator = (const char *s); // + Operators ! RTK_API String operator + (const String& s) const; ! RTK_API String operator + (const RCHAR s) const; ! RTK_API String operator + (const char *s) const; ! RTK_API String operator + (const wchar_t *s) const; // += Operators ! RTK_API String& operator += (const String& s); ! RTK_API String& operator += (const wchar_t *s); ! RTK_API String& operator += (const char *s); ! RTK_API String& operator += (const RCHAR s); /** Append text to the string. *************** *** 150,154 **** * @return Reference to string. */ ! String &Append(const RCHAR *str, int len=0); /** Prepend text to the string. --- 150,154 ---- * @return Reference to string. */ ! RTK_API String &Append(const RCHAR *str, int len=0); /** Prepend text to the string. *************** *** 158,162 **** * @return Reference to string. */ ! String &Prepend(const RCHAR *str, int len=0); /** Compares the against another string. --- 158,162 ---- * @return Reference to string. */ ! RTK_API String &Prepend(const RCHAR *str, int len=0); /** Compares the against another string. *************** *** 166,170 **** * respectively, to be less than, to match, or be greater than this string. */ ! int Cmp(const RCHAR *str, int count=0) const; /** Compares the against another string, ignoring the case of the characters. --- 166,170 ---- * respectively, to be less than, to match, or be greater than this string. */ ! RTK_API int Cmp(const RCHAR *str, int count=0) const; /** Compares the against another string, ignoring the case of the characters. *************** *** 174,178 **** * respectively, to be less than, to match, or be greater than this string. */ ! int CaseCmp(const RCHAR *str, int count=0) const; /** Trim string from right. --- 174,178 ---- * respectively, to be less than, to match, or be greater than this string. */ ! RTK_API int CaseCmp(const RCHAR *str, int count=0) const; /** Trim string from right. *************** *** 185,189 **** * @return Trimmed string. */ ! String TrimRight(RCHAR ch=' ') const; /** Trim string from left. --- 185,189 ---- * @return Trimmed string. */ ! RTK_API String TrimRight(RCHAR ch=' ') const; /** Trim string from left. *************** *** 191,195 **** * @return Trimmed string. */ ! String TrimLeft(RCHAR ch=' ') const; /** Trim string from left and right. --- 191,195 ---- * @return Trimmed string. */ ! RTK_API String TrimLeft(RCHAR ch=' ') const; /** Trim string from left and right. *************** *** 197,211 **** * @return Trimmed string. */ ! String Trim(RCHAR ch=' ') const; /** Convert string to lower case. * @return Converted string. */ ! String LowerCase() const; /** Convert string to upper case. * @return Converted string. */ ! String UpperCase() const; /** Cut piece out from the string. --- 197,211 ---- * @return Trimmed string. */ ! RTK_API String Trim(RCHAR ch=' ') const; /** Convert string to lower case. * @return Converted string. */ ! RTK_API String LowerCase() const; /** Convert string to upper case. * @return Converted string. */ ! RTK_API String UpperCase() const; /** Cut piece out from the string. *************** *** 219,223 **** * @return New string containing piece of original string. */ ! String SubStr(int start, int count) const; /** Delete characters from given index. --- 219,223 ---- * @return New string containing piece of original string. */ ! RTK_API String SubStr(int start, int count) const; /** Delete characters from given index. *************** *** 226,230 **** * @param count How many characters to remove, defaults to 1 */ ! void SubDelete(int start, int count=1); /** Replace some pattern in string with another text. --- 226,230 ---- * @param count How many characters to remove, defaults to 1 */ ! RTK_API void SubDelete(int start, int count=1); /** Replace some pattern in string with another text. *************** *** 238,242 **** * @param replacement Replacement text for 'pattern', if NULL pattern is removed from string. */ ! String Replace(const RCHAR *pattern, const RCHAR *replacement) const; /** Remove pattern from string. String is not modified by this call. --- 238,242 ---- * @param replacement Replacement text for 'pattern', if NULL pattern is removed from string. */ ! RTK_API String Replace(const RCHAR *pattern, const RCHAR *replacement) const; /** Remove pattern from string. String is not modified by this call. *************** *** 244,248 **** * @return New string with pattern removed from it. */ ! String Remove(const RCHAR *pattern) const { return Replace(pattern, NULL); } /** Insert string to given index. --- 244,248 ---- * @return New string with pattern removed from it. */ ! RTK_API String Remove(const RCHAR *pattern) const { return Replace(pattern, NULL); } /** Insert string to given index. *************** *** 250,254 **** * @param str String to insert */ ! void Insert(int index, const RCHAR *str, int len=0); /** Insert character to given index. --- 250,254 ---- * @param str String to insert */ ! RTK_API void Insert(int index, const RCHAR *str, int len=0); /** Insert character to given index. *************** *** 256,260 **** * @param ch Character to insert */ ! void Insert(int index, RCHAR ch) { Insert(index, &ch, 1); } /** Retrieve string size in bytes. --- 256,260 ---- * @param ch Character to insert */ ! RTK_API void Insert(int index, RCHAR ch) { Insert(index, &ch, 1); } /** Retrieve string size in bytes. *************** *** 262,266 **** * @return Size in bytes. */ ! int GetBytes() const { return GetLength() * sizeof(RCHAR); } /** Retrieve string length in characters. --- 262,266 ---- * @return Size in bytes. */ ! RTK_API int GetBytes() const { return GetLength() * sizeof(RCHAR); } /** Retrieve string length in characters. *************** *** 268,272 **** * @see GetBytes() */ ! int GetLength() const { return (sh) ? sh->len : 0; } /** Set internal storage length. --- 268,272 ---- * @see GetBytes() */ ! RTK_API int GetLength() const { return (sh) ? sh->len : 0; } /** Set internal storage length. *************** *** 279,283 **** * @param len New length to set. */ ! void SetLength(int len) { Alloc(len); } /** Frees the internal storage of the string. --- 279,283 ---- * @param len New length to set. */ ! RTK_API void SetLength(int len) { Alloc(len); } /** Frees the internal storage of the string. *************** *** 285,289 **** * @see Clear(); */ ! void Free() { if(sh) { if(!--sh->ref) sh->delete_self(); } sh = 0; --- 285,289 ---- * @see Clear(); */ ! RTK_API void Free() { if(sh) { if(!--sh->ref) sh->delete_self(); } sh = 0; *************** *** 294,298 **** * @see Free(); */ ! void Clear() { Free(); Alloc(0); } /** Check if string is empty. --- 294,298 ---- * @see Free(); */ ! RTK_API void Clear() { Free(); Alloc(0); } /** Check if string is empty. *************** *** 300,304 **** * @see IsNull() */ ! bool IsEmpty() const { return (GetLength() == 0); } /** Check if string is NULL. --- 300,304 ---- * @see IsNull() */ ! RTK_API bool IsEmpty() const { return (GetLength() == 0); } /** Check if string is NULL. *************** *** 310,314 **** * @return True if string is not allocated yet, or Free() is called. */ ! bool IsNull() const { return (sh==0); } /** Search for next occurance of given string, starting from index. --- 310,314 ---- * @return True if string is not allocated yet, or Free() is called. */ ! RTK_API bool IsNull() const { return (sh==0); } /** Search for next occurance of given string, starting from index. *************** *** 317,321 **** * @return Position of next occurance or -1 if not found. */ ! int Pos(const RCHAR *str, int index=0) const; /** Search for next occurance of given character, starting from index. --- 317,321 ---- * @return Position of next occurance or -1 if not found. */ ! RTK_API int Pos(const RCHAR *str, int index=0) const; /** Search for next occurance of given character, starting from index. *************** *** 324,328 **** * @return Position of next occurance or -1 if not found. */ ! int Pos(int c, int index=0) const; /** Search backwards for next occurance of given character, starting from index. --- 324,328 ---- * @return Position of next occurance or -1 if not found. */ ! RTK_API int Pos(int c, int index=0) const; /** Search backwards for next occurance of given character, starting from index. *************** *** 331,335 **** * @return Position of next occurance found backwards or -1 if not found. */ ! int RPos(int c, int index=0) const; /** Convert string to int. --- 331,335 ---- * @return Position of next occurance found backwards or -1 if not found. */ ! RTK_API int RPos(int c, int index=0) const; /** Convert string to int. *************** *** 337,341 **** * @return Converted value, or given default value if failed. */ ! int ToInt(int defvalue=0) const; /** Convert string to double. --- 337,341 ---- * @return Converted value, or given default value if failed. */ ! RTK_API int ToInt(int defvalue=0) const; /** Convert string to double. *************** *** 343,356 **** * @return Converted value, or given default value if failed. */ ! double ToDouble(double defvalue=0) const; /** Create string from signed number. */ ! static String FromInt(int number); /** Create string from unsigned number. */ ! static String FromUint(unsigned number); /** Create string from double number. */ ! static String FromDouble(double number); /** Get const pointer to internal character storage. --- 343,356 ---- * @return Converted value, or given default value if failed. */ ! RTK_API double ToDouble(double defvalue=0) const; /** Create string from signed number. */ ! RTK_API static String FromInt(int number); /** Create string from unsigned number. */ ! RTK_API static String FromUint(unsigned number); /** Create string from double number. */ ! RTK_API static String FromDouble(double number); /** Get const pointer to internal character storage. *************** *** 358,400 **** * It's preferred to use this method within functions, that doesnt like NULL's */ ! const RCHAR* c_str() const { return ((sh) ? sh->str : _R("")); } /** Get pointer to internal character storage. * If string is Null (IsNull()==1) - NULL is returned */ ! RCHAR* GetStr() { copy(); return ((sh) ? sh->str : NULL); } /** Get pointer to internal character storage. * If string is Null (IsNull()==1) - NULL is returned */ ! const RCHAR* GetStr() const { return ((sh) ? sh->str : NULL); } /** Format string using printf style format. * @return Reference to formatted string. */ ! String &Format(const RCHAR *fmt, ...); /** Create formatted string */ ! static String Create(const RCHAR *fmt, ...); /** Auto conversion to const RCHAR* * @see c_str() */ ! operator const RCHAR *() const { return GetStr(); } /** Auto conversion to RCHAR* * @see GetStr() */ ! operator RCHAR *() { return GetStr(); } /** Same as At(int idx) * @see At */ ! RCHAR &operator [] (int idx) { return at(idx); } /** Same as At(int idx) * @see At */ ! const RCHAR &operator [] (int idx) const { return at(idx); } /** Get element at index. --- 358,400 ---- * It's preferred to use this method within functions, that doesnt like NULL's */ ! RTK_API const RCHAR* c_str() const { return ((sh) ? sh->str : _R("")); } /** Get pointer to internal character storage. * If string is Null (IsNull()==1) - NULL is returned */ ! RTK_API RCHAR* GetStr() { copy(); return ((sh) ? sh->str : NULL); } /** Get pointer to internal character storage. * If string is Null (IsNull()==1) - NULL is returned */ ! RTK_API const RCHAR* GetStr() const { return ((sh) ? sh->str : NULL); } /** Format string using printf style format. * @return Reference to formatted string. */ ! RTK_API String &Format(const RCHAR *fmt, ...); /** Create formatted string */ ! RTK_API static String Create(const RCHAR *fmt, ...); /** Auto conversion to const RCHAR* * @see c_str() */ ! RTK_API operator const RCHAR *() const { return GetStr(); } /** Auto conversion to RCHAR* * @see GetStr() */ ! RTK_API operator RCHAR *() { return GetStr(); } /** Same as At(int idx) * @see At */ ! RTK_API RCHAR &operator [] (int idx) { return at(idx); } /** Same as At(int idx) * @see At */ ! RTK_API const RCHAR &operator [] (int idx) const { return at(idx); } /** Get element at index. *************** *** 403,407 **** * @return Reference to element at given index. */ ! RCHAR &at(int idx) { copy(); return sh->str[idx]; } /** Get element at index. --- 403,407 ---- * @return Reference to element at given index. */ ! RTK_API RCHAR &at(int idx) { copy(); return sh->str[idx]; } /** Get element at index. *************** *** 410,428 **** * @return Element at given index. */ ! const RCHAR &at(int idx) const { return sh->str[idx]; } ! int GetRefCount() const { return ((sh) ? sh->ref : 0); } protected: /** Copy string top of current string. */ ! void Assign(const char *buf, int buflen, int oldlen=0); ! void Assign(const wchar_t *buf, int buflen, int oldlen=0); /** (re)Alloc size elements in internal storage */ ! void Alloc(int size); ! void deref(); ! void ref(); ! void copy(); String_Shared *sh; --- 410,428 ---- * @return Element at given index. */ ! RTK_API const RCHAR &at(int idx) const { return sh->str[idx]; } ! RTK_API int GetRefCount() const { return ((sh) ? sh->ref : 0); } protected: /** Copy string top of current string. */ ! RTK_API void Assign(const char *buf, int buflen, int oldlen=0); ! RTK_API void Assign(const wchar_t *buf, int buflen, int oldlen=0); /** (re)Alloc size elements in internal storage */ ! RTK_API void Alloc(int size); ! RTK_API void deref(); ! RTK_API void ref(); ! RTK_API void copy(); String_Shared *sh; |