HAL
hal::ModuleColorSerializer Class Reference

#include <module_color_manager.h>

Inheritance diagram for hal::ModuleColorSerializer:
Inheritance graph
Collaboration diagram for hal::ModuleColorSerializer:
Collaboration graph

Public Member Functions

 ModuleColorSerializer ()
 
std::string serialize (Netlist *netlist, const std::filesystem::path &savedir, bool isAutosave) override
 
void deserialize (Netlist *netlist, const std::filesystem::path &loaddir) override
 
void restore (ModuleColorManager *mcm)
 
- Public Member Functions inherited from hal::ProjectSerializer
 ProjectSerializer (const std::string &name)
 
virtual ~ProjectSerializer ()
 

Additional Inherited Members

- Protected Attributes inherited from hal::ProjectSerializer
std::string m_name
 

Detailed Description

Persist module color settings to file and restore module color assignment from previous session

Definition at line 112 of file module_color_manager.h.

Constructor & Destructor Documentation

◆ ModuleColorSerializer()

hal::ModuleColorSerializer::ModuleColorSerializer ( )

Definition at line 72 of file module_color_manager.cpp.

Member Function Documentation

◆ deserialize()

void hal::ModuleColorSerializer::deserialize ( Netlist netlist,
const std::filesystem::path &  loaddir 
)
overridevirtual

Abstract deserialize method to be implemented by derived class. Note that it can be assumed upon calling this method that the deserialization of the netlist has been successful. Caller will provide project directory name but not the filename. The latter one can be queried from ProjectManager.

Parameters
[in]netlistThe netlist already deserialized
[in]loaddirProject directory to load files from

Implements hal::ProjectSerializer.

Definition at line 121 of file module_color_manager.cpp.

References hal::ProjectManager::get_filename(), hal::ProjectManager::instance(), hal::ProjectSerializer::m_name, and test_multiple::netlist.

◆ restore()

◆ serialize()

std::string hal::ModuleColorSerializer::serialize ( Netlist netlist,
const std::filesystem::path &  savedir,
bool  isAutosave 
)
overridevirtual

Abstract serialize method to be implemented by derived class. If there was no need for serialization or serialization failed an empty file name should be returned.

Parameters
[in]netlistThe netlist to be serialized
[in]savedirTarget project directory
[in]isAutosaveTrue if serialize call was issued from autosave, false otherwise
Returns
relative name of file name that was used for serialization

Implements hal::ProjectSerializer.

Definition at line 97 of file module_color_manager.cpp.

References QDir::absoluteFilePath(), QJsonDocument::Compact, QString::fromStdString(), hal::NetlistRelay::getModuleColorManager(), hal::gNetlistRelay, test_multiple::netlist, QFile::open(), QString::toStdString(), QIODevice::write(), and QIODevice::WriteOnly.


The documentation for this class was generated from the following files: