42 virtual void FromJson(
const nlohmann::json& j )
const = 0;
44 virtual void ToJson( nlohmann::json& j ) = 0;
50template <
typename ValueType>
55 JOB_PARAM(
const std::string& aJsonPath, ValueType* aPtr,
56 ValueType aDefault ) :
61 virtual void FromJson(
const nlohmann::json& j )
const override
74template <
typename ListElementType>
78 JOB_PARAM_LIST(
const std::string& aJsonPath, std::vector<ListElementType>* aPtr,
79 std::vector<ListElementType> aDefault ) :
85 virtual void FromJson(
const nlohmann::json& j )
const override
90 std::vector<ListElementType> val;
94 for(
const auto& el : js.items() )
95 val.push_back( el.value().template get<ListElementType>() );
104 void ToJson( nlohmann::json& j )
override
106 nlohmann::json js = nlohmann::json::array();
108 for(
const auto& el : *
m_ptr )
115 std::vector<ListElementType>*
m_ptr;
128 virtual void FromJson(
const nlohmann::json& j )
const override
137 for(
const nlohmann::json& layer : js )
139 if( layer.is_string() )
141 wxString
name = layer.get<wxString>();
144 layers.push_back(
static_cast<PCB_LAYER_ID>( layerId ) );
148 int layerId = layer.get<
int>();
150 layers.push_back(
static_cast<PCB_LAYER_ID>( layerId ) );
160 void ToJson( nlohmann::json& j )
override
162 nlohmann::json js = nlohmann::json::array();
186 JOB(
const std::string& aType,
bool aOutputIsDirectory );
206 virtual void FromJson(
const nlohmann::json& j );
207 virtual void ToJson( nlohmann::json& j )
const;
209 virtual wxString GetDefaultDescription()
const;
210 virtual wxString GetSettingsDialogTitle()
const;
223 void SetTempOutputDirectory(
const wxString& aBase );
228 void SetConfiguredOutputPath(
const wxString& aPath );
252 wxString GetFullOutputPath(
PROJECT* aProject )
const;
254 wxString ResolveOutputPath(
const wxString& aPath,
bool aPathIsDirectory,
PROJECT* aProject )
const;
virtual void ToJson(nlohmann::json &j)=0
virtual void FromJson(const nlohmann::json &j) const =0
JOB_PARAM_BASE(const std::string &aJsonPath)
virtual ~JOB_PARAM_BASE()=default
void ToJson(nlohmann::json &j) override
std::vector< ListElementType > m_default
JOB_PARAM_LIST(const std::string &aJsonPath, std::vector< ListElementType > *aPtr, std::vector< ListElementType > aDefault)
virtual void FromJson(const nlohmann::json &j) const override
std::vector< ListElementType > * m_ptr
JOB_PARAM_LSEQ(const std::string &aJsonPath, LSEQ *aPtr, LSEQ aDefault)
void ToJson(nlohmann::json &j) override
virtual void FromJson(const nlohmann::json &j) const override
JOB_PARAM(const std::string &aJsonPath, ValueType *aPtr, ValueType aDefault)
virtual void ToJson(nlohmann::json &j) override
virtual void FromJson(const nlohmann::json &j) const override
An simple container class that lets us dispatch output jobs to kifaces.
void SetVarOverrides(const std::map< wxString, wxString > &aVarOverrides)
std::vector< JOB_PARAM_BASE * > m_params
JOB(const std::string &aType, bool aOutputIsDirectory)
const std::vector< JOB_OUTPUT > & GetOutputs()
void AddOutput(wxString aOutputPath)
const std::vector< JOB_PARAM_BASE * > & GetParams()
wxString GetWorkingOutputPath() const
Returns the working output path for the job, if one has been set.
wxString m_workingOutputPath
The working output path is a transient path that takes priority over the configured output path when ...
bool GetOutputPathIsDirectory() const
wxString m_tempOutputDirectory
JOB & operator=(const JOB &)=delete
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
std::vector< JOB_OUTPUT > m_outputs
bool m_outputPathIsDirectory
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
void SetWorkingOutputPath(const wxString &aPath)
Sets a transient output path for the job, it takes priority over the configured output path when GetF...
const std::string & GetType() const
std::map< wxString, wxString > m_varOverrides
const std::map< wxString, wxString > & GetVarOverrides() const
void ClearExistingOutputs()
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Container for project specific data.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
KICOMMON_API void to_json(nlohmann::json &j, const JOB &f)
KICOMMON_API void from_json(const nlohmann::json &j, JOB &f)
PCB_LAYER_ID
A quick note on layer IDs:
JOB_OUTPUT(wxString outputPath)