Repository navigation
Expand file tree
/
Copy pathseaplus_setters.h
More file actions
172 lines (137 loc) · 4.56 KB
/
Copy pathseaplus_setters.h
File metadata and controls
172 lines (137 loc) · 4.56 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
* Copyright (C) 2018-2026 Olivier Boudeville
*
* This file is part of the Ceylan-Seaplus library.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License or
* the GNU General Public License, as they are published by the Free Software
* Foundation, either version 3 of these Licenses, or (at your option)
* any later version.
* You can also redistribute it and/or modify it under the terms of the
* Mozilla Public License, version 1.1 or later.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License and the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License, of the GNU General Public License and of the Mozilla Public License
* along with this library.
* If not, see <http://www.gnu.org/licenses/> and
* <http://www.mozilla.org/MPL/>.
*
* Author: Olivier Boudeville [olivier (dot) boudeville (at) esperide (dot) com]
* Creation date: Sunday, December 16, 2018.
*
*/
#ifndef _SEAPLUS_SETTERS_H_
#define _SEAPLUS_SETTERS_H_
// Accessors to (result) values (setters):
/**
* Writes in the specified return buffer the specified boolean result.
*
*/
void write_bool_result( output_buffer * output_sm_buf, bool b ) ;
/**
* Writes in the specified return buffer the specified (signed) integer result.
*
*/
void write_int_result( output_buffer * output_sm_buf, int i ) ;
/**
* Writes in the specified return buffer the specified unsigned integer result.
*
*/
void write_unsigned_int_result( output_buffer * output_sm_buf,
unsigned int u ) ;
/**
* Writes in the specified return buffer the specified double result.
*
*/
void write_double_result( output_buffer * output_sm_buf, double d ) ;
/**
* Writes in the specified return buffer the specified atom result, based on
* the specified (NULL-terminated) string.
*
* Note: not taking ownership of the input string.
*
*/
void write_atom_result( output_buffer * output_sm_buf,
const char * atom_name ) ;
/**
* Writes in the specified return buffer the specified (NULL-terminated) string
* result, of the specified length.
*
* Note: not taking ownership of the input string.
*
*/
void write_string_with_length_result( output_buffer * output_sm_buf,
const char * string, size_t length ) ;
/**
* Writes in the specified return buffer the specified string result.
*
* Note: not taking ownership of the input string.
*
*/
void write_string_result( output_buffer * output_sm_buf, const char * string ) ;
/**
* Writes in the specified return buffer the specified binary result, of the
* specified size.
*
* Note: not taking ownership of the input binary.
*
*/
void write_binary_result( output_buffer * output_sm_buf, const void * content,
byte_count size ) ;
/**
* Writes in the specified return buffer the specified binary result obtained
* from a string.
*
* Note: not taking ownership of the input string.
*
*/
void write_binary_string_result( output_buffer * output_sm_buf,
const char * string ) ;
/**
* Writes in the specified return buffer the specified list header result.
*
* For a list declared of size N (hence having N elements), the N next writes
* will correspond to the expected terms to form said list.
*
* See http://erlang.org/doc/man/ei.html#ei_x_encode_list_header to handle lists
* whose size is not known a priori (see also write_empty_list_result/1).
*
*/
void write_list_header_result( output_buffer * output_sm_buf,
list_size size ) ;
/**
* Writes in the specified return buffer an empty list.
*
* Especially useful to write lists whose size is not known a priori, by
* cons'ing elements one by one until none is left.
*
* See http://erlang.org/doc/man/ei.html#ei_x_encode_list_header for more
* information.
*
*/
void write_empty_list_result( output_buffer * output_sm_buf ) ;
/**
* Writes in the specified return buffer the specified tuple header result.
*
* For a tuple declared of size N (hence having N elements), the N next writes
* will correspond to the expected terms to form said tuple.
*
*/
void write_tuple_header_result( output_buffer * output_sm_buf,
tuple_size size ) ;
/**
* Sends the content of the specified buffer through the port's output file
* descriptor.
*
* Returns the number of bytes written.
*
*/
byte_count write_buffer( output_buffer * output_sm_buf ) ;
#endif // _SEAPLUS_SETTERS_H_