Files
qt6-migration-pipeline/fix_flt_dtc.py
T
torstenandCopilot 342ffd3e5c Update submodule to latest BUILD_RTI fixes
- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten
- svcTabCommon: Export-Header-Fix via Fallback-Target
- TrainingAreaBase: Stub-Header für BUILD_RTI=OFF
- ddsfts: Include-Pfad und Dependency-Fixes
- BUILD_RTI=OFF Compilation vollständig unterstützt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
2026-08-21 19:30:20 +02:00

61 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""
Fix flt_dtc.h includes - replace with forward declaration where possible
"""
import os
import re
base_dir = "qt-migration-legatus/qt6-after/qt6-migrated-legatus"
files_to_fix = [
"Lts/Plugins/FilterManagement/flt_symbol_appearance_settings.h",
"Lts/Plugins/FilterManagement/flt_data_plugin_interface.h",
"Lts/Plugins/FilterManagement/flt_data_plugin_aes_display_filter.h",
"Lts/Plugins/FilterManagement/flt_building_cmpnt_settings.h",
"Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/hitlineinfo_to_map.h",
"Lts/Plugins/SituationMapPlugin/Gui/SituationMap/AdapterDds/buildinghitlineinfo_to_map.h",
]
for rel_path in files_to_fix:
full_path = os.path.join(base_dir, rel_path)
if not os.path.exists(full_path):
print(f"SKIP (not found): {rel_path}")
continue
with open(full_path, 'r') as f:
content = f.read()
# Check if SymbolAppearance is used as reference/pointer (forward decl ok)
# or if full type definition is needed
# Remove the include
old_include = '#include <FilterManagement/flt_dtc.h>'
if old_include not in content:
print(f"SKIP (no include): {rel_path}")
continue
# Add forward declaration after namespace FilterManagement {
forward_decl = "class SymbolAppearance;"
# Find namespace FilterManagement
ns_pattern = r'(namespace\s+FilterManagement\s*\{)'
def replace_func(match):
ns_decl = match.group(1)
# Check if forward decl already exists
after_ns = content[match.end():match.end()+200]
if 'class SymbolAppearance;' in after_ns or 'struct SymbolAppearance;' in after_ns:
return ns_decl # Already has forward decl
return ns_decl + '\n' + forward_decl
new_content = re.sub(ns_pattern, replace_func, content)
new_content = new_content.replace(old_include + '\n', '')
new_content = new_content.replace(old_include, '')
with open(full_path, 'w') as f:
f.write(new_content)
print(f"FIX: {rel_path}")
print("\nDone!")