KiCad PCB EDA Suite
Loading...
Searching...
No Matches
jobset.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 Mark Roszko <[email protected]>
5 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef JOBS_FILE_H
22#define JOBS_FILE_H
23
24#include <jobs/job.h>
25#include <jobs/jobs_output.h>
27#include <settings/parameters.h>
28#include <ctime>
29
31{
32 JOBSET_JOB() : m_job( nullptr ) {}
33
34 JOBSET_JOB( wxString id, wxString type, JOB* job ) : m_id( id ), m_type( type ), m_job( job ) {}
35
36 wxString m_id;
37 wxString m_type;
39
40 bool operator==( const JOBSET_JOB& rhs ) const;
41};
42
44{
45 FOLDER,
47};
48
50{
52 m_type( JOBSET_OUTPUT_TYPE::FOLDER ), m_outputHandler( nullptr )
53 {}
54
55 JOBSET_OUTPUT( wxString id, JOBSET_OUTPUT_TYPE type, JOBS_OUTPUT_HANDLER* outputHandler ) :
56 m_id( id ), m_type( type ), m_outputHandler( outputHandler )
57 {
58 }
59
60 wxString m_id;
63 std::vector<wxString> m_only;
64
65 bool operator==( const JOBSET_OUTPUT& rhs ) const;
66};
67
69{
70public:
71 JOBSET( const wxString& aFilename );
72
73 virtual ~JOBSET() {}
74
75 std::vector<JOBSET_JOB>& GetJobs()
76 {
77 return m_jobs;
78 }
79
80 std::vector<JOBSET_JOB> GetJobsForOutput( JOBSET_OUTPUT* aOutput );
81
82 std::vector<JOBSET_OUTPUT>& GetOutputs() { return m_outputs; }
83
84 JOBSET_OUTPUT* GetOutput( wxString& aOutput );
85
86 bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override;
87
88 void SetDirty() { m_dirty = true; }
89 bool GetDirty() const { return m_dirty; }
90
91 wxString GetFullName() const { return m_fileNameWithoutPath; }
92
93 void AddNewJob( wxString aType, JOB* aJob );
94 JOBSET_OUTPUT AddNewJobOutput( JOBSET_OUTPUT_TYPE aType,
95 JOBS_OUTPUT_HANDLER* aJobOutput );
96
97 void RemoveOutput( JOBSET_OUTPUT* aOutput );
98 void MoveJobUp( size_t aJobIdx );
99 void MoveJobDown( size_t aJobIdx );
100 void RemoveJob( size_t aJobIdx );
101
102protected:
103 wxString getFileExt() const override;
104
105private:
106 std::vector<JOBSET_JOB> m_jobs;
107 std::vector<JOBSET_OUTPUT> m_outputs;
108
111};
112
113KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_JOB& f );
114KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_JOB& f );
115
116KICOMMON_API void to_json( nlohmann::json& j, const JOBSET_OUTPUT& f );
117KICOMMON_API void from_json( const nlohmann::json& j, JOBSET_OUTPUT& f );
118
119#if defined( __MINGW32__ )
122#else
123extern template class APIVISIBLE PARAM_LIST<JOBSET_JOB>;
124extern template class APIVISIBLE PARAM_LIST<JOBSET_OUTPUT>;
125#endif
126
127#endif
bool operator==(const wxAuiPaneInfo &aLhs, const wxAuiPaneInfo &aRhs)
Definition: jobset.h:69
wxString m_fileNameWithoutPath
Definition: jobset.h:110
bool GetDirty() const
Definition: jobset.h:89
void SetDirty()
Definition: jobset.h:88
std::vector< JOBSET_JOB > m_jobs
Definition: jobset.h:106
std::vector< JOBSET_OUTPUT > m_outputs
Definition: jobset.h:107
std::vector< JOBSET_JOB > & GetJobs()
Definition: jobset.h:75
bool m_dirty
Definition: jobset.h:109
std::vector< JOBSET_OUTPUT > & GetOutputs()
Definition: jobset.h:82
wxString GetFullName() const
Definition: jobset.h:91
virtual ~JOBSET()
Definition: jobset.h:73
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:79
#define APIVISIBLE
Definition: import_export.h:55
JOBSET_OUTPUT_TYPE
Definition: jobset.h:44
KICOMMON_API void from_json(const nlohmann::json &j, JOBSET_JOB &f)
Definition: jobset.cpp:53
KICOMMON_API void to_json(nlohmann::json &j, const JOBSET_JOB &f)
#define KICOMMON_API
Definition: kicommon.h:28
wxString m_id
Definition: jobset.h:36
JOB * m_job
Definition: jobset.h:38
JOBSET_JOB(wxString id, wxString type, JOB *job)
Definition: jobset.h:34
wxString m_type
Definition: jobset.h:37
JOBSET_JOB()
Definition: jobset.h:32
std::vector< wxString > m_only
Definition: jobset.h:63
wxString m_id
Definition: jobset.h:60
JOBS_OUTPUT_HANDLER * m_outputHandler
Definition: jobset.h:62
JOBSET_OUTPUT()
Definition: jobset.h:51
JOBSET_OUTPUT(wxString id, JOBSET_OUTPUT_TYPE type, JOBS_OUTPUT_HANDLER *outputHandler)
Definition: jobset.h:55
JOBSET_OUTPUT_TYPE m_type
Definition: jobset.h:61