Files
qt-migration-legatus/qt5-before/dlbo/Lts/Viewer/SituationMap/SymbologyXML/symbol_reader.h
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

227 lines
6.8 KiB
C++

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include "symbology_xml_export.h"
#include "symbol.h"
#include "primitive.h"
#include <QColor>
#include <QString>
#include <QXmlStreamReader>
#include <NGLLogger/INGLLogger.h>
class QBuffer;
class QFile;
namespace SymbologyXML
{
/**
\brief Read a Symbol from a XML-File or XML-String.
Symbols are stored as XML-Files on HD or in a database. This class reads a
XML-Description of a Symbol and writes the data into a given Symbol. To export
a Symbol to XML, use SymbolWriter.
@author Stephan Kuhagen <stephan.kuhagen@rheinmetall.com>
*/
class SYMBOLOGY_XML_EXPORT SymbolReader : public QXmlStreamReader {
public:
SymbolReader();
~SymbolReader();
/**
Read a symbol from a file
\param xml: The file containing the XML-description of the symbol
\param target: The symbol, where the data should go
\return true on success, false otherwise
*/
bool read(QFile *xml, Symbol &target);
/**
Read a symbol from a string
\param xml: The file containing the XML-description of the symbol
\param target: The symbol, where the data should go
\return true on success, false otherwise
*/
bool read(const QString &xml, Symbol &target);
/**
Read a symbol from a string
\param xml: The file containing the XML-description of the symbol
\param target: The symbol, where the data should go
\return true on success, false otherwise
*/
bool read(const QByteArray &xml, Symbol &target);
private:
//! NGLLogger
NGL::INGLLogger& logger;
/**
Read a symbol from the current IODevice. The IODevice is set and created
the string of file of the public read()-methods
\return true on success, false otherwise
*/
bool read();
//! Read an unknown element until a close-tag is found
void readUnknownElement();
//! Read a symbol-element
void readSymbol();
//! Read a name-element
void readName();
//! Read a branch-element
void readBranch();
//! Read the APP6-Classification
void readApp6Class();
//! Read a misc-element
void readMisc();
//! Read a text-element
void readText(unsigned int lines);
//! Read a graphic-element
void readGraphic();
/**
Read a data-element
\param align: Pointer to a t_alignment-variable
\return The data as a string
*/
QString readData(Symbol::t_alignment* align);
//! Read a ellipse-element
void readGEllipse();
//! Read a line-element
void readGLine();
//! Read a polygon-element
void readGPolygon();
//! Read a rect-element
void readGRect();
//! Read a icon-element
void readGIcon();
//! Read a text-element
void readGText();
//! Read a point-element
QPointF readGPoint();
/**
Parse a bool-attribute
\param name: The name of the Attribute
\param def: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
bool getAttribBool(const char *name, bool def = false, bool implied = false);
/**
Parse a double-attribute
\param name: The name of the Attribute
\param def: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
double getAttribDouble(const char *name, double def = 0.0, bool implied = false);
/**
Parse a int-attribute
\param name: The name of the Attribute
\param def: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
int getAttribInt(const char *name, int def = 0, bool implied = false);
/**
Parse a linestyle-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
Primitive::t_linestyle getAttribLineStyle();
/**
Parse a Position-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
SymbolTypes::t_sector_position getAttribPosition(SymbolTypes::t_sector_position def = SymbolTypes::SECTOR_POSITION_UNDEFINED);
/**
Parse a Rectpos-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
SymbolTypes::t_sector_rectpos getAttribRectpos(SymbolTypes::t_sector_rectpos def = SymbolTypes::SECTOR_RECTPOS_DEFAULT);
/**
Parse a scalemode-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
Primitive::t_scalemode getAttribScalemode(Primitive::t_scalemode def = Primitive::Scalemode_Proport);
/**
Parse a linestyle-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
\param implied: If true, then the Attribute is implied and if not present
in the XML-Data, then default is returned.
*/
QString getAttribString(const char *name);
/**
Parse a color-attribute
\param default: The default-value, if implied==true and the Attribute is not
in the XML-Data.
*/
QColor getAttribColor(const QColor &def = QColor());
/**
Concatinate filename and symbol id for debug-output.
\return filename and symbol for debug
*/
QString getDebugInfo() const;
/**
Creates a primitive ICON
\return primitive
*/
Primitive *newPrimitiveICON(SymbolTypes::t_icon_type iconType,
SymbolTypes::t_sector_position pos, SymbolTypes::t_sector_rectpos rectpos,
int id);
Primitive *newMiscPrimitiveICON(const QStringRef &attrib);
//! Buffer containing the QString from read() with QString
QBuffer* _buffer;
//! Pointer to the symbol, where the data should go
Symbol* _symbol;
//! Save the symbols transformed-flag until parsing is complete
bool _transformed;
//! Save the filename for debuuging
QString _filename;
}; // class SymbolReader : public QXmlStreamReader
}; // namespace SymologyXML