2016-11-01 07:07:30 +00:00
|
|
|
/* Copyright (c) 2013-2016 Jeffrey Pfau
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef TEXT_CODEC_H
|
|
|
|
#define TEXT_CODEC_H
|
|
|
|
|
2016-12-31 01:00:22 +00:00
|
|
|
#include <mgba-util/common.h>
|
2016-11-01 07:07:30 +00:00
|
|
|
|
2016-12-27 05:01:55 +00:00
|
|
|
CXX_GUARD_START
|
|
|
|
|
2016-11-01 07:07:30 +00:00
|
|
|
struct TextCodecNode;
|
|
|
|
struct TextCodec {
|
|
|
|
struct TextCodecNode* forwardRoot;
|
|
|
|
struct TextCodecNode* reverseRoot;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TextCodecIterator {
|
|
|
|
struct TextCodecNode* root;
|
|
|
|
struct TextCodecNode* current;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VFile;
|
|
|
|
bool TextCodecLoadTBL(struct TextCodec*, struct VFile*, bool createReverse);
|
|
|
|
void TextCodecDeinit(struct TextCodec*);
|
|
|
|
|
|
|
|
void TextCodecStartDecode(struct TextCodec*, struct TextCodecIterator*);
|
|
|
|
void TextCodecStartEncode(struct TextCodec*, struct TextCodecIterator*);
|
|
|
|
|
2016-11-02 06:28:08 +00:00
|
|
|
ssize_t TextCodecAdvance(struct TextCodecIterator*, uint8_t byte, uint8_t* output, size_t outputLength);
|
|
|
|
ssize_t TextCodecFinish(struct TextCodecIterator*, uint8_t* output, size_t outputLength);
|
2016-11-01 07:07:30 +00:00
|
|
|
|
2016-12-27 05:01:55 +00:00
|
|
|
CXX_GUARD_END
|
|
|
|
|
2016-11-01 07:07:30 +00:00
|
|
|
#endif
|