mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-23 09:59:29 +08:00
add: base components for gamefree
This commit is contained in:
82
module/gamefree/bytearray/PyByteArray.cpp
Normal file
82
module/gamefree/bytearray/PyByteArray.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "PyByteArray.hpp"
|
||||
|
||||
PyByteArray& PyByteArray::writeChar(char data) {
|
||||
m_data.writeChar(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeUChar(unsigned char data) {
|
||||
m_data.writeUChar(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeInt(int data) {
|
||||
m_data.writeInt(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeUInt(unsigned int data) {
|
||||
m_data.writeUInt(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeLong(long data) {
|
||||
m_data.writeLong(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeLongLong(long long data) {
|
||||
m_data.writeLongLong(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeULong(unsigned long data) {
|
||||
m_data.writeULong(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeULongLong(unsigned long long data) {
|
||||
m_data.writeULongLong(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeFloat(float data) {
|
||||
m_data.writeFloat(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeDouble(double data) {
|
||||
m_data.writeDouble(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeLongDouble(long double data) {
|
||||
m_data.writeLongDouble(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeBool(bool data) {
|
||||
m_data.writeBool(data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeString(const std::string_view& string) {
|
||||
m_data.writeString(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
PyByteArray& PyByteArray::writeBytes(const pybind11::bytes& data) {
|
||||
auto size = PYBIND11_BYTES_SIZE(data.ptr());
|
||||
auto buffer = PYBIND11_BYTES_AS_STRING(data.ptr());
|
||||
m_data.writeBytes(buffer, size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string PyByteArray::toString() const {
|
||||
return m_data.toString();
|
||||
}
|
||||
|
||||
pybind11::bytes PyByteArray::toBytes() const {
|
||||
const auto& d = m_data.data();
|
||||
return pybind11::bytes(d.data(), d.size());
|
||||
}
|
||||
Reference in New Issue
Block a user