Rudiments
filedescriptorinlines.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information
3
4#include <rudiments/charstring.h>
5#include <rudiments/wcharstring.h>
6#include <rudiments/ucs2charstring.h>
7
8
9inline
11 return highLevelWrite((const byte_t *)&number,sizeof(float));
12}
13
14inline
16 return highLevelWrite((const byte_t *)&number,sizeof(double));
17}
18
19inline
21 return highLevelWrite(&character,sizeof(byte_t));
22}
23
24inline
26 return highLevelWrite((const byte_t *)&character,sizeof(char));
27}
28
29inline
31 return highLevelWrite((const byte_t *)&character,sizeof(wchar_t));
32}
33
34inline
36 return highLevelWrite((const byte_t *)&character,sizeof(ucs2_t));
37}
38
39inline
40ssize_t filedescriptor::write(bool value) {
41 return highLevelWrite((const byte_t *)&value,sizeof(bool));
42}
43
44inline
45ssize_t filedescriptor::write(const byte_t *string) {
46 return highLevelWrite(string,
47 charstring::getLength((const char *)string));
48}
49
50inline
51ssize_t filedescriptor::write(const char *string) {
52 return highLevelWrite((const byte_t *)string,
53 charstring::getLength(string));
54}
55
56inline
57ssize_t filedescriptor::write(const wchar_t *string) {
58 return highLevelWrite((const byte_t *)string,
59 wcharstring::getLength(string)*sizeof(wchar_t));
60}
61
62inline
63ssize_t filedescriptor::writeUcs2(const ucs2_t *string) {
64 return highLevelWrite((const byte_t *)string,
65 ucs2charstring::getLength(string)*sizeof(ucs2_t));
66}
67
68inline
69ssize_t filedescriptor::write(const byte_t *string, size_t size) {
70 return highLevelWrite((const byte_t *)string,size);
71}
72
73inline
74ssize_t filedescriptor::write(const char *string, size_t length) {
75 return highLevelWrite((const byte_t *)string,length);
76}
77
78inline
79ssize_t filedescriptor::write(const wchar_t *string, size_t length) {
80 return highLevelWrite((const byte_t *)string,length*sizeof(wchar_t));
81}
82
83inline
84ssize_t filedescriptor::writeUcs2(const ucs2_t *string, size_t length) {
85 return highLevelWrite((const byte_t *)string,length*sizeof(ucs2_t));
86}
87
88inline
89ssize_t filedescriptor::write(const void *buffer, size_t size) {
90 return highLevelWrite((const byte_t *)buffer,size);
91}
92inline
93ssize_t filedescriptor::write(float number, int32_t sec,int32_t usec) {
94 return highLevelWrite((const byte_t *)&number,sizeof(float),sec,usec);
95}
96
97inline
98ssize_t filedescriptor::write(double number, int32_t sec, int32_t usec) {
99 return highLevelWrite((const byte_t *)&number,sizeof(double),sec,usec);
100}
101
102inline
103ssize_t filedescriptor::write(byte_t character, int32_t sec, int32_t usec) {
104 return highLevelWrite(&character,sizeof(byte_t),sec,usec);
105}
106
107inline
108ssize_t filedescriptor::write(char character, int32_t sec, int32_t usec) {
109 return highLevelWrite((const byte_t *)&character,
110 sizeof(char),sec,usec);
111}
112
113inline
114ssize_t filedescriptor::write(wchar_t character, int32_t sec, int32_t usec) {
115 return highLevelWrite((const byte_t *)&character,
116 sizeof(wchar_t),sec,usec);
117}
118
119inline
120ssize_t filedescriptor::writeUcs2(ucs2_t character, int32_t sec, int32_t usec) {
121 return highLevelWrite((const byte_t *)&character,
122 sizeof(ucs2_t),sec,usec);
123}
124
125inline
126ssize_t filedescriptor::write(bool value, int32_t sec, int32_t usec) {
127 return highLevelWrite((const byte_t *)&value,
128 sizeof(bool),sec,usec);
129}
130
131inline
132ssize_t filedescriptor::write(const byte_t *string, size_t size,
133 int32_t sec, int32_t usec) {
134 return highLevelWrite(string,size,sec,usec);
135}
136
137inline
138ssize_t filedescriptor::write(const char *string, size_t length,
139 int32_t sec, int32_t usec) {
140 return highLevelWrite((const byte_t *)string,length,sec,usec);
141}
142
143inline
144ssize_t filedescriptor::write(const wchar_t *string, size_t length,
145 int32_t sec, int32_t usec) {
146 return highLevelWrite((const byte_t *)string,
147 length*sizeof(wchar_t),sec,usec);
148}
149
150inline
151ssize_t filedescriptor::writeUcs2(const ucs2_t *string, size_t length,
152 int32_t sec, int32_t usec) {
153 return highLevelWrite((const byte_t *)string,
154 length*sizeof(ucs2_t),sec,usec);
155}
156
157inline
158ssize_t filedescriptor::write(const byte_t *string, int32_t sec, int32_t usec) {
159 return highLevelWrite(string,
160 charstring::getLength((const char *)string),sec,usec);
161}
162
163inline
164ssize_t filedescriptor::write(const char *string, int32_t sec, int32_t usec) {
165 return highLevelWrite((const byte_t *)string,
167}
168
169inline
170ssize_t filedescriptor::write(const wchar_t *string,
171 int32_t sec, int32_t usec) {
172 return highLevelWrite((const byte_t *)string,
173 wcharstring::getLength(string)*sizeof(wchar_t),sec,usec);
174}
175
176inline
177ssize_t filedescriptor::writeUcs2(const ucs2_t *string,
178 int32_t sec, int32_t usec) {
179 return highLevelWrite((const byte_t *)string,
180 ucs2charstring::getLength(string)*sizeof(ucs2_t),sec,usec);
181}
182
183inline
184ssize_t filedescriptor::write(const void *buffer, size_t size,
185 int32_t sec, int32_t usec) {
186 return highLevelWrite((const byte_t *)buffer,size,sec,usec);
187}
188
189inline
191 return highLevelRead((byte_t *)buffer,sizeof(float));
192}
193
194inline
195ssize_t filedescriptor::read(double *buffer) {
196 return highLevelRead((byte_t *)buffer,sizeof(double));
197}
198
199inline
200ssize_t filedescriptor::read(byte_t *buffer) {
201 return highLevelRead((byte_t *)buffer,sizeof(byte_t));
202}
203
204inline
206 return highLevelRead((byte_t *)buffer,sizeof(char));
207}
208
209inline
210ssize_t filedescriptor::read(wchar_t *buffer) {
211 return highLevelRead((byte_t *)buffer,sizeof(wchar_t));
212}
213
214inline
216 return highLevelRead((byte_t *)buffer,sizeof(ucs2_t));
217}
218
219inline
221 return highLevelRead((byte_t *)buffer,sizeof(bool));
222}
223
224inline
225ssize_t filedescriptor::read(byte_t *buffer, size_t size) {
226 return highLevelRead(buffer,size);
227}
228
229inline
230ssize_t filedescriptor::read(char *buffer, size_t length) {
231 return highLevelRead((byte_t *)buffer,length);
232}
233
234inline
235ssize_t filedescriptor::read(wchar_t *buffer, size_t length) {
236 return highLevelRead((byte_t *)buffer,length*sizeof(wchar_t));
237}
238
239inline
240ssize_t filedescriptor::readUcs2(ucs2_t *buffer, size_t length) {
241 return highLevelRead((byte_t *)buffer,length*sizeof(ucs2_t));
242}
243
244inline
245ssize_t filedescriptor::read(void *buffer, size_t size) {
246 return highLevelRead((byte_t *)buffer,size);
247}
248
249inline
250ssize_t filedescriptor::read(char **buffer, const char *terminator) {
251 return input::read(buffer,terminator,0,'\0',-1,-1);
252}
253
254inline
256 const char *terminator, size_t maxbytes) {
257 return input::read(buffer,terminator,maxbytes,'\0',-1,-1);
258}
259inline
260ssize_t filedescriptor::read(float *buffer, int32_t sec, int32_t usec) {
261 return highLevelRead((byte_t *)buffer,sizeof(float),sec,usec);
262}
263
264inline
265ssize_t filedescriptor::read(double *buffer, int32_t sec, int32_t usec) {
266 return highLevelRead((byte_t *)buffer,sizeof(double),sec,usec);
267}
268
269inline
270ssize_t filedescriptor::read(byte_t *buffer, int32_t sec, int32_t usec) {
271 return highLevelRead(buffer,sizeof(byte_t),sec,usec);
272}
273
274inline
275ssize_t filedescriptor::read(char *buffer, int32_t sec, int32_t usec) {
276 return highLevelRead((byte_t *)buffer,sizeof(char),sec,usec);
277}
278
279inline
280ssize_t filedescriptor::read(wchar_t *buffer, int32_t sec, int32_t usec) {
281 return highLevelRead((byte_t *)buffer,sizeof(wchar_t),sec,usec);
282}
283
284inline
285ssize_t filedescriptor::readUcs2(ucs2_t *buffer, int32_t sec, int32_t usec) {
286 return highLevelRead((byte_t *)buffer,sizeof(ucs2_t),sec,usec);
287}
288
289inline
290ssize_t filedescriptor::read(bool *buffer, int32_t sec, int32_t usec) {
291 return highLevelRead((byte_t *)buffer,sizeof(bool),sec,usec);
292}
293
294inline
295ssize_t filedescriptor::read(byte_t *buffer, size_t size,
296 int32_t sec, int32_t usec) {
297 return highLevelRead(buffer,size,sec,usec);
298}
299
300inline
301ssize_t filedescriptor::read(char *buffer, size_t length,
302 int32_t sec, int32_t usec) {
303 return highLevelRead((byte_t *)buffer,length,sec,usec);
304}
305
306inline
307ssize_t filedescriptor::read(wchar_t *buffer, size_t length,
308 int32_t sec, int32_t usec) {
309 return highLevelRead((byte_t *)buffer,
310 length*sizeof(wchar_t),sec,usec);
311}
312
313inline
314ssize_t filedescriptor::readUcs2(ucs2_t *buffer, size_t length,
315 int32_t sec, int32_t usec) {
316 return highLevelRead((byte_t *)buffer,
317 length*sizeof(ucs2_t),sec,usec);
318}
319
320inline
321ssize_t filedescriptor::read(void *buffer, size_t size,
322 int32_t sec, int32_t usec) {
323 return highLevelRead((byte_t *)buffer,size,sec,usec);
324}
325
326inline
327ssize_t filedescriptor::read(char **buffer, const char *terminator,
328 int32_t sec, int32_t usec) {
329 return input::read(buffer,terminator,0,'\0',sec,usec);
330}
331
332inline
333ssize_t filedescriptor::read(char **buffer, const char *terminator,
334 size_t maxbytes, int32_t sec, int32_t usec) {
336}
337
338inline
340 const char *terminator, size_t maxbytes,
341 char escapechar, int32_t sec, int32_t usec) {
343}
Definition avltree.h:11
Definition character.h:11
static size_t getLength(const char *string)
ssize_t write(uint16_t number)
ssize_t readUcs2(ucs2_t *buffer)
Definition filedescriptorinlines.h:215
ssize_t read(uint16_t *buffer)
ssize_t writeUcs2(ucs2_t character)
Definition filedescriptorinlines.h:35
virtual ssize_t read(byte_t *buffer, size_t size)=0
static size_t getLength(const ucs2_t *string)
static size_t getLength(const wchar_t *string)