forked from dxFeed/dxfeed-c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBufferedInput.h
135 lines (117 loc) · 4.69 KB
/
BufferedInput.h
1
2
3
4
5
6
7
8
9
10
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original Code is Devexperts LLC.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*/
#ifndef BUFFERED_INPUT_H_INCLUDED
#define BUFFERED_INPUT_H_INCLUDED
#include "BufferedIOCommon.h"
/* -------------------------------------------------------------------------- */
/*
* Connection context functions
*/
/* -------------------------------------------------------------------------- */
void* dx_get_buffered_input_connection_context (dxf_connection_t connection);
/* -------------------------------------------------------------------------- */
/*
* Buffer manipulators
*/
/* -------------------------------------------------------------------------- */
dxf_byte_t* dx_get_in_buffer (void* context);
int dx_get_in_buffer_length (void* context);
void dx_set_in_buffer (void* context, dxf_byte_t* new_buffer, int new_length);
int dx_get_in_buffer_position (void* context);
void dx_set_in_buffer_position (void* context, int new_position);
int dx_get_in_buffer_limit (void* context);
void dx_set_in_buffer_limit (void* context, int new_limit);
/* -------------------------------------------------------------------------- */
/*
* Read operations
*/
/* -------------------------------------------------------------------------- */
int dx_read_boolean (void* context, OUT dxf_bool_t* value);
int dx_read_byte (void* context, OUT dxf_byte_t* value);
int dx_read_unsigned_byte (void* context, OUT dxf_uint_t* value);
int dx_read_short (void* context, OUT dxf_short_t* value);
int dx_read_unsigned_short (void* context, OUT dxf_uint_t* value);
int dx_read_char (void* context, OUT dxf_char_t* value);
int dx_read_int (void* context, OUT dxf_int_t* value);
int dx_read_long (void* context, OUT dxf_long_t* value);
int dx_read_float (void* context, OUT dxf_float_t* value);
int dx_read_double (void* context, OUT dxf_double_t* value);
int dx_read_line (void* context, OUT dxf_string_t* value);
/*
int dx_read_utf (void* context, OUT dxf_string_t* value);
*/
/* -------------------------------------------------------------------------- */
/*
* Compact read operations
*/
/* -------------------------------------------------------------------------- */
/*
* Reads an dx_int_t value in a compact format.
* If actual encoded value does not fit into an dx_int_t data type,
* then it is truncated to dx_int_t value (only lower 32 bits are returned);
* the number is read entirely in this case.
*
* @param value - the dx_int_t value read
*/
int dx_read_compact_int (void* context, OUT dxf_int_t* value);
/*
* Reads a dx_long_t value in a compact format.
*
* @param value - the dx_long_t value read
*/
int dx_read_compact_long (void* context, OUT dxf_long_t* value);
/*
* Reads an array of bytes in a compact encapsulation format.
* This method defines length as a number of bytes.
*
* @param value - the byte array read
*
* Note: you must to free returned byte array itself.
*/
int dx_read_byte_array (void* context, OUT dxf_byte_array_t* value);
/* -------------------------------------------------------------------------- */
/*
* UTF read operations
*/
/* -------------------------------------------------------------------------- */
/*
* Reads Unicode code point in a UTF-8 format.
* Overlong UTF-8 and CESU-8-encoded surrogates are accepted and read without errors.
*
* @param value - the Unicode code point read
*/
int dx_read_utf_char (void* context, OUT dxf_int_t* value);
/*
* Reads Unicode string in a UTF-8 format with compact encapsulation.
* Overlong UTF-8 and CESU-8-encoded surrogates are accepted and read without errors.
* This method defines length as a number of characters.
*
* @param value - the Unicode string read
*/
int dx_read_utf_char_array (void* context, OUT dxf_string_t* value);
/*
* Reads Unicode string in a UTF-8 format with compact encapsulation.
* Overlong UTF-8 and CESU-8-encoded surrogates are accepted and read without errors.
* This method defines length as a number of bytes.
*
* @param value - the Unicode string read
*/
int dx_read_utf_string (void* context, OUT dxf_string_t* value);
void dx_get_raw(void* context, OUT dxf_ubyte_t** raw, OUT dxf_int_t* len);
#endif /* BUFFERED_INPUT_H_INCLUDED */