Sleeping Wombat Common Library
0.50.0
swCommonLibrary
|
Represents memory chunk in file. More...
#include <Chunk.h>
Public Member Functions | |
Chunk (ChunkReprPtr chunkRepr) | |
bool | IsValid () const |
Checks if you can use this attribute properly. | |
bool | operator== (Chunk other) const |
Chunks manipulation | |
Chunk | CreateChunk () |
Create child chunk. | |
Chunk | NextChunk () |
Gets next chunk on the same nesting level. More... | |
Chunk | FirstChild () |
Gets first child chunk of this chunk. More... | |
bool | HasChildren () |
Check if you should call FirstChild or AccessData. | |
Chunk | ParentChunk () |
Get Chunks parent. More... | |
Data access | |
bool | Fill (const DataPtr data, Size dataSize) |
Fills chunk with data. You can fill only chunks without children. One filled chunk, can't add children anymore. | |
DataUPack | StealData () |
Returns chunk's data and transfers ownership to caller. | |
DataPack | AccessData () |
Returns chunk's data. More... | |
Attributes manipulation | |
Attribute | AddAttribute (AttributeType type, const DataPtr data, Size dataSize) |
Adds attribute and fills it with data. | |
template<typename AttributeStruct > | |
Attribute | AddAttribute (AttributeType type, const AttributeStruct &content) |
Adds attribute and creates content from POD structure. More... | |
template<typename AttributeStruct > | |
Attribute | AddAttribute (const AttributeStruct &content) |
Adds attribute and creates content from POD structure. Attribute type will be taken from struct. Specialize GetAttributeTypeID template. | |
Private Member Functions | |
FRIEND_CLASS_TESTER (HCF) | |
Private Attributes | |
ChunkReprPtr | m_chunkPtr |
Represents memory chunk in file.
Chunk can consist of nested chunks or it can contain data.
DataPack sw::Chunk::AccessData | ( | ) |
Returns chunk's data.
|
inline |
Adds attribute and creates content from POD structure.
[in] | type | You must provide type of attribute by yourself. Use second spetialization if struct defines attribute type getter. |
Chunk sw::Chunk::FirstChild | ( | ) |
Gets first child chunk of this chunk.
Chunk sw::Chunk::NextChunk | ( | ) |
Gets next chunk on the same nesting level.
Chunk sw::Chunk::ParentChunk | ( | ) |
Get Chunks parent.