Move special source lookup to firmware
This commit is contained in:
committed by
Raphael Coeffic
parent
6f54fad526
commit
4c92f9dbc9
@@ -282,3 +282,29 @@ std::string Firmware::getRawSwitchTypesTag(unsigned int index)
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
int Firmware::getRawSourceSpecialTypesIndex(const char * tag)
|
||||
{
|
||||
const StringTagMappingTable& lut = rawSourceSpecialTypesLookupTable;
|
||||
|
||||
auto it =
|
||||
find_if(lut.begin(), lut.end(), [=](const StringTagMapping& elmt) {
|
||||
if (elmt.tag == tag) return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (it != lut.end()) {
|
||||
return it - lut.begin();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string Firmware::getRawSourceSpecialTypesTag(unsigned int index)
|
||||
{
|
||||
const StringTagMappingTable& lut = rawSourceSpecialTypesLookupTable;
|
||||
if (index < lut.size())
|
||||
return lut[index].tag;
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user