libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::DatabaseRawSequential::KeyInfo Struct Reference

键信息结构,存储键的元数据 (Structure containing key metadata). More...

Public Member Functions

 KeyInfo ()
 构造一个擦除态键头 (Construct one erased-state key header).
 
 KeyInfo (bool nextKey, uint8_t nameLength, uint32_t dataSize)
 构造一个指定元数据的键头 (Construct one key header with explicit metadata).
 
void SetNextKeyExist (bool value)
 设置是否存在后继键 (Set whether another key follows).
 
bool GetNextKeyExist () const
 获取是否存在后继键 (Get whether another key follows).
 
void SetNameLength (uint8_t len)
 设置键名长度 (Set the key name length).
 
uint8_t GetNameLength () const
 获取键名长度 (Get the key name length).
 
void SetDataSize (uint32_t size)
 设置数据字节数 (Set the payload size in bytes).
 
uint32_t GetDataSize () const
 获取数据字节数 (Get the payload size in bytes).
 

Data Fields

uint32_t raw_data
 

Detailed Description

键信息结构,存储键的元数据 (Structure containing key metadata).

Definition at line 117 of file raw_sequential.hpp.

Constructor & Destructor Documentation

◆ KeyInfo() [1/2]

DatabaseRawSequential::KeyInfo::KeyInfo ( )

构造一个擦除态键头 (Construct one erased-state key header).

Definition at line 23 of file raw_sequential.cpp.

◆ KeyInfo() [2/2]

DatabaseRawSequential::KeyInfo::KeyInfo ( bool nextKey,
uint8_t nameLength,
uint32_t dataSize )

构造一个指定元数据的键头 (Construct one key header with explicit metadata).

Parameters
nextKey是否还有后继键 (Whether another key follows this one).
nameLength键名长度 (Key name length).
dataSize数据字节数 (Payload size in bytes).

Definition at line 25 of file raw_sequential.cpp.

27 : raw_data(0)
28{
29 SetNextKeyExist(nextKey);
30 SetNameLength(nameLength);
31 SetDataSize(dataSize);
32}
void SetNameLength(uint8_t len)
设置键名长度 (Set the key name length).
void SetNextKeyExist(bool value)
设置是否存在后继键 (Set whether another key follows).
void SetDataSize(uint32_t size)
设置数据字节数 (Set the payload size in bytes).

Member Function Documentation

◆ GetDataSize()

uint32_t DatabaseRawSequential::KeyInfo::GetDataSize ( ) const

获取数据字节数 (Get the payload size in bytes).

Returns
数据字节数 (Payload size in bytes).

Definition at line 59 of file raw_sequential.cpp.

60{
61 return raw_data & 0x00FFFFFF;
62}

◆ GetNameLength()

uint8_t DatabaseRawSequential::KeyInfo::GetNameLength ( ) const

获取键名长度 (Get the key name length).

Returns
键名长度 (Key name length).

Definition at line 49 of file raw_sequential.cpp.

50{
51 return (raw_data >> 24) & 0x7F;
52}

◆ GetNextKeyExist()

bool DatabaseRawSequential::KeyInfo::GetNextKeyExist ( ) const

获取是否存在后继键 (Get whether another key follows).

Returns
若存在后继键则返回 true (Returns true when another key follows).

Definition at line 39 of file raw_sequential.cpp.

40{
41 return (raw_data >> 31) & 0x1;
42}

◆ SetDataSize()

void DatabaseRawSequential::KeyInfo::SetDataSize ( uint32_t size)

设置数据字节数 (Set the payload size in bytes).

Parameters
size数据字节数 (Payload size in bytes).

Definition at line 54 of file raw_sequential.cpp.

55{
56 raw_data = (raw_data & 0xFF000000) | (size & 0x00FFFFFF);
57}

◆ SetNameLength()

void DatabaseRawSequential::KeyInfo::SetNameLength ( uint8_t len)

设置键名长度 (Set the key name length).

Parameters
len键名长度 (Key name length).

Definition at line 44 of file raw_sequential.cpp.

45{
46 raw_data = (raw_data & 0x80FFFFFF) | (static_cast<uint32_t>(len & 0x7F) << 24);
47}

◆ SetNextKeyExist()

void DatabaseRawSequential::KeyInfo::SetNextKeyExist ( bool value)

设置是否存在后继键 (Set whether another key follows).

Parameters
value是否存在后继键 (Whether another key follows).

Definition at line 34 of file raw_sequential.cpp.

35{
36 raw_data = (raw_data & 0x7FFFFFFF) | (static_cast<uint32_t>(value & 0x1) << 31);
37}

Field Documentation

◆ raw_data

uint32_t LibXR::DatabaseRawSequential::KeyInfo::raw_data

1 位后继键标志、7 位键名长度、24 位数据长度 (1-bit next-key flag, 7-bit name length, 24-bit payload size).

Definition at line 119 of file raw_sequential.hpp.


The documentation for this struct was generated from the following files: