Delete all Trailing spaces in code.
[reactos.git] / rosapps / smartpdf / poppler / poppler / UGooString.h
1 //========================================================================
2 //
3 // UGooString.h
4 //
5 // Unicode string
6 //
7 // Copyright 2005 Albert Astals Cid <aacid@kde.org>
8 //
9 //========================================================================
10
11 #ifndef UGooString_H
12 #define UGooString_H
13
14 #include "CharTypes.h"
15
16 class GooString;
17
18 class UGooString
19 {
20 public:
21
22 // Create empty unicode string
23 UGooString(void);
24
25 // Create a unicode string from <str>.
26 UGooString(GooString &str);
27
28 // Copy the unicode string
29 UGooString(const UGooString &str);
30
31 // Create a unicode string from <str>.
32 UGooString(const char *str, int strLen = CALC_STRING_LEN);
33
34 UGooString *Set(const char *str, int strLen = CALC_STRING_LEN);
35 UGooString *Set(const UGooString &str);
36
37 // Set the string to empty string, freeing all dynamically allocated memory
38 // as a side effect
39 UGooString *clear(void);
40
41 ~UGooString();
42
43 void resize(int newLength);
44
45 int getLength() const { return length; }
46
47 // Compare two strings: -1:< 0:= +1:>
48 int cmp(const UGooString *str) const;
49 int cmp(const UGooString &str) const;
50 int cmp(const char *str, int strLen = CALC_STRING_LEN) const;
51
52 // get the unicode
53 Unicode *unicode() const { return s; }
54
55 // Return a newly allocated copy of the string converted to
56 // ascii (non-Unicode) format. Caller has to delete [] the result
57 char *getCStringCopy() const;
58
59 // a special value telling that the length of the string is not given
60 // so it must be calculated from the strings
61 static const int CALC_STRING_LEN = -1;
62
63 private:
64 // you can tweak this number for a different speed/memory usage tradeoffs.
65 // In libc malloc() rounding is 16 so it's best to choose a value that
66 // results in sizeof(UGooString) be a multiple of 16.
67 // 20 makes sizeof(UGooString) to be 48.
68 static const int STR_STATIC_SIZE = 20;
69
70 int roundedSize(int len);
71 void initChar(const char *str, int strLen);
72
73 Unicode sStatic[STR_STATIC_SIZE];
74 int length;
75 Unicode *s;
76 };
77
78 #endif