Line data Source code
1 : /* File: universal_null_output_stream.c; Copyright and License: see below */ 2 : 3 : #include "u8stream/universal_null_output_stream.h" 4 : #include "u8stream/universal_output_stream_if.h" 5 : #include "u8/u8_trace.h" 6 : #include "u8/u8_log.h" 7 : #include <stdbool.h> 8 : #include <assert.h> 9 : 10 : /* the vmt implementing the interface */ 11 : static const universal_output_stream_if_t universal_null_output_stream_private_if 12 : = { 13 : .write = (u8_error_t (*)(universal_output_stream_impl_t*, const void*, size_t)) &universal_null_output_stream_write, 14 : .flush = (u8_error_t (*)(universal_output_stream_impl_t*)) &universal_null_output_stream_flush 15 : }; 16 : 17 16 : void universal_null_output_stream_init ( universal_null_output_stream_t *this_ ) 18 : { 19 16 : U8_TRACE_BEGIN(); 20 : 21 16 : universal_output_stream_private_init( &((*this_).output_stream), &universal_null_output_stream_private_if, this_ ); 22 : 23 16 : U8_TRACE_END(); 24 16 : } 25 : 26 16 : u8_error_t universal_null_output_stream_destroy( universal_null_output_stream_t *this_ ) 27 : { 28 16 : U8_TRACE_BEGIN(); 29 16 : u8_error_t err = U8_ERROR_NONE; 30 : 31 16 : universal_output_stream_private_destroy( &((*this_).output_stream) ); 32 : 33 16 : U8_TRACE_END_ERR(err); 34 16 : return err; 35 : } 36 : 37 8 : u8_error_t universal_null_output_stream_write ( universal_null_output_stream_t *this_, const void *start, size_t length ) 38 : { 39 : /*U8_TRACE_BEGIN();*/ 40 8 : u8_error_t err = U8_ERROR_NONE; 41 : 42 : /*U8_TRACE_END_ERR(err);*/ 43 8 : return err; 44 : } 45 : 46 17 : u8_error_t universal_null_output_stream_flush( universal_null_output_stream_t *this_ ) 47 : { 48 17 : U8_TRACE_BEGIN(); 49 17 : u8_error_t err = U8_ERROR_NONE; 50 : 51 17 : U8_TRACE_END_ERR(err); 52 17 : return err; 53 : } 54 : 55 16 : universal_output_stream_t* universal_null_output_stream_get_output_stream( universal_null_output_stream_t *this_ ) 56 : { 57 16 : U8_TRACE_BEGIN(); 58 : 59 16 : universal_output_stream_t* result = &((*this_).output_stream); 60 : 61 16 : U8_TRACE_END(); 62 16 : return result; 63 : } 64 : 65 : 66 : /* 67 : Copyright 2020-2024 Andreas Warnke 68 : 69 : Licensed under the Apache License, Version 2.0 (the "License"); 70 : you may not use this file except in compliance with the License. 71 : You may obtain a copy of the License at 72 : 73 : http://www.apache.org/licenses/LICENSE-2.0 74 : 75 : Unless required by applicable law or agreed to in writing, software 76 : distributed under the License is distributed on an "AS IS" BASIS, 77 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 78 : See the License for the specific language governing permissions and 79 : limitations under the License. 80 : */