Skip to content

Commit

Permalink
Fix number->string conversion in struct parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Mar 21, 2024
1 parent 56e4955 commit 6fe8539
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions include/lib/fex/array_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ 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";
}
return out + "}\n";
}
case Type::kValuePair:
return "kValuePair: " + pair_.first + " = " + pair_.second->ToString() + "\n";
return pair_.first + " = " + pair_.second->ToString() + "\n";
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/parseutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down

0 comments on commit 6fe8539

Please sign in to comment.