KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bom_plugins.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) 2018 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef BOM_GENERATOR_HANDLERS_H
24#define BOM_GENERATOR_HANDLERS_H
25
26#include <wx/arrstr.h>
27#include <wx/file.h>
28#include <wx/filename.h>
29
30#include <memory>
31
32extern const wxChar BOM_TRACE[];
33
42{
43public:
47 BOM_GENERATOR_HANDLER( const wxString& aFile );
48
52 bool IsOk() { return m_isOk; }
53
59 static bool IsValidGenerator( const wxString& aFile );
60
64 const wxString& GetInfo() const
65 {
66 return m_info;
67 }
68
72 const wxFileName& GetFile() const
73 {
74 return m_file;
75 }
76
77 wxString GetStoredPath() const { return m_storedPath; }
78
87 wxFileName FindFilePath() const;
88
92 const wxString& GetName() const
93 {
94 return m_name;
95 }
96
102 void SetName( const wxString& aName )
103 {
104 m_name = aName;
105 }
106
110 const wxString& GetCommand() const
111 {
112 return m_cmd;
113 }
114
118 void SetCommand( const wxString& aCommand )
119 {
120 m_cmd = aCommand;
121 }
122
126 wxArrayString& Options()
127 {
128 return m_options;
129 }
130
131protected:
137 wxString readHeader( const wxString& aEndSection );
138
145 static wxString getOutputExtension( const wxString& aHeader );
146
148 bool m_isOk;
149
151 wxFileName m_file;
152
154 const wxString m_storedPath;
155
157 wxString m_name;
158
160 wxString m_cmd;
161
163 wxString m_info;
164
166 wxArrayString m_options;
167};
168
169#endif /* BOM_GENERATOR_HANDLERS_H */
const wxChar BOM_TRACE[]
const wxString & GetInfo() const
Return plugin description stored in the plugin header file (if available).
Definition bom_plugins.h:64
wxString m_name
Command to execute the plugin.
const wxFileName & GetFile() const
Return the file name of the plugin.
Definition bom_plugins.h:72
static bool IsValidGenerator(const wxString &aFile)
Return true if a file name matches a recognized plugin format.
wxString readHeader(const wxString &aEndSection)
Read the plugin file header.
bool m_isOk
Path to the plugin.
void SetName(const wxString &aName)
Set the customisable plugin name.
BOM_GENERATOR_HANDLER(const wxString &aFile)
wxString m_info
Plugin specific options.
bool IsOk()
Return true if the plugin is ready to work, i.e.
Definition bom_plugins.h:52
wxArrayString & Options()
Accessor to array of options.
wxString GetStoredPath() const
Definition bom_plugins.h:77
wxArrayString m_options
const wxString & GetName() const
Return the customisable plugin name.
Definition bom_plugins.h:92
wxFileName m_file
Path to the plugin stored in config (can be absolute or just a filename)
const wxString m_storedPath
User customisable name.
void SetCommand(const wxString &aCommand)
Set the command to execute the plugin.
wxString m_cmd
Description of the plugin (normally from the plugin header)
wxFileName FindFilePath() const
Returns the calculated path to the plugin: if the path is already absolute and exists,...
const wxString & GetCommand() const
Return the command to execute the plugin.
static wxString getOutputExtension(const wxString &aHeader)
Extracts the output BOM file's extension, including the '.