ObjFW  Diff

Differences From Artifact [0915ec3638]:

To Artifact [d7703b509d]:


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
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







-
-
-
-
+
+
+
+








-
+







-
+







@class OFString;
@class OFDataArray;

/**
 * \brief A base class for different types of streams.
 *
 * IMPORTANT: If you want to subclass this, override _readNBytes:intoBuffer:,
 * _writeNBytes:fromBuffer: and _atEndOfStream, but nothing else. Those are not
 * defined in the headers, but do the actual work. OFStream uses those and does
 * all the caching and other stuff. If you override these methods without the
 * _ prefix, you *WILL* break caching and get broken results!
 * _writeNBytes:fromBuffer: and _isAtEndOfStream, but nothing else. Those are
 * not defined in the headers, but do the actual work. OFStream uses those and
 * does all the caching and other stuff. If you override these methods without
 * the _ prefix, you *WILL* break caching and get broken results!
 */
@interface OFStream: OFObject
{
@public
	char   *cache;
@protected
	char   *wBuffer;
	size_t cacheLen, wBufferLen;
	BOOL   bufferWrites;;
	BOOL   buffersWrites;
}

/**
 * Returns a boolean whether the end of the stream has been reached.
 *
 * \return A boolean whether the end of the stream has been reached
 */
- (BOOL)atEndOfStream;
- (BOOL)isAtEndOfStream;

/**
 * Reads at most size bytes from the stream into a buffer.
 *
 * \param buf The buffer into which the data is read
 * \param size The size of the data that should be read at most.
 *	       The buffer MUST be at least size big!
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210

211
212
213
214
215
216
217
196
197
198
199
200
201
202

203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







-
+






-
+







 */
- (OFString*)readTillDelimiter: (OFString*)delimiter
		  withEncoding: (enum of_string_encoding)encoding;

/**
 * \return A boolean whether writes are buffered
 */
- (BOOL)bufferWrites;
- (BOOL)buffersWrites;

/**
 * Enables or disables the write buffer.
 *
 * \param enable Whether the write buffer should be enabled or disabled
 */
- (void)setBufferWrites: (BOOL)enable;
- (void)setBuffersWrites: (BOOL)enable;

/**
 * Writes everythig in the write buffer to the stream.
 */
- (void)flushWriteBuffer;

/**