ObjFW  Diff

Differences From Artifact [d4d814f095]:

To Artifact [3ff6ad57f0]:


11
12
13
14
15
16
17
18

19
20






21





22
23
24






25
26

27
28


29

30
31

32
33

34
35









36
37


38
39

40
41


42
43


44
45

46
47
48


49
50
51
52
53

54
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75








76
77
78
79
80


81
82

83
84
85
86
87

88
89
90
91
92
93
94
11
12
13
14
15
16
17

18
19

20
21
22
23
24
25
26
27
28
29
30
31



32
33
34
35
36
37
38

39
40
41
42
43

44


45
46

47
48
49
50
51
52
53
54
55
56
57
58


59
60
61

62
63
64
65
66


67
68
69

70
71
72

73
74
75
76
77
78

79
80

81
82
83
84
85
86
87







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105


106
107
108

109
110
111
112
113

114
115
116
117
118
119
120
121







-
+

-
+
+
+
+
+
+

+
+
+
+
+
-
-
-
+
+
+
+
+
+

-
+


+
+
-
+
-
-
+

-
+


+
+
+
+
+
+
+
+
+
-
-
+
+

-
+


+
+
-
-
+
+

-
+


-
+
+




-
+

-
+






-
-
-
-
-
-
-







+
+
+
+
+
+
+
+



-
-
+
+

-
+




-
+








#import <wchar.h>
#import <stddef.h>

#import "OFObject.h"

/**
 * The OFString class can store and modify string of different types.
 * A class for storing and modifying strings.
 */
@interface OFString: OFObject {}
@interface OFString: OFObject
{
	wchar_t	*string;
	size_t  length;
}

/**
 * Creates a new OFString.
 * 
 * \return An initialized OFString
 */
+ new;
 * \param str A constant C string from which the new OFConstCString will be
 *	  created
 * \return A new OFConstCString

/**
 * Creates a new OFString from a C string.
 * 
 * \param str A C string to initialize the OFString with
 * \return A new OFString
 */
+ newAsConstCString: (const char*)str;
+ newFromCString: (const char*)str;

/**
 * Creates a new OFString from a wide C string.
 * 
 * \param str A constant wide C string from which the new OFConstCString will be
 * \param str A wide C string to initialize the OFString with
 *	  created
 * \return A new OFConstWideCString
 * \return A new OFString
 */
+ newAsConstWideCString: (const wchar_t*)str;
+ newFromWideCString: (const wchar_t*)str;

/**
 * Initializes an already allocated OFString.
 *
 * \return An initialized OFString
 */
- init;

/**
 * Initializes an already allocated OFString from a C string.
 * 
 * \param str A C string from which the new OFConstCString will be created
 * \return A new OFCString
 * \param str A C string to initialize the OFString with
 * \return An initialized OFString
 */
+ newAsCString: (char*)str;
- initFromCString: (const char*)str;

/**
 * Initializes an already allocated OFString from a wide C string.
 * 
 * \param str A wide C string from which the new OFConstCString will be created
 * \return A new OFWideCString
 * \param str A wide C string to initialize the OFString with
 * \return An initialized OFString
 */
+ newAsWideCString: (wchar_t*)str;
- initFromWideCString: (const wchar_t*)str;

/**
 * \return The OFString as a C-type string of the type it was created as
 * \return The OFString as a C string, if possible (if not, returns NULL).
 *         If not needed anymore, it is usefull to call freeMem:.
 */
- (char*)cString;

/**
 * \return The OFString as a C-type wide string of the type it was created as
 * \return The OFString as a wide C string
 */
- (wchar_t*)wCString;
- (wchar_t*)wideCString;

/**
 * \return The length of the OFString
 */
- (size_t)length;

/**
 * Sets the OFString to the specified OFString.
 *
 * \param str The OFString to set the current OFString to
 */
- (OFString*)setTo: (OFString*)str;

/**
 * Clones the OFString, creating a new one.
 * 
 * \return A copy of the OFString
 */
- (OFString*)clone;

/**
 * Frees the OFString and sets it to the specified OFString.
 *
 * \param str An OFString to set the OFString to.
 * \return The new OFString
 */
- (OFString*)setTo: (OFString*)str;

/**
 * Compares the OFString to another OFString.
 *
 * \param str An OFString in a compatible type to compare with
 * \return An integer which is the result of the comparison, see strcmp
 * \param str An OFString to compare with
 * \return An integer which is the result of the comparison, see wcscmp
 */
- (int)compareTo: (OFString*)str;
- (int)compare: (OFString*)str;

/**
 * Append another OFString to the OFString.
 *
 * \param str An OFString in a compatible type to append
 * \param str An OFString to append
 */
- append: (OFString*)str;

/**
 * Append a C string to the OFString.
 *
 * \param str A C string to append