2020-01-24 18:56:51 +00:00
|
|
|
/*
|
|
|
|
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();
|
|
|
|
|
2020-05-02 18:52:28 +00:00
|
|
|
void complet_byte();
|
|
|
|
|
|
|
|
uint32_t size();
|
|
|
|
uint32_t size_data();
|
|
|
|
uint32_t number_bit_not_read();
|
2020-01-24 18:56:51 +00:00
|
|
|
|
|
|
|
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);
|
2020-05-02 18:52:28 +00:00
|
|
|
void put_bitstream(BitStream & value);
|
|
|
|
void put_bitstream(BitStream * value);
|
|
|
|
void put_version(uint32_t value);
|
2020-05-13 11:25:01 +00:00
|
|
|
void put_float(float value);
|
2020-05-04 16:23:44 +00:00
|
|
|
void put_string_utf16(String value);
|
2020-01-24 18:56:51 +00:00
|
|
|
|
|
|
|
String show();
|
|
|
|
String show_detail();
|
|
|
|
String show_counter();
|
|
|
|
|
|
|
|
PoolByteArray get_data();
|
|
|
|
void put_data(PoolByteArray value);
|
2020-03-03 21:45:30 +00:00
|
|
|
|
2020-03-30 20:20:59 +00:00
|
|
|
void copy_ref_bitstream(Ref<BitStream> value);
|
|
|
|
void copy_bitstream(BitStream & value);
|
2020-01-24 18:56:51 +00:00
|
|
|
|
|
|
|
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();
|
2020-05-02 18:52:28 +00:00
|
|
|
uint32_t get_version();
|
2020-05-13 11:25:01 +00:00
|
|
|
float get_float();
|
2020-01-24 18:56:51 +00:00
|
|
|
PoolByteArray get_array_uint8(uint32_t length);
|
2020-04-11 11:56:47 +00:00
|
|
|
BitStream get_bitstream(uint32_t length);
|
2020-05-02 18:52:28 +00:00
|
|
|
String get_string();
|
2020-05-04 16:23:44 +00:00
|
|
|
String get_string_utf16();
|
|
|
|
String get_string_utf8();
|
2020-01-24 18:56:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|