Adapted to recent changes of %build_linklib.
[AROS-Contrib.git] / FryingPan / framework / Generic / String.h
bloba93328cf0f51f2c3abede2a7c34607947952dd0d
1 /*
2 * Amiga Generic Set - set of libraries and includes to ease sw development for all Amiga platforms
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef _GEN_STRING_H_
21 #define _GEN_STRING_H_
23 #include <dos/dos.h>
24 #include "Types.h"
25 #include "VectorT.h"
27 #ifdef String
28 #undef String
29 #endif
31 namespace GenNS
33 class String
35 unsigned long lMaxLen;
36 unsigned long lLength;
37 unsigned char *sContents;
39 protected:
40 void Clone(const char* sStr, unsigned int count);
41 public:
42 String(void);
43 String(const char* s);
44 String(const String &s);
45 ~String();
46 const char *Data(void) const;
47 void Assign(const char *s);
48 void Assign(const String *s);
49 int Length(void) const;
50 void SetLength(unsigned long lLength); // sets length of element + adds pad zero
51 void Update(); // recalc length
52 int FormatStr(const char *sFmtStr, void *pParams);
53 operator char*() const;
54 operator unsigned char*() const;
55 String &operator = (const String & sStr);
56 String &operator = (const int64 sVal);
57 String operator + (const char *sStr);
58 String operator + (const String & sStr);
59 String &operator += (const char *sStr);
60 String &operator += (const char cChar);
61 int operator < (const String sStr) const;
62 int operator < (const char* sStr) const;
63 int operator == (const String sStr) const;
64 int operator == (const char *sStr) const;
65 bool Equals(const char* sOther);
66 bool EqualsIgnoreCase(const char* sOther);
67 int Compare(const char* sOther) const;
68 int CompareIgnoreCase(const char* sOther) const;
69 char &operator [] (int lOffset);
70 void AddPath(const char* sElement);
72 void AllocBuf(unsigned int lSize);
73 void ReallocBuf(unsigned int lSize);
75 unsigned long TrimChars(const char* sChars);
76 int32 ToLong();
77 int64 ToQuad();
78 String SubString(int lFirst, int lLen);
79 String &Substitute(const char* src, const char* dst);
80 String LeftString(int lLen);
81 String RightString(int lLen);
83 String &UpperCase();
84 String &LowerCase();
86 void StrLCpy(const char* src, int len);
87 void BstrCpy(BSTR src);
89 String &ToUTF8();
90 String &FromUTF8();
92 VectorT<String> Explode(); // splits string into words "and phrases"
96 String operator + (const char *sStr1, const String sStr2);
99 #endif //_STRING_H_