- Wrap FIND_PACKAGE(RTI) in IF(NOT TARGET RTI::nddsc) condition - Prevents placeholder targets from overwriting manually configured RTI:: targets - Manual configuration creates RTI:: targets when BUILD_RTI=ON and RTI found - FIND_PACKAGE only called as fallback when manual config doesn't create targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1CT3XSQXCX9RQR6WM9DG3GH
46 lines
2.2 KiB
Python
46 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix fromJson/toJson for structs with public members (RelativePosition, AbsolutePosition)"""
|
|
|
|
cpp_file = "qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/training_area_telegrams.cpp"
|
|
|
|
with open(cpp_file, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Fix RelativePosition fromJson - m_offsetX → offsetX
|
|
content = content.replace('ret.m_offsetX', 'ret.offsetX')
|
|
content = content.replace('ret.m_offsetY', 'ret.offsetY')
|
|
content = content.replace('ret.m_offsetZ', 'ret.offsetZ')
|
|
|
|
# Fix RelativePosition toJson - offsetX() → offsetX (only in RelativePosition::toJson)
|
|
rel_tojson_start = content.find('QJsonObject RelativePosition::toJson() const')
|
|
rel_tojson_end = content.find('}\n\n', rel_tojson_start)
|
|
if rel_tojson_start != -1 and rel_tojson_end != -1:
|
|
rel_section = content[rel_tojson_start:rel_tojson_end]
|
|
rel_section = rel_section.replace('offsetX()', 'offsetX')
|
|
rel_section = rel_section.replace('offsetY()', 'offsetY')
|
|
rel_section = rel_section.replace('offsetZ()', 'offsetZ')
|
|
# Fix closing braces: }}; → };
|
|
rel_section = rel_section.replace('}};', '};')
|
|
content = content[:rel_tojson_start] + rel_section + content[rel_tojson_end:]
|
|
|
|
# Fix AbsolutePosition fromJson - m_lon → lon, etc.
|
|
content = content.replace('ret.m_lon', 'ret.lon')
|
|
content = content.replace('ret.m_lat', 'ret.lat')
|
|
content = content.replace('ret.m_z', 'ret.z')
|
|
|
|
# Fix AbsolutePosition toJson - lon() → lon, etc. (only in AbsolutePosition::toJson)
|
|
abs_tojson_start = content.find('QJsonObject AbsolutePosition::toJson() const')
|
|
abs_tojson_end = content.find('}\n\n', abs_tojson_start)
|
|
if abs_tojson_start != -1 and abs_tojson_end != -1:
|
|
abs_section = content[abs_tojson_start:abs_tojson_end]
|
|
abs_section = abs_section.replace('lon()', 'lon')
|
|
abs_section = abs_section.replace('lat()', 'lat')
|
|
abs_section = abs_section.replace('z()', 'z')
|
|
# Fix closing braces: }}; → };
|
|
abs_section = abs_section.replace('}};', '};')
|
|
content = content[:abs_tojson_start] + abs_section + content[abs_tojson_end:]
|
|
|
|
with open(cpp_file, 'w') as f:
|
|
f.write(content)
|
|
|
|
print("Fixed RelativePosition and AbsolutePosition member access patterns") |