KiCad PCB EDA Suite
Loading...
Searching...
No Matches
downgrade_target.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <vector>
23#include <wx/string.h>
24
28{
29 wxString m_name;
30 wxString m_id;
34};
35
36
39inline const std::vector<DOWNGRADE_TARGET>& GetDowngradeTargets()
40{
41 static const std::vector<DOWNGRADE_TARGET> targets = {
42 // name id board sch symLib
43 { wxT( "KiCad 10.0" ), wxT( "10.0" ), 20260206, 20260306, 20251024 },
44 { wxT( "KiCad 9.0" ), wxT( "9.0" ), 20241229, 20250114, 20241209 },
45 };
46
47 return targets;
48}
49
50
52inline const DOWNGRADE_TARGET* FindDowngradeTarget( const wxString& aNameOrId )
53{
54 for( const DOWNGRADE_TARGET& target : GetDowngradeTargets() )
55 {
56 if( target.m_name.CmpNoCase( aNameOrId ) == 0 || target.m_id.CmpNoCase( aNameOrId ) == 0 )
57 return &target;
58 }
59
60 return nullptr;
61}
62
63
65inline wxString DowngradeTargetNames()
66{
67 wxString names;
68
69 for( const DOWNGRADE_TARGET& target : GetDowngradeTargets() )
70 {
71 names += wxString::Format( names.IsEmpty() ? wxT( "'%s' ('%s')" ) : wxT( ", '%s' ('%s')" ), target.m_name,
72 target.m_id );
73 }
74
75 return names;
76}
const std::vector< DOWNGRADE_TARGET > & GetDowngradeTargets()
Supported downgrade targets, newest first.
const DOWNGRADE_TARGET * FindDowngradeTarget(const wxString &aNameOrId)
Match a user-supplied target string against name or stable id, case-insensitively.
wxString DowngradeTargetNames()
The valid target choices as one user-facing list, for error messages.
An older KiCad release we can export a project back to.
int m_schVersion
SEXPR_SCHEMATIC_FILE_VERSION for the target.
int m_boardVersion
SEXPR_BOARD_FILE_VERSION for the target.
wxString m_id
Stable machine key for CLI and jobsets, e.g. "10.0".
int m_symLibVersion
SEXPR_SYMBOL_LIB_FILE_VERSION for the target.
wxString m_name
User-facing name, e.g. "KiCad 10.0".