1 /*
2  * Byte stream functions
3  *
4  * Copyright (C) 2008-2020, Joachim Metz <joachim.metz@gmail.com>
5  *
6  * Refer to AUTHORS for acknowledgements.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined( _LIBUNA_BYTE_STREAM_H )
23 #define _LIBUNA_BYTE_STREAM_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libuna_extern.h"
29 #include "libuna_libcerror.h"
30 #include "libuna_types.h"
31 
32 #if defined( __cplusplus )
33 extern "C" {
34 #endif
35 
36 LIBUNA_EXTERN \
37 int libuna_byte_stream_size_from_utf8(
38      const libuna_utf8_character_t *utf8_string,
39      size_t utf8_string_size,
40      int codepage,
41      size_t *byte_stream_size,
42      libcerror_error_t **error );
43 
44 LIBUNA_EXTERN \
45 int libuna_byte_stream_copy_from_utf8(
46      uint8_t *byte_stream,
47      size_t byte_stream_size,
48      int codepage,
49      const libuna_utf8_character_t *utf8_string,
50      size_t utf8_string_size,
51      libcerror_error_t **error );
52 
53 /* The functionality for libuna_byte_stream_copy_to_utf8 is implemented by
54  * libuna_utf8_string_copy_from_byte_stream
55  */
56 
57 LIBUNA_EXTERN \
58 int libuna_byte_stream_size_from_utf16(
59      const libuna_utf16_character_t *utf16_string,
60      size_t utf16_string_size,
61      int codepage,
62      size_t *byte_stream_size,
63      libcerror_error_t **error );
64 
65 LIBUNA_EXTERN \
66 int libuna_byte_stream_copy_from_utf16(
67      uint8_t *byte_stream,
68      size_t byte_stream_size,
69      int codepage,
70      const libuna_utf16_character_t *utf16_string,
71      size_t utf16_string_size,
72      libcerror_error_t **error );
73 
74 /* The functionality for libuna_byte_stream_copy_to_utf16 is implemented by
75  * libuna_utf16_string_copy_from_byte_stream
76  */
77 
78 LIBUNA_EXTERN \
79 int libuna_byte_stream_size_from_utf32(
80      const libuna_utf32_character_t *utf32_string,
81      size_t utf32_string_size,
82      int codepage,
83      size_t *byte_stream_size,
84      libcerror_error_t **error );
85 
86 LIBUNA_EXTERN \
87 int libuna_byte_stream_copy_from_utf32(
88      uint8_t *byte_stream,
89      size_t byte_stream_size,
90      int codepage,
91      const libuna_utf32_character_t *utf32_string,
92      size_t utf32_string_size,
93      libcerror_error_t **error );
94 
95 /* The functionality for libuna_byte_stream_copy_to_utf32 is implemented by
96  * libuna_utf32_string_copy_from_byte_stream
97  */
98 
99 #if defined( __cplusplus )
100 }
101 #endif
102 
103 #endif /* !defined( _LIBUNA_BYTE_STREAM_H ) */
104 
105