cf::ui::core::ThemeFactory¶
Abstract factory for creating and serializing CF UI themes. More...
#include <theme_factory.h>
Inherited by cf::ui::core::MaterialFactory
Public Functions¶
| Name | |
|---|---|
| virtual | ~ThemeFactory() =default Virtual destructor. |
| virtual std::unique_ptr< ICFTheme > | fromName(constchar * name) =0 Creates a theme from its name. |
| virtual std::unique_ptr< ICFTheme > | fromJson(constQByteArray & json) =0 Creates a theme from JSON data. |
| virtual QByteArray | toJson(ICFTheme * raw_theme) =0 Serializes a theme to JSON format. |
Detailed Description¶
Abstract factory for creating and serializing CF UI themes.
Note: None
Warning: None
ThemeFactory provides an interface for creating ICFTheme instances from theme names or JSON data, and for serializing existing themes to JSON. Implementations of this interface handle specific theme formats.
class MyThemeFactory : public ThemeFactory {
public:
std::unique_ptr<ICFTheme> fromName(const char* name) override {
// Create theme by name
}
std::unique_ptr<ICFTheme> fromJson(const QByteArray& json) override {
// Parse JSON and create theme
}
QByteArray toJson(ICFTheme* raw_theme) override {
// Serialize theme to JSON
}
};
Public Functions Documentation¶
function ~ThemeFactory¶
Virtual destructor.
function fromName¶
Creates a theme from its name.
Parameters:
- name Name identifier of the theme to create.
Exceptions:
- May throw exceptions depending on implementation.
Return: Unique pointer to the created theme, or nullptr on error.
Since: N/A
Note: Implementation-specific behavior for unknown names.
Warning: None
Reimplemented by: cf::ui::core::MaterialFactory::fromName
function fromJson¶
Creates a theme from JSON data.
Parameters:
- json JSON byte array containing theme definition.
Exceptions:
- May throw exceptions depending on implementation.
Return: Unique pointer to the created theme, or nullptr on error.
Since: N/A
Note: Implementation-specific JSON format validation.
Warning: None
Reimplemented by: cf::ui::core::MaterialFactory::fromJson
function toJson¶
Serializes a theme to JSON format.
Parameters:
- raw_theme Pointer to the theme to serialize.
Exceptions:
- May throw exceptions depending on implementation.
Return: JSON byte array representing the theme.
Since: N/A
Note: None
Warning: None
Reimplemented by: cf::ui::core::MaterialFactory::toJson
Updated on 2026-03-09 at 10:14:00 +0000