首次提交
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#include <structive/property/extensions/presentation.hpp>
|
||||
#include <iostream>
|
||||
using namespace structive;
|
||||
struct Device : Property_Object<Device> {
|
||||
double temperature{25.0};
|
||||
};
|
||||
template <>
|
||||
struct structive::Type_Descriptor<Device> {
|
||||
static auto get() {
|
||||
return object<Device>(
|
||||
field < &Device::temperature > (
|
||||
key < "temperature" >,
|
||||
unit < "C" >,
|
||||
presentation::label < "Temperature" >,
|
||||
presentation::description < "Current device temperature" >
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
int main() {
|
||||
Device device;
|
||||
auto info = presentation::describe < &Device::temperature > (device.schema());
|
||||
std::cout << info.key << '=' << info.label << '\n';
|
||||
}
|
||||
Reference in New Issue
Block a user