TextEncoding: add Encode/Decode methods.
This replaces convert_from/to_utf8 in a way that doesn't leak memory. Use the new method in StyledEdit. Fixes #6252, #3065.
This commit is contained in:
@@ -13,16 +13,32 @@
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
struct UConverter;
|
||||
|
||||
|
||||
class TextEncoding
|
||||
{
|
||||
public:
|
||||
TextEncoding(BString name);
|
||||
TextEncoding(const char* data, size_t length);
|
||||
|
||||
BString GetName();
|
||||
~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);
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
|
||||
UConverter* fUtf8Converter;
|
||||
UConverter* fConverter;
|
||||
};
|
||||
|
||||
|
||||
#endif /* !TEXTENCODING_H */
|
||||
#endif /* TEXTENCODING_H */
|
||||
|
||||
Reference in New Issue
Block a user