TextEncoding.h revision a71b10d7
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
16struct UConverter;
17
18
19namespace BPrivate {
20
21
22class BTextEncoding
23{
24public:
25								BTextEncoding(BString name);
26								BTextEncoding(const char* data, size_t length);
27
28								~BTextEncoding();
29
30			status_t			InitCheck();
31			BString				GetName();
32
33			status_t			Encode(const char* input, size_t& inputLength,
34									char* output, size_t& outputLength);
35			status_t			Decode(const char* input, size_t& inputLength,
36									char* output, size_t& outputLength);
37			status_t			Flush(char* output, size_t& outputLength);
38
39private:
40			BString				fName;
41
42			UConverter*			fUtf8Converter;
43			UConverter*			fConverter;
44};
45
46
47};
48
49
50#endif /* TEXTENCODING_H */
51