all repos — mgba @ daaa2fa5236df5e8976e7e0ba7ac39e0d9233422

mGBA Game Boy Advance Emulator

src/util/text-codec.h (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef TEXT_CODEC_H
 7#define TEXT_CODEC_H
 8
 9#include "util/common.h"
10
11struct TextCodecNode;
12struct TextCodec {
13	struct TextCodecNode* forwardRoot;
14	struct TextCodecNode* reverseRoot;
15};
16
17struct TextCodecIterator {
18	struct TextCodecNode* root;
19	struct TextCodecNode* current;
20};
21
22struct VFile;
23bool TextCodecLoadTBL(struct TextCodec*, struct VFile*, bool createReverse);
24void TextCodecDeinit(struct TextCodec*);
25
26void TextCodecStartDecode(struct TextCodec*, struct TextCodecIterator*);
27void TextCodecStartEncode(struct TextCodec*, struct TextCodecIterator*);
28
29ssize_t TextCodecAdvance(struct TextCodecIterator*, uint8_t byte, uint8_t* output, size_t outputLength);
30ssize_t TextCodecFinish(struct TextCodecIterator*, uint8_t* output, size_t outputLength);
31
32#endif