HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::PythonSerializer Class Reference

#include </home/runner/work/hal/hal/plugins/gui/include/gui/python/python_editor.h>

Inheritance diagram for hal::PythonSerializer:
Inheritance graph
Collaboration diagram for hal::PythonSerializer:
Collaboration graph

Public Member Functions

 PythonSerializer ()
 
std::string serialize (Netlist *netlist, const std::filesystem::path &savedir, bool isAutosave)
 
void deserialize (Netlist *netlist, const std::filesystem::path &loaddir)
 
QString getDirectory () const
 
std::string serialize_control (const std::filesystem::path &savedir=std::filesystem::path(), bool isAutosave=false)
 
- Public Member Functions inherited from hal::ProjectSerializer
 ProjectSerializer (const std::string &name)
 
virtual ~ProjectSerializer ()
 

Static Public Attributes

static QString sPythonRelDir = "py"
 
static std::string sControlFileName = "pythoneditor.json"
 

Additional Inherited Members

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

Detailed Description

Stores the python scripts that are open in the editor together with the project.

Definition at line 64 of file python_editor.h.

Constructor & Destructor Documentation

◆ PythonSerializer()

Member Function Documentation

◆ deserialize()

void hal::PythonSerializer::deserialize ( Netlist netlist,
const std::filesystem::path &  loaddir 
)
virtual

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 141 of file python_editor.cpp.

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

◆ getDirectory()

QString hal::PythonSerializer::getDirectory ( ) const

◆ serialize()

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

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 58 of file python_editor.cpp.

References QDir::absolutePath(), QString::fromStdString(), hal::gContentManager, hal::ContentManager::getPythonEditorWidget(), hal::PythonEditor::saveAllTabs(), serialize_control(), sPythonRelDir, and QString::toStdString().

◆ serialize_control()

Member Data Documentation

◆ sControlFileName

std::string hal::PythonSerializer::sControlFileName = "pythoneditor.json"
static

Definition at line 93 of file python_editor.h.

Referenced by serialize_control().

◆ sPythonRelDir

QString hal::PythonSerializer::sPythonRelDir = "py"
static

Definition at line 92 of file python_editor.h.

Referenced by serialize(), and serialize_control().


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