Skip to content
Snippets Groups Projects

ENH: New functions getEnumNameFromValue() and getEnumValueFromName()

Merged Daniel Hornung requested to merge f-enum-utilities into f-consolidation
All threads resolved!
2 files
+ 28
26
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 19
5
@@ -155,12 +155,26 @@ public:
DataType(ProtoDataType *wrapped)
: ProtoMessageWrapper<ProtoDataType>(wrapped) {}
DataType() : ProtoMessageWrapper<ProtoDataType>() {}
DataType(AtomicDataType data_type) : DataType() {
this->wrapped->set_atomic_data_type(
static_cast<ProtoAtomicDataType>(data_type));
/**
* Create an AtomicDataType typed DataType. For references, use the std::string constructor.
*/
DataType(AtomicDataType data_type, bool list_type = false) : DataType() {
if (list_type) {
this->wrapped->mutable_list_data_type()->set_atomic_data_type
(static_cast<ProtoAtomicDataType>(data_type));
} else {
this->wrapped->set_atomic_data_type(static_cast<ProtoAtomicDataType>(data_type));
}
}
DataType(const std::string &data_type) : DataType() {
this->wrapped->mutable_reference_data_type()->set_name(data_type);
/**
* Create a reference typed DataType.
*/
DataType(const std::string &data_type, bool list_type = false) : DataType() {
if (list_type) {
this->wrapped->mutable_list_data_type()->mutable_reference_data_type()->set_name(data_type);
} else {
this->wrapped->mutable_reference_data_type()->set_name(data_type);
}
}
[[nodiscard]] inline auto IsAtomic() const noexcept -> bool {
return this->wrapped->data_type_case() == DataTypeCase::kAtomicDataType;
Loading