|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
#include <theme_parser.h>
Classes | |
| struct | Result |
Public Member Functions | |
| ThemeParser (const QHash< QString, ThemeSectionInfo > §ions, const QHash< QString, ThemeManager::ThemeToken > &roleCache) | |
| bool | parse (const QString &internalName, const QString &resourcePath, Result &out, QString *errorString=nullptr) |
| bool | parseData (const QString &internalName, const QByteArray &raw, Result &out, QString *errorString=nullptr) |
Static Public Member Functions | |
| static QString | fontDescriptor (const ThemeFontHint &hint) |
Companion parser for ThemeManager. Handles every aspect of reading a theme.jsonc file: JSONC reading (JsoncDocument), JSON parsing, section/role/color decoding, graph colors, font hints. Has no opinion on palette application, derived tokens, stylesheets, or runtime mode — those remain ThemeManager's responsibility.
Constructed with const references to the section definitions and the role-name → ThemeToken cache owned by ThemeManager; never modifies them. A single ThemeParser instance can parse successive themes.
Private to the theme subsystem. Outside callers should go through ThemeManager.
|
static |
QFont::toString() descriptor of the font hint asks for, or an empty string when the hint is unset. No resolution happens here; FontManager::themeFont() owns it.
| bool ThemeParser::parse | ( | const QString & | internalName, |
| const QString & | resourcePath, | ||
| Result & | out, | ||
| QString * | errorString = nullptr ) |
Reads and parses the theme JSONC at the given Qt resource path.
| internalName | short name (e.g. "default"); stored on the result. |
| resourcePath | full Qt resource URL (e.g. ":/themes/default/theme.jsonc"). |
| out | populated on success. |
| errorString | optional; set to the fatal error on failure. |
| bool ThemeParser::parseData | ( | const QString & | internalName, |
| const QByteArray & | raw, | ||
| Result & | out, | ||
| QString * | errorString = nullptr ) |
Parses theme JSONC that is already in memory. parse() reads the file and delegates here.
JSON syntax errors are reported as "Line L, column C: <message>". Non-fatal findings (invalid colors, unknown keys, ...) go to out.report.
| internalName | short name; stored on the result. |
| raw | theme file content, comments allowed. |
| out | populated on success. |
| errorString | optional; set to the fatal error on failure. |