HAL
hal::PythonSerializer Class Reference

#include <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

Definition at line 61 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(), hal::ProjectSerializer::m_name, and test_multiple::netlist.

◆ 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(), test_multiple::netlist, 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 87 of file python_editor.h.

Referenced by serialize_control().

◆ sPythonRelDir

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

Definition at line 86 of file python_editor.h.

Referenced by serialize(), and serialize_control().


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