Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::ComponentField Struct Reference

#include <ComponentLayout.h>

Public Member Functions

 ComponentField ()=default
 
 ComponentField (const std::string &name, ComponentDataType type, size_t offset, const std::string &displayName="")
 
 ComponentField (const std::string &name, ComponentDataType type, size_t offset, const std::string &displayName, const std::vector< ComponentField > &childrenFields)
 
 ComponentField (const std::string &name, ComponentDataType type, const void *dataPtr)
 
 ComponentField (const ComponentField &original, const void *dataPtr)
 
void CopyValue (Component *src, Component *clone) const
 
const std::string & GetDisplayName () const
 
bool HasChildrens ()
 

Public Attributes

std::string name
 
std::string displayName
 
std::string tooltip
 
ComponentDataType type
 
const void * data = nullptr
 
size_t offset = 0
 
uint32_t size = 0
 
bool flatten = false
 
bool readOnly = false
 
bool isColor = false
 
std::vector< ComponentFieldchildren
 

Detailed Description

Definition at line 14 of file ComponentLayout.h.

Constructor & Destructor Documentation

◆ ComponentField() [1/5]

Elevate::ComponentField::ComponentField ( )
default

◆ ComponentField() [2/5]

Elevate::ComponentField::ComponentField ( const std::string &  name,
ComponentDataType  type,
size_t  offset,
const std::string &  displayName = "" 
)
inline

Definition at line 30 of file ComponentLayout.h.

37 {
39 {
40 size = 0;
41 }
42 else
43 {
45 }
46 }
uint32_t GetDataTypeSize(EngineDataType type)
Definition Data.h:121
ComponentDataType type

◆ ComponentField() [3/5]

Elevate::ComponentField::ComponentField ( const std::string &  name,
ComponentDataType  type,
size_t  offset,
const std::string &  displayName,
const std::vector< ComponentField > &  childrenFields 
)
inline

Definition at line 48 of file ComponentLayout.h.

56 {
58 {
59 size = 0;
60 }
61 else
62 {
64 }
65 }
std::vector< ComponentField > children

◆ ComponentField() [4/5]

Elevate::ComponentField::ComponentField ( const std::string &  name,
ComponentDataType  type,
const void *  dataPtr 
)
inline

Definition at line 67 of file ComponentLayout.h.

68 : name(name), type(type), data(dataPtr) { }

◆ ComponentField() [5/5]

Elevate::ComponentField::ComponentField ( const ComponentField original,
const void *  dataPtr 
)
inline

Definition at line 70 of file ComponentLayout.h.

71 : name(original.name), type(original.type), offset(original.offset), size(original.size),
72 displayName(original.displayName), flatten(original.flatten), readOnly(original.readOnly),
73 isColor(original.isColor), data(dataPtr)
74 {
75 for (const auto& child : original.children)
76 {
77 const void* childDataPtr = reinterpret_cast<const char*>(dataPtr) + child.offset;
78 children.emplace_back(child, childDataPtr);
79 }
80 }

Member Function Documentation

◆ CopyValue()

void Elevate::ComponentField::CopyValue ( Component src,
Component clone 
) const
inline

Definition at line 82 of file ComponentLayout.h.

83 {
84 const void* srcData = reinterpret_cast<const char*>(src) + offset;
85 void* destData = reinterpret_cast<char*>(clone) + offset;
86
87 if (size > 0)
88 {
89 std::memcpy(destData, srcData, size);
90 }
91 else if (!children.empty())
92 {
93 for (auto& child : children)
94 {
95 child.CopyValue(src, clone);
96 }
97 }
98 }

◆ GetDisplayName()

const std::string & Elevate::ComponentField::GetDisplayName ( ) const
inline

Definition at line 100 of file ComponentLayout.h.

101 {
102 if (displayName.empty())
103 return name;
104 return displayName;
105 }

◆ HasChildrens()

bool Elevate::ComponentField::HasChildrens ( )
inline

Definition at line 107 of file ComponentLayout.h.

107{ return !children.empty(); }

Member Data Documentation

◆ children

std::vector<ComponentField> Elevate::ComponentField::children

Definition at line 26 of file ComponentLayout.h.

◆ data

const void* Elevate::ComponentField::data = nullptr

Definition at line 20 of file ComponentLayout.h.

◆ displayName

std::string Elevate::ComponentField::displayName

Definition at line 17 of file ComponentLayout.h.

◆ flatten

bool Elevate::ComponentField::flatten = false

Definition at line 23 of file ComponentLayout.h.

◆ isColor

bool Elevate::ComponentField::isColor = false

Definition at line 25 of file ComponentLayout.h.

◆ name

std::string Elevate::ComponentField::name

Definition at line 16 of file ComponentLayout.h.

◆ offset

size_t Elevate::ComponentField::offset = 0

Definition at line 21 of file ComponentLayout.h.

◆ readOnly

bool Elevate::ComponentField::readOnly = false

Definition at line 24 of file ComponentLayout.h.

◆ size

uint32_t Elevate::ComponentField::size = 0

Definition at line 22 of file ComponentLayout.h.

◆ tooltip

std::string Elevate::ComponentField::tooltip

Definition at line 18 of file ComponentLayout.h.

◆ type

ComponentDataType Elevate::ComponentField::type

Definition at line 19 of file ComponentLayout.h.


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