test-client-godot/modules/bitstream/bitstream.h
2020-05-13 13:25:01 +02:00

98 lines
2.7 KiB
C++

/*
Header BitStream
Copyright (C) 2019 AleaJactaEst
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BIT_STREAM_H
#define BIT_STREAM_H
#include "core/reference.h"
class BitStream : public Reference {
GDCLASS(BitStream, Reference)
protected:
static void _bind_methods();
private:
uint32_t _pos;
uint32_t _read;
PoolByteArray _data;
public:
void clear();
BitStream();
~BitStream();
static void init(); // our initializer called by Godot
bool is_little_endian();
void complet_byte();
uint32_t size();
uint32_t size_data();
uint32_t number_bit_not_read();
void put_serial(uint32_t value, uint32_t nbits);
void put_bool(bool value);
void put_sint8(int8_t value);
void put_uint8(uint8_t value);
void put_sint16(int16_t value);
void put_uint16(uint16_t value);
void put_sint32(int32_t value);
void put_uint32(uint32_t value);
void put_sint64(int64_t value);
void put_uint64(uint64_t value);
void put_string_hexa32(String hexa);
void put_char(String value);
void put_string(String value);
void put_array_uint8(PoolByteArray value);
void put_bitstream(BitStream & value);
void put_bitstream(BitStream * value);
void put_version(uint32_t value);
void put_float(float value);
void put_string_utf16(String value);
String show();
String show_detail();
String show_counter();
PoolByteArray get_data();
void put_data(PoolByteArray value);
void copy_ref_bitstream(Ref<BitStream> value);
void copy_bitstream(BitStream & value);
uint32_t get_serial(uint32_t nbits);
bool get_bool();
int8_t get_sint8();
uint8_t get_uint8();
int16_t get_sint16();
uint16_t get_uint16();
int32_t get_sint32();
uint32_t get_uint32();
int64_t get_sint64();
uint64_t get_uint64();
uint32_t get_version();
float get_float();
PoolByteArray get_array_uint8(uint32_t length);
BitStream get_bitstream(uint32_t length);
String get_string();
String get_string_utf16();
String get_string_utf8();
};
#endif