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