Line data Source code
1 : /* File: universal_output_stream.inl; Copyright and License: see below */
2 :
3 : #include <assert.h>
4 :
5 2532 : 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 2532 : assert( interface != NULL );
10 2532 : assert( objectdata != NULL );
11 2532 : (*this_).interface = interface;
12 2532 : (*this_).objectdata = objectdata;
13 2532 : }
14 :
15 2524 : static inline u8_error_t universal_output_stream_private_destroy( universal_output_stream_t *this_ )
16 : {
17 2524 : assert( (*this_).interface != NULL );
18 2524 : assert( (*this_).objectdata != NULL );
19 : /*int result = (*( (*((*this_).interface)).destroy )) ( (*this_).objectdata );*/
20 2524 : (*this_).interface = NULL;
21 2524 : (*this_).objectdata = NULL;
22 : /*return result;*/
23 2524 : 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 19660 : static inline u8_error_t universal_output_stream_write ( universal_output_stream_t* this_, const void *start, size_t length )
39 : {
40 19660 : assert( (*this_).interface != NULL );
41 19660 : assert( (*this_).objectdata != NULL );
42 19660 : assert( (*((*this_).interface)).write != NULL );
43 19660 : return (*( (*((*this_).interface)).write )) ( (*this_).objectdata, start, length );
44 : }
45 :
46 19272 : static inline u8_error_t universal_output_stream_flush ( universal_output_stream_t* this_ )
47 : {
48 19272 : assert( (*this_).interface != NULL );
49 19272 : assert( (*this_).objectdata != NULL );
50 19272 : assert( (*((*this_).interface)).flush != NULL );
51 19272 : return (*( (*((*this_).interface)).flush )) ( (*this_).objectdata );
52 : }
53 :
54 :
55 : /*
56 : Copyright 2020-2025 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 : */
|