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-27 21:38:58 +03:00
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
2016-09-27 21:41:26 +03:00
|
|
|
class BTextEncoding {
|
2016-09-27 20:34:52 +03:00
|
|
|
public:
|
2016-09-27 21:38:58 +03:00
|
|
|
BTextEncoding(BString name);
|
|
|
|
BTextEncoding(const char* data, size_t length);
|
2016-09-25 19:07:09 +03:00
|
|
|
|
2016-09-27 21:38:58 +03:00
|
|
|
~BTextEncoding();
|
2016-09-26 00:16:19 +03:00
|
|
|
|
2016-09-27 08:20:47 +03:00
|
|
|
status_t InitCheck();
|
|
|
|
BString GetName();
|
2016-09-26 00:16:19 +03:00
|
|
|
|
2016-09-27 08:20:47 +03:00
|
|
|
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
|
|
|
|
2016-09-27 20:34:52 +03:00
|
|
|
private:
|
2016-09-27 08:20:47 +03:00
|
|
|
BString fName;
|
2016-09-26 00:16:19 +03:00
|
|
|
|
2016-09-27 08:20:47 +03:00
|
|
|
UConverter* fUtf8Converter;
|
|
|
|
UConverter* fConverter;
|
2016-09-25 19:07:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-27 21:38:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-26 00:16:19 +03:00
|
|
|
#endif /* TEXTENCODING_H */
|