34#include <wx/filename.h>
44 { JOBSET_DESTINATION_T::FOLDER,
46 { JOBSET_DESTINATION_T::ARCHIVE,
53 { JOBSET_DESTINATION_T::FOLDER,
"folder" },
54 { JOBSET_DESTINATION_T::ARCHIVE,
"archive" }
59 j = nlohmann::json{ {
"id", f.
m_id },
62 {
"settings", nlohmann::json::object( {} ) }
71 j.at(
"type" ).get_to( f.
m_type );
72 j.at(
"id" ).get_to( f.
m_id );
75 nlohmann::json settings_obj = j.at(
"settings" );
79 if( f.
m_job !=
nullptr )
82 f.
m_job = std::make_shared<JOB_UNKNOWN>( f.
m_type.ToStdString(), settings_obj );
88 j = nlohmann::json{ {
"id", destination.
m_id },
89 {
"type", destination.
m_type },
90 {
"only", destination.
m_only },
92 {
"settings", nlohmann::json::object( {} ) }
102 if( j.contains(
"id" ) )
103 j.at(
"id" ).get_to( destination.
m_id );
107 j.at(
"type" ).get_to( destination.
m_type );
108 destination.
m_only = j.value(
"only", std::vector<wxString>() );
111 const nlohmann::json& settings_obj = j.at(
"settings" );
142 if(
m_type == JOBSET_DESTINATION_T::FOLDER )
146 else if(
m_type == JOBSET_DESTINATION_T::ARCHIVE )
187 if( aDescription ==
m_job->GetDefaultDescription() )
219 m_jobs.emplace_back(
KIID().AsString(), aType, aJob );
238 return destination.
m_id == aDestination->
m_id;
255 if( aJobIdx <
m_jobs.size() - 1 )
286 if( destination.m_id == aDestinationStr || destination.m_description == aDestinationStr )
310 wxASSERT( aDestination !=
nullptr );
312 if( aDestination->
m_only.size() == 0 )
317 std::vector<JOBSET_JOB>
result;
318 for( wxString& onlyId : aDestination->
m_only )
323 if( job.m_id == onlyId )
337#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.