xref: /haiku/headers/os/locale/TextEncoding.h (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
1 /*
2  * Copyright 2016, Haiku, inc.
3  * Distributed under terms of the MIT license.
4  */
5 
6 
7 #ifndef TEXTENCODING_H
8 #define TEXTENCODING_H
9 
10 
11 #include <String.h>
12 
13 #include <stddef.h>
14 
15 
16 struct UConverter;
17 
18 
19 namespace BPrivate {
20 
21 
22 class BTextEncoding {
23 public:
24 								BTextEncoding(BString name);
25 								BTextEncoding(const char* data, size_t length);
26 
27 								~BTextEncoding();
28 
29 			status_t			InitCheck();
30 			BString				GetName();
31 
32 			status_t			Encode(const char* input, size_t& inputLength,
33 									char* output, size_t& outputLength);
34 			status_t			Decode(const char* input, size_t& inputLength,
35 									char* output, size_t& outputLength);
36 			status_t			Flush(char* output, size_t& outputLength);
37 
38 private:
39 			BString				fName;
40 
41 			UConverter*			fUtf8Converter;
42 			UConverter*			fConverter;
43 };
44 
45 
46 };
47 
48 
49 #endif /* TEXTENCODING_H */
50