Line data Source code
1 : /* File: universal_output_stream.inl; Copyright and License: see below */
2 :
3 : #include <assert.h>
4 :
5 3188 : static inline void universal_output_stream_private_init( universal_output_stream_t *this_,
6 : const universal_output_stream_if_t *interface,
7 : universal_output_stream_impl_t* objectdata )
8 : {
9 3188 : assert( interface != NULL );
10 3188 : assert( objectdata != NULL );
11 3188 : (*this_).interface = interface;
12 3188 : (*this_).objectdata = objectdata;
13 3188 : }
14 :
15 3180 : static inline u8_error_t universal_output_stream_private_destroy( universal_output_stream_t *this_ )
16 : {
17 3180 : assert( (*this_).interface != NULL );
18 3180 : assert( (*this_).objectdata != NULL );
19 : /*int result = (*( (*((*this_).interface)).destroy )) ( (*this_).objectdata );*/
20 3180 : (*this_).interface = NULL;
21 3180 : (*this_).objectdata = NULL;
22 : /*return result;*/
23 3180 : return U8_ERROR_NONE;
24 : }
25 :
26 2 : static inline const universal_output_stream_if_t* universal_output_stream_get_interface ( universal_output_stream_t *this_ )
27 : {
28 2 : assert( (*this_).interface != NULL );
29 2 : return (*this_).interface;
30 : }
31 :
32 2 : static inline universal_output_stream_impl_t* universal_output_stream_get_objectdata ( universal_output_stream_t *this_ )
33 : {
34 2 : assert( (*this_).objectdata != NULL );
35 2 : return (*this_).objectdata;
36 : }
37 :
38 21474 : static inline u8_error_t universal_output_stream_write ( universal_output_stream_t* this_, const void *start, size_t length )
39 : {
40 21474 : assert( (*this_).interface != NULL );
41 21474 : assert( (*this_).objectdata != NULL );
42 21474 : assert( (*((*this_).interface)).write != NULL );
43 21474 : return (*( (*((*this_).interface)).write )) ( (*this_).objectdata, start, length );
44 : }
45 :
46 21021 : static inline u8_error_t universal_output_stream_flush ( universal_output_stream_t* this_ )
47 : {
48 21021 : assert( (*this_).interface != NULL );
49 21021 : assert( (*this_).objectdata != NULL );
50 21021 : assert( (*((*this_).interface)).flush != NULL );
51 21021 : return (*( (*((*this_).interface)).flush )) ( (*this_).objectdata );
52 : }
53 :
54 :
55 : /*
56 : Copyright 2020-2026 Andreas Warnke
57 :
58 : Licensed under the Apache License, Version 2.0 (the "License");
59 : you may not use this file except in compliance with the License.
60 : You may obtain a copy of the License at
61 :
62 : http://www.apache.org/licenses/LICENSE-2.0
63 :
64 : Unless required by applicable law or agreed to in writing, software
65 : distributed under the License is distributed on an "AS IS" BASIS,
66 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67 : See the License for the specific language governing permissions and
68 : limitations under the License.
69 : */
|