2016-09-25 19:07:09 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2016, Haiku, inc.
|
|
|
|
* Distributed under terms of the MIT license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TEXTENCODING_H
|
|
|
|
#define TEXTENCODING_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
2016-09-26 00:16:19 +03:00
|
|
|
struct UConverter;
|
|
|
|
|
|
|
|
|
2016-09-25 19:07:09 +03:00
|
|
|
class TextEncoding
|
|
|
|
{
|
|
|
|
public:
|
2016-09-26 00:16:19 +03:00
|
|
|
TextEncoding(BString name);
|
2016-09-25 19:07:09 +03:00
|
|
|
TextEncoding(const char* data, size_t length);
|
|
|
|
|
2016-09-26 00:16:19 +03:00
|
|
|
~TextEncoding();
|
|
|
|
|
|
|
|
status_t InitCheck();
|
|
|
|
BString GetName();
|
|
|
|
|
|
|
|
status_t Encode(const char* input, size_t& inputLength, char* output,
|
|
|
|
size_t& outputLength);
|
|
|
|
status_t Decode(const char* input, size_t& inputLength, char* output,
|
|
|
|
size_t& outputLength);
|
|
|
|
status_t Flush(char* output, size_t& outputLength);
|
2016-09-25 19:07:09 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
BString fName;
|
2016-09-26 00:16:19 +03:00
|
|
|
|
|
|
|
UConverter* fUtf8Converter;
|
|
|
|
UConverter* fConverter;
|
2016-09-25 19:07:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-26 00:16:19 +03:00
|
|
|
#endif /* TEXTENCODING_H */
|