Botcraft 1.21.4
Loading...
Searching...
No Matches
PluginObject.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace ProtocolCraft
4{
6 {
7 public:
8 virtual ~PluginObject() { }
9
10 /// @brief Deserialize raw data into this object
11 /// @param ptr Pointer to the start of the data
12 /// @param length Available data, will be updated with data read
13 virtual void Read(const unsigned char* ptr, unsigned long long int& length) = 0;
14
15 /// @brief Write this object into raw data
16 /// @param size Will be assigned to the data size
17 /// @return A pointer to the serialized data
18 virtual const unsigned char* Write(unsigned long long int& size) = 0;
19
20 /// @brief Serialize this object into a null terminated json string
21 /// @return A pointer to the start of the string
22 virtual const char* Serialize() = 0;
23 };
24}
virtual void Read(const unsigned char *ptr, unsigned long long int &length)=0
Deserialize raw data into this object.
virtual const char * Serialize()=0
Serialize this object into a null terminated json string.
virtual const unsigned char * Write(unsigned long long int &size)=0
Write this object into raw data.