ClanLib
2.3.7
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
Sources
API
Core
IOData
iodevice.h
Go to the documentation of this file.
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2011 The ClanLib Team
4
**
5
** This software is provided 'as-is', without any express or implied
6
** warranty. In no event will the authors be held liable for any damages
7
** arising from the use of this software.
8
**
9
** Permission is granted to anyone to use this software for any purpose,
10
** including commercial applications, and to alter it and redistribute it
11
** freely, subject to the following restrictions:
12
**
13
** 1. The origin of this software must not be misrepresented; you must not
14
** claim that you wrote the original software. If you use this software
15
** in a product, an acknowledgment in the product documentation would be
16
** appreciated but is not required.
17
** 2. Altered source versions must be plainly marked as such, and must not be
18
** misrepresented as being the original software.
19
** 3. This notice may not be removed or altered from any source distribution.
20
**
21
** Note: Some of the libraries ClanLib may link to may have additional
22
** requirements or restrictions.
23
**
24
** File Author(s):
25
**
26
** Magnus Norddahl
27
** Mark Page
28
*/
29
32
33
#pragma once
34
35
#include "../api_core.h"
36
#include "../System/cl_platform.h"
37
#include "../System/sharedptr.h"
38
39
class
CL_IODeviceProvider
;
40
class
CL_IODevice_Impl;
41
48
class
CL_API_CORE
CL_IODevice
49
{
52
53
public
:
55
enum
SeekMode
56
{
58
seek_set
,
59
61
seek_cur
,
62
64
seek_end
65
};
66
70
71
public
:
73
CL_IODevice
();
74
78
CL_IODevice
(
CL_IODeviceProvider
*provider);
79
80
~
CL_IODevice
();
81
85
86
public
:
88
bool
is_null
()
const
{
return
!impl; }
89
91
void
throw_if_null()
const
;
92
94
96
int
get_size()
const
;
97
99
101
int
get_position()
const
;
102
104
105
bool
is_little_endian()
const
;
106
108
const
CL_IODeviceProvider
*get_provider()
const
;
109
111
CL_IODeviceProvider
*get_provider();
112
116
117
public
:
119
124
int
send(
const
void
*data,
int
len,
bool
send_all =
true
);
125
133
int
receive(
void
*data,
int
len,
bool
receive_all =
true
);
134
140
int
peek(
void
*data,
int
len);
141
147
bool
seek(
int
position, SeekMode mode = seek_set);
148
156
int
read(
void
*data,
int
len,
bool
receive_all =
true
);
157
165
int
write(
const
void
*data,
int
len,
bool
send_all =
true
);
166
168
void
set_system_mode();
169
171
void
set_big_endian_mode();
172
174
void
set_little_endian_mode();
175
179
void
write_int64(
cl_byte64
data);
180
184
void
write_uint64(
cl_ubyte64
data);
185
189
void
write_int32(
cl_byte32
data);
190
194
void
write_uint32(
cl_ubyte32
data);
195
199
void
write_int16(
cl_byte16
data);
200
204
void
write_uint16(
cl_ubyte16
data);
205
209
void
write_int8(
cl_byte8
data);
210
214
void
write_uint8(
cl_ubyte8
data);
215
221
void
write_float(
float
data);
222
229
void
write_string_a(
const
CL_StringRef8
&str);
230
236
void
write_string_nul(
const
CL_StringRef8
&str);
237
245
void
write_string_text(
const
CL_StringRef8
&str);
246
248
249
cl_byte64
read_int64();
250
252
253
cl_ubyte64
read_uint64();
254
256
257
cl_byte32
read_int32();
258
260
261
cl_ubyte32
read_uint32();
262
264
265
cl_byte16
read_int16();
266
268
269
cl_ubyte16
read_uint16();
270
272
273
cl_byte8
read_int8();
274
276
277
cl_ubyte8
read_uint8();
278
280
282
float
read_float();
283
285
288
CL_String8
read_string_a();
289
291
294
CL_String8
read_string_nul();
295
305
CL_String8
read_string_text(
const
char
*skip_initial_chars,
const
char
*read_until_chars,
bool
allow_eof =
true
);
306
308
CL_IODevice
duplicate();
309
313
314
protected
:
315
CL_SharedPtr<CL_IODevice_Impl>
impl
;
317
};
318
Generated on Fri Jun 14 2013 13:05:45 for ClanLib by
1.8.4