libxr 1.0
Want to be the best embedded framework
|
原始数据封装类。 A class for encapsulating raw data. More...
#include <libxr_type.hpp>
Public Member Functions | |
RawData (void *addr, size_t size) | |
使用指定地址和大小构造 RawData 对象。 Constructs a RawData object with the specified address and size. | |
RawData () | |
默认构造函数,初始化为空数据。 Default constructor initializing to empty data. | |
template<typename DataType > | |
RawData (const DataType &data) | |
使用任意数据类型构造 RawData ,数据地址指向该对象,大小为该类型的字节大小。 Constructs RawData using any data type, pointing to the object and setting the size to the type's byte size. | |
RawData (const RawData &data)=default | |
拷贝构造函数。 Copy constructor. | |
RawData (char *data) | |
从 char * 指针构造 RawData ,数据大小为字符串长度(不含 \0 )。 Constructs RawData from a char * pointer, with size set to the string length (excluding \0 ). | |
template<size_t N> | |
RawData (const char(&data)[N]) | |
从字符数组构造 RawData ,数据大小为数组长度减 1(不含 \0 )。 Constructs RawData from a character array, with size set to array length minus 1 (excluding \0 ). | |
RawData (const std::string &data) | |
从 std::string 构造 RawData ,数据地址指向字符串内容,大小为字符串长度。 Constructs RawData from std::string , with data pointing to the string content and size set to its length. | |
RawData & | operator= (const RawData &data)=default |
赋值运算符重载。 Overloaded assignment operator. | |
Data Fields | |
void * | addr_ |
数据存储地址。 The storage address of the data. | |
size_t | size_ |
数据大小(字节)。 The size of the data (in bytes). | |
原始数据封装类。 A class for encapsulating raw data.
该类提供了一种通用的数据存储方式,可以存储指针和数据大小, 以支持各种数据类型的传输和存储。 This class provides a generic way to store pointers and data sizes to support the transmission and storage of various data types.
Definition at line 20 of file libxr_type.hpp.
使用指定地址和大小构造 RawData
对象。 Constructs a RawData
object with the specified address and size.
addr | 数据的起始地址。 The starting address of the data. |
size | 数据的大小(字节)。 The size of the data (in bytes). |
Definition at line 32 of file libxr_type.hpp.
|
inline |
默认构造函数,初始化为空数据。 Default constructor initializing to empty data.
Definition at line 38 of file libxr_type.hpp.
使用任意数据类型构造 RawData
,数据地址指向该对象,大小为该类型的字节大小。 Constructs RawData
using any data type, pointing to the object and setting the size to the type's byte size.
DataType | 数据类型。 The data type. |
data | 需要存储的具体数据。 The actual data to be stored. |
Definition at line 51 of file libxr_type.hpp.
|
inline |
从字符数组构造 RawData
,数据大小为数组长度减 1(不含 \0
)。 Constructs RawData
from a character array, with size set to array length minus 1 (excluding \0
).
N | 数组大小。 The array size. |
data | 需要存储的字符数组。 The character array to be stored. |
Definition at line 86 of file libxr_type.hpp.
|
inline |
从 std::string
构造 RawData
,数据地址指向字符串内容,大小为字符串长度。 Constructs RawData
from std::string
, with data pointing to the string content and size set to its length.
data | std::string 类型数据。 A std::string object. |
Definition at line 98 of file libxr_type.hpp.
void* LibXR::RawData::addr_ |
数据存储地址。 The storage address of the data.
Definition at line 114 of file libxr_type.hpp.
size_t LibXR::RawData::size_ |
数据大小(字节)。 The size of the data (in bytes).
Definition at line 115 of file libxr_type.hpp.