cnet::Bytes is a wrapper around std::vector<cnet::Byte> with a lot of useful methods
class Bytes
{
private:
std::vector<cnet::byte> data;
};
| Name | Description | Return type |
|---|---|---|
| Size | Returns the size of the data | std::size_t |
| ToInt64 | Converts the 8 first bytes starting from startIndex to int64 | bool |
| ToUint64 | Same as ToInt64 but unsigned | bool |
| ToInt32 | Converts the 4 first bytes starting from startIndex to int32 | bool |
| ToUint32 | Same as ToInt32 but unsigned | bool |
| AsString | Returns the string representation of the bytes (e.g "[0xFF,0xFF]") | std::string |
| ToString | Converts the bytes to a string | std::string |
| Slice | Returns a new instance of cnet::Bytes which is a slice of the current object | cnet::Bytes |
| FromInt64 | Converts int64_t to cnet::Bytes | cnet::Bytes |
| FromUint64 | Converts uint64_t to cnet::Bytes | cnet::Bytes |
| FromInt32 | Converts int32_t to cnet::Bytes | cnet::Bytes |
| FromUint32 | Converts uint32_t to cnet::Bytes | cnet::Bytes |
| FromString | Converts std::string to cnet::Bytes | cnet::Bytes |