[Net] StreamPeer GDExtension.
This commit is contained in:
parent
b9e6cc8f4f
commit
5f61b2c797
3 changed files with 83 additions and 0 deletions
|
|
@ -33,6 +33,10 @@
|
|||
|
||||
#include "core/object/ref_counted.h"
|
||||
|
||||
#include "core/object/gdvirtual.gen.inc"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
|
||||
class StreamPeer : public RefCounted {
|
||||
GDCLASS(StreamPeer, RefCounted);
|
||||
OBJ_CATEGORY("Networking");
|
||||
|
|
@ -58,6 +62,7 @@ public:
|
|||
|
||||
virtual int get_available_bytes() const = 0;
|
||||
|
||||
/* helpers */
|
||||
void set_big_endian(bool p_big_endian);
|
||||
bool is_big_endian_enabled() const;
|
||||
|
||||
|
|
@ -92,6 +97,26 @@ public:
|
|||
StreamPeer() {}
|
||||
};
|
||||
|
||||
class StreamPeerExtension : public StreamPeer {
|
||||
GDCLASS(StreamPeerExtension, StreamPeer);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Error put_data(const uint8_t *p_data, int p_bytes) override;
|
||||
virtual Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) override;
|
||||
virtual Error get_data(uint8_t *p_buffer, int p_bytes) override;
|
||||
virtual Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) override;
|
||||
virtual int get_available_bytes() const override;
|
||||
|
||||
GDVIRTUAL3R(int, _put_data, GDNativeConstPtr<const uint8_t>, int, GDNativePtr<int>);
|
||||
GDVIRTUAL3R(int, _put_partial_data, GDNativeConstPtr<const uint8_t>, int, GDNativePtr<int>);
|
||||
GDVIRTUAL3R(int, _get_data, GDNativePtr<uint8_t>, int, GDNativePtr<int>);
|
||||
GDVIRTUAL3R(int, _get_partial_data, GDNativePtr<uint8_t>, int, GDNativePtr<int>);
|
||||
GDVIRTUAL0RC(int, _get_available_bytes);
|
||||
};
|
||||
|
||||
class StreamPeerBuffer : public StreamPeer {
|
||||
GDCLASS(StreamPeerBuffer, StreamPeer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue