|
| bool | parse (QIODevice *device) |
| | Parse the XML configuration file.
|
| |
| bool | startDocument () |
| | Handler called at the beginning of XML document parsing.
|
| |
| bool | startElement () |
| | Handler called when an XML start element is encountered.
|
| |
| bool | endElement () |
| | Handler called when an XML end element is encountered.
|
| |
| bool | characters () |
| | Handler for XML character data (element content).
|
| |
| bool | endDocument () |
| | Handler called at the end of XML document parsing.
|
| |
| void | dump () |
| | Dump all configuration values to stdout for debugging.
|
| |
| QString | expandPath (const QString &) |
| | Expand environment variables in a path string.
|
| |
XML parser for the musredit configuration file.
This class implements an XML parser using Qt's QXmlStreamReader to parse the musredit_startup.xml configuration file. The parser extracts all settings and populates a PAdmin object with the configuration data.
The XML file structure includes sections for:
- General settings (timeout, paths, font preferences)
- Recent files list
- Help URL mappings
- MSR file defaults (beamline, institute, file format)
- msr2data default parameters
- Theory function definitions
- Usage Example:
if (parser.isValid()) {
}
PAdminXMLParser(const QString &fln, PAdmin *)
Constructs an XML parser for the musredit configuration file.
Central administration class for musredit configuration management.
- See also
- PAdmin The administration class that stores parsed configuration
Definition at line 127 of file PAdmin.h.
| PAdminXMLParser::PAdminXMLParser |
( |
const QString & | fln, |
|
|
PAdmin * | admin ) |
Constructs an XML parser for the musredit configuration file.
Creates a parser instance and immediately parses the specified XML file. If the file is missing or corrupted, the user is prompted to create a default configuration file. After parsing completes, the validity can be checked using the isValid() method.
- Parameters
-
| fln | Full path to the musredit_startup.xml configuration file. |
| admin | Pointer to the PAdmin object that will be populated with parsed data. |
- Note
- If the configuration file cannot be opened or is empty, a warning dialog is displayed offering to create a default configuration file.
Definition at line 81 of file PAdmin.cpp.
| bool PAdminXMLParser::characters |
( |
| ) |
|
|
private |
Handler for XML character data (element content).
Processes the text content of the current XML element based on the previously set keyword from startElement(). Routes the content to the appropriate PAdmin setter method or stores it in the temporary theory item structure when parsing function definitions.
Boolean values in the XML use "y" for true and any other value for false.
- Returns
- true on successful processing, false if a required conversion fails (e.g., invalid integer in params element).
Definition at line 340 of file PAdmin.cpp.
| void PAdminXMLParser::dump |
( |
| ) |
|
|
private |
Dump all configuration values to stdout for debugging.
Outputs the complete contents of the PAdmin object to standard output in a human-readable format. This includes general settings, recent files, help URLs, font settings, MSR file defaults, msr2data parameters, and all registered theory functions.
- Note
- This method is intended for debugging purposes only and is typically disabled in production builds.
Definition at line 700 of file PAdmin.cpp.
| bool PAdminXMLParser::parse |
( |
QIODevice * | device | ) |
|
|
private |
Parse the XML configuration file.
Reads and processes the musredit_startup.xml file using Qt's QXmlStreamReader. The parser processes elements sequentially, calling appropriate handler methods for start elements, character data, and end elements.
- Parameters
-
| device | QIODevice (typically QFile) opened for reading the XML file. |
- Returns
- true if parsing completed without XML errors, false otherwise. On failure, an error dialog is displayed with line/column information.
Definition at line 112 of file PAdmin.cpp.