35#include <wx/filename.h>
45 { JOBSET_DESTINATION_T::FOLDER,
47 { JOBSET_DESTINATION_T::ARCHIVE,
54 { JOBSET_DESTINATION_T::FOLDER,
"folder" },
55 { JOBSET_DESTINATION_T::ARCHIVE,
"archive" }
60 j = nlohmann::json{ {
"id", f.
m_id },
63 {
"settings", nlohmann::json::object( {} ) }
72 j.at(
"type" ).get_to( f.
m_type );
73 j.at(
"id" ).get_to( f.
m_id );
76 nlohmann::json settings_obj = j.at(
"settings" );
80 if( f.
m_job !=
nullptr )
83 f.
m_job = std::make_shared<JOB_UNKNOWN>( f.
m_type.ToStdString(), settings_obj );
89 j = nlohmann::json{ {
"id", destination.
m_id },
90 {
"type", destination.
m_type },
91 {
"only", destination.
m_only },
93 {
"settings", nlohmann::json::object( {} ) }
103 if( j.contains(
"id" ) )
104 j.at(
"id" ).get_to( destination.
m_id );
108 j.at(
"type" ).get_to( destination.
m_type );
109 destination.
m_only = j.value(
"only", std::vector<wxString>() );
112 const nlohmann::json& settings_obj = j.at(
"settings" );
143 if(
m_type == JOBSET_DESTINATION_T::FOLDER )
147 else if(
m_type == JOBSET_DESTINATION_T::ARCHIVE )
188 if( aDescription ==
m_job->GetDefaultDescription() )
220 m_jobs.emplace_back(
KIID().AsString(), aType, aJob );
239 return destination.
m_id == aDestination->
m_id;
256 if( aJobIdx <
m_jobs.size() - 1 )
287 if( destination.m_id == aDestinationStr || destination.m_description == aDestinationStr )
311 wxASSERT( aDestination !=
nullptr );
313 if( aDestination->
m_only.size() == 0 )
318 std::vector<JOBSET_JOB>
result;
319 for( wxString& onlyId : aDestination->
m_only )
324 if( job.m_id == onlyId )
338#if !defined( __MINGW32__ )
wxString m_fileNameWithoutPath
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
void SetDirty(bool aFlag=true)
void MoveJobUp(size_t aJobIdx)
std::vector< JOBSET_DESTINATION > m_destinations
std::vector< JOBSET_JOB > GetJobsForDestination(JOBSET_DESTINATION *aDestination)
std::vector< JOBSET_JOB > m_jobs
void RemoveJob(size_t aJobIdx)
void AddNewJob(wxString aType, JOB *aJob)
void MoveJobDown(size_t aJobIdx)
JOBSET_DESTINATION * AddNewDestination(JOBSET_DESTINATION_T aType)
wxString getFileExt() const override
JOBSET(const wxString &aFilename)
void RemoveDestination(JOBSET_DESTINATION *aDestination)
JOBSET_DESTINATION * FindDestination(wxString &aDestinationStr)
Attempts to find a destination based on the given string Both the uuid of the destination and descrip...
virtual void ToJson(nlohmann::json &j) const =0
virtual void FromJson(const nlohmann::json &j)=0
static T * CreateInstance(const wxString &aName)
An simple container class that lets us dispatch output jobs to kifaces.
virtual void FromJson(const nlohmann::json &j)
virtual void ToJson(nlohmann::json &j) const
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
wxString AsString() const
static const std::string KiCadJobSetFileExtension
static wxString ZipFileWildcard()
Some functions to handle hotkeys in KiCad.
KICOMMON_API void to_json(nlohmann::json &j, const JOBSET_DESTINATION &destination)
KICOMMON_API void from_json(const nlohmann::json &j, JOBSET_JOB &f)
NLOHMANN_JSON_SERIALIZE_ENUM(JOBSET_DESTINATION_T, { { JOBSET_DESTINATION_T::FOLDER, "folder" }, { JOBSET_DESTINATION_T::ARCHIVE, "archive" } }) KICOMMON_API void to_json(nlohmann
const int jobsFileSchemaVersion
KICOMMON_API std::map< JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO > JobsetDestinationTypeInfos
enum KICOMMON_API JOBSET_DESTINATION_T
std::unordered_map< wxString, std::shared_ptr< JOBSET_OUTPUT_REPORTER > > m_lastRunReporters
void SetDescription(const wxString &aDescription)
std::shared_ptr< JOBS_OUTPUT_HANDLER > m_outputHandler
JOBSET_DESTINATION_T m_type
std::vector< wxString > m_only
Transient property, not stored for now.
wxString GetPathInfo() const
bool operator==(const JOBSET_DESTINATION &rhs) const
wxString GetDescription() const
std::optional< bool > m_lastRunSuccess
std::shared_ptr< JOB > m_job
bool operator==(const JOBSET_JOB &rhs) const
wxString GetDescription() const
void SetDescription(const wxString &aDescription)
wxString result
Test unit parsing edge cases and error handling.
Definition of file extensions used in Kicad.