Make addFITSKeywordAsProperty work

This commit is contained in:
2023-03-09 17:43:50 +01:00
parent 3a1582e887
commit b5f6e6c4f6
3 changed files with 25 additions and 4 deletions
+3 -3
View File
@@ -34,6 +34,7 @@ namespace LibXISF
std::vector<std::string> splitString(const std::string &str, char delimiter);
void deserializeVariant(const pugi::xml_node &node, Variant &variant, const ByteArray &data);
void serializeVariant(pugi::xml_node &node, const Variant &variant);
Variant variantFromString(Variant::Type type, const String &str);
static std::unordered_map<String, Image::Type> imageTypeToEnum;
static std::unordered_map<Image::Type, String> imageTypeToString;
@@ -344,13 +345,12 @@ void Image::addFITSKeyword(const FITSKeyword &keyword)
_fitsKeywords.push_back(keyword);
}
bool Image::addFITSKeywordAsProperty(const String &name, const Variant &value)
bool Image::addFITSKeywordAsProperty(const String &name, const String &value)
{
if(fitsNameToPropertyIdTypeConvert.count(name))
{
auto &c = fitsNameToPropertyIdTypeConvert.at(name);
Property prop(c.first, value);
//prop.value.convert(c.second);
Property prop(c.first, variantFromString(c.second, value));
updateProperty(prop);
return true;
}