MCPcopy Create free account
hub / github.com/DFHack/dfhack / enum_item_raw_key

Function enum_item_raw_key

library/include/DataDefs.h:801–816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799 */
800 template<class T>
801 const char* enum_item_raw_key(T val) {
802 using traits = df::enum_traits<T>;
803 if constexpr (complex_enum<T>)
804 {
805 const auto& value_index_map = traits::complex.value_index_map;
806 auto it = value_index_map.find(val);
807 if (it != value_index_map.end())
808 return traits::key_table[it->second];
809 else
810 return nullptr;
811 }
812 else
813 {
814 return traits::is_valid(val) ? traits::key_table[(short)val - traits::first_item_value] : nullptr;
815 }
816 }
817
818
819 /**

Callers 3

PushInterfaceKeysMethod · 0.85
enum_item_key_strFunction · 0.85
enum_item_keyFunction · 0.85

Calls 3

is_validFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected