Fix number->string conversion in struct parsing
This commit is contained in:
parent
56e4955c54
commit
6fe8539461
2 changed files with 8 additions and 8 deletions
|
@ -77,16 +77,16 @@ namespace fex
|
|||
switch (type_)
|
||||
{
|
||||
case Type::kEmpty:
|
||||
return "kEmpty: {}";
|
||||
return "{}";
|
||||
case Type::kNumber:
|
||||
return "kNumber: " + std::to_string(int_value_);
|
||||
return std::to_string(int_value_);
|
||||
case Type::kString:
|
||||
return "kString: \"" + string_value_ + "\"";
|
||||
return "\"" + string_value_ + "\"";
|
||||
case Type::kIdentifier:
|
||||
return "kIdentifier: " + string_value_;
|
||||
return string_value_;
|
||||
case Type::kValueList:
|
||||
{
|
||||
std::string out = "kValueList: {\n";
|
||||
std::string out = "{\n";
|
||||
for (const ArrayValue &v : values_)
|
||||
{
|
||||
out += "\t" + v.ToString() + ",\n";
|
||||
|
@ -94,7 +94,7 @@ namespace fex
|
|||
return out + "}\n";
|
||||
}
|
||||
case Type::kValuePair:
|
||||
return "kValuePair: " + pair_.first + " = " + pair_.second->ToString() + "\n";
|
||||
return pair_.first + " = " + pair_.second->ToString() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -564,12 +564,12 @@ QMap<QString, QHash<QString, QString>> ParseUtil::readCStructs(const QString &fi
|
|||
for (const fex::ArrayValue &v : it->second.values()) {
|
||||
if (v.type() == fex::ArrayValue::Type::kValuePair) {
|
||||
QString key = QString::fromStdString(v.pair().first);
|
||||
QString value = QString::fromStdString(v.pair().second->string_value());
|
||||
QString value = QString::fromStdString(v.pair().second->ToString());
|
||||
values.insert(key, value);
|
||||
} else {
|
||||
// For compatibility with structs that don't specify member names.
|
||||
if (memberMap.contains(i) && !values.contains(memberMap.value(i)))
|
||||
values.insert(memberMap.value(i), QString::fromStdString(v.string_value()));
|
||||
values.insert(memberMap.value(i), QString::fromStdString(v.ToString()));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue