all repos — mgba @ 2d02719fa57d4e4a33168955a8e0c34dfabc301a

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
11CXX_GUARD_START
12
13struct TextCodecNode;
14struct TextCodec {
15	struct TextCodecNode* forwardRoot;
16	struct TextCodecNode* reverseRoot;
17};
18
19struct TextCodecIterator {
20	struct TextCodecNode* root;
21	struct TextCodecNode* current;
22};
23
24struct VFile;
25bool TextCodecLoadTBL(struct TextCodec*, struct VFile*, bool createReverse);
26void TextCodecDeinit(struct TextCodec*);
27
28void TextCodecStartDecode(struct TextCodec*, struct TextCodecIterator*);
29void TextCodecStartEncode(struct TextCodec*, struct TextCodecIterator*);
30
31ssize_t TextCodecAdvance(struct TextCodecIterator*, uint8_t byte, uint8_t* output, size_t outputLength);
32ssize_t TextCodecFinish(struct TextCodecIterator*, uint8_t* output, size_t outputLength);
33
34CXX_GUARD_END
35
36#endif