21#include <nlohmann/json.hpp>
44 j = nlohmann::json{ {
"id", f.
m_id },
46 {
"settings", nlohmann::json::object( {} ) }
55 j.at(
"type" ).get_to( f.
m_type );
56 j.at(
"id" ).get_to( f.
m_id );
58 nlohmann::json settings_obj = j.at(
"settings" );
60 f.
m_job = JOB_REGISTRY::CreateInstance<JOB>( f.
m_type );
62 if( f.
m_job !=
nullptr )
71 j = nlohmann::json{ {
"type", f.
m_type }, {
"settings", nlohmann::json::object( {} ) } };
79 j.at(
"type" ).get_to( f.
m_type );
80 f.
m_only = j.value(
"only", std::vector<wxString>() );
82 nlohmann::json settings_obj = j.at(
"settings" );
131 m_jobs.emplace_back(
KIID().AsString(), aType, aJob );
139 m_outputs.emplace_back(
KIID().AsString(), aType, aJobOutput );
151 return output.
m_id == aOutput->
m_id;
168 if( aJobIdx <
m_jobs.size() - 1 )
200 if( output.m_id == aOutput )
215 wxASSERT( aOutput !=
nullptr );
217 if( aOutput->
m_only.size() == 0 )
222 std::vector<JOBSET_JOB> result;
223 for( wxString& onlyId : aOutput->
m_only )
228 if( job.m_id == onlyId )
235 result.push_back( *it );
242#if !defined( __MINGW32__ )
wxString m_fileNameWithoutPath
std::vector< JOBSET_JOB > GetJobsForOutput(JOBSET_OUTPUT *aOutput)
JOBSET_OUTPUT AddNewJobOutput(JOBSET_OUTPUT_TYPE aType, JOBS_OUTPUT_HANDLER *aJobOutput)
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
void RemoveOutput(JOBSET_OUTPUT *aOutput)
void MoveJobUp(size_t aJobIdx)
JOBSET_OUTPUT * GetOutput(wxString &aOutput)
std::vector< JOBSET_JOB > m_jobs
void RemoveJob(size_t aJobIdx)
std::vector< JOBSET_OUTPUT > m_outputs
void AddNewJob(wxString aType, JOB *aJob)
void MoveJobDown(size_t aJobIdx)
wxString getFileExt() const override
JOBSET(const wxString &aFilename)
virtual void ToJson(nlohmann::json &j) const =0
virtual void FromJson(const nlohmann::json &j)=0
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)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static const std::string KiCadJobSetFileExtension
NLOHMANN_JSON_SERIALIZE_ENUM(JOBSET_OUTPUT_TYPE, { { JOBSET_OUTPUT_TYPE::FOLDER, "folder" }, { JOBSET_OUTPUT_TYPE::ARCHIVE, "archive" } }) KICOMMON_API void to_json(nlohmann
KICOMMON_API void from_json(const nlohmann::json &j, JOBSET_JOB &f)
KICOMMON_API void to_json(nlohmann::json &j, const JOBSET_OUTPUT &f)
const int jobsFileSchemaVersion
@ NONE
No connection to this item.
bool operator==(const JOBSET_JOB &rhs) const
std::vector< wxString > m_only
JOBS_OUTPUT_HANDLER * m_outputHandler
bool operator==(const JOBSET_OUTPUT &rhs) const
JOBSET_OUTPUT_TYPE m_type
Definition of file extensions used in Kicad.