-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibex_byte_array.h
More file actions
executable file
·141 lines (101 loc) · 7.75 KB
/
Copy pathlibex_byte_array.h
File metadata and controls
executable file
·141 lines (101 loc) · 7.75 KB
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
136
137
138
139
140
141
/* -------------------------------------------------------------------------- */
/* (c) ali@balarabe.com [libex_byte_array.h] */
/* -------------------------------------------------------------------------- */
#if !defined INCLUDED_LIBEX_BYTE_ARRAY_H
#define INCLUDED_LIBEX_BYTE_ARRAY_H
#include "libex.h"
/* -------------------------------------------------------------------------- */
LX_NAMESPACE(lx_c)
typedef struct lx_byte_array_t {
uint8_t* ob; /* lx_byte_array_t */
}
lx_byte_array_t, lx_new_byte_array_t;
/* -------------------------------------------------------------------------- */
/* Constructors: */
LX_PUBLIC lx_new_byte_array_t lx_ByteArray_init( void ); /*C*/
LX_PUBLIC lx_new_byte_array_t lx_ByteArray_newCopy( /*C*/
const lx_byte_array_t copy_from_ ); /*-*/
/* -------------------------------------------------------------------------- */
/* Destructor: */
LX_PUBLIC void lx_ByteArray_free( lx_byte_array_t* object_ ); /*D*/
/* -------------------------------------------------------------------------- */
/* Properties: */
LX_PUBLIC lx_bool lx_ByteArray_bof( const lx_byte_array_t object_ ); /*M*/
LX_PUBLIC lx_bool lx_ByteArray_eof( const lx_byte_array_t object_ ); /*P*/
LX_PUBLIC size_t lx_ByteArray_getPosition( /*P*/
const lx_byte_array_t object_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_setPosition( /*P*/
lx_byte_array_t object_, /*-*/
const size_t new_value_ ); /*-*/
LX_PUBLIC size_t lx_ByteArray_getSize( const lx_byte_array_t object_ ); /*P*/
LX_PUBLIC lx_bool lx_ByteArray_setSize( /*P*/
lx_byte_array_t object_, /*-*/
const size_t new_value_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_equal( /*P*/
const lx_byte_array_t object_, /*-*/
const lx_byte_array_t compare_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_matches( /*P*/
const lx_byte_array_t object_, /*-*/
const char* ascii_chars_, /*-*/
const size_t length_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_isCompressed( /*P*/
const lx_byte_array_t object_ ); /*-*/
/* -------------------------------------------------------------------------- */
/* Methods: */
LX_PUBLIC uint8_t* lx_ByteArray_getBuffer( lx_byte_array_t object_ ); /*M*/
LX_PUBLIC void lx_ByteArray_clear( lx_byte_array_t object_ ); /*M*/
LX_PUBLIC void lx_ByteArray_set( /*M*/
lx_byte_array_t object_, /*-*/
const size_t size_in_bytes_, /*-*/
const uint8_t fill_ ); /*-*/
LX_PUBLIC void lx_ByteArray_setCopy( /*C*/
lx_byte_array_t object_, /*-*/
const lx_byte_array_t copy_from_ ); /*-*/
LX_PUBLIC void lx_ByteArray_copyBytes( /*M*/
lx_byte_array_t object_, /*-*/
const void* bytes_, /*-*/
const size_t size_in_bytes_, /*-*/
const lx_bool compressed_ ); /*-*/
LX_PUBLIC void lx_ByteArray_fill( /*M*/
lx_byte_array_t object_, /*-*/
const uint8_t value_ ); /*-*/
LX_PUBLIC uint8_t* lx_ByteArray_detachBuffer( lx_byte_array_t object_ ); /*M*/
LX_PUBLIC lx_bool lx_ByteArray_goBegin( lx_byte_array_t object_ ); /*M*/
LX_PUBLIC lx_bool lx_ByteArray_goEnd( lx_byte_array_t object_ ); /*M*/
LX_PUBLIC lx_bool lx_ByteArray_goBack( /*M*/
lx_byte_array_t object_, /*-*/
const size_t count_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_goForward( /*M*/
lx_byte_array_t object_, /*-*/
const size_t count_ ); /*-*/
LX_PUBLIC lx_chars_t lx_ByteArray_getHexString( /*M*/
lx_byte_array_t object_, /*-*/
const size_t bytes_, /*-*/
const long offset_ ); /*-*/
/* -------------------------------------------------------------------------- */
/* Read/Write Methods: */
LX_PUBLIC lx_bool lx_ByteArray_writeInt( /*M*/
lx_byte_array_t object_, /*-*/
const int value_ ); /*-*/
LX_PUBLIC uint32_t lx_ByteArray_readUnsigned( /*M*/
lx_byte_array_t object_, /*-*/
const size_t bytes_, /*-*/
uint8_t* byte_1_out_, /*-*/
uint8_t* byte_2_out_, /*-*/
uint8_t* byte_3_out_, /*-*/
uint8_t* byte_4_out_ ); /*-*/
LX_PUBLIC uint32_t lx_ByteArray_readUnsignedVariable( /*M*/
lx_byte_array_t object_, /*-*/
size_t* length_in_bytes_out_ ); /*-*/
LX_PUBLIC lx_chars_t lx_ByteArray_readAsciiString( /*M*/
lx_byte_array_t object_, /*-*/
const size_t count_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_writeUnsignedInt( /*M*/
lx_byte_array_t object_, /*-*/
const uint32_t value_ ); /*-*/
LX_PUBLIC lx_bool lx_ByteArray_writeString( /*M*/
lx_byte_array_t object_, /*-*/
lx_chars_t text_, /*-*/
const size_t max_len_ ); /*-*/
LX_END_NAMESPACE /*lx_c*/
#endif /*eof*/