KiCad PCB EDA Suite
Loading...
Searching...
No Matches
diff_format_helpers.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,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU 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, you may find one here:
18
* http://www.gnu.org/licenses/gpl-3.0.html
19
* or you may search the http://www.gnu.org website for the version 3 license,
20
* or you may write to the Free Software Foundation, Inc.,
21
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22
*/
23
24
#pragma once
25
26
#include <wx/crt.h>
27
#include <wx/string.h>
28
29
#include <string>
30
31
32
namespace
CLI
33
{
34
35
template
<
typename
Format>
36
bool
ParseDiffOutputFormat
(
const
std::string& aText,
Format
& aOut )
37
{
38
if
( aText ==
"json"
)
39
{
40
aOut = Format::JSON;
41
return
true
;
42
}
43
44
if
( aText ==
"text"
)
45
{
46
aOut = Format::TEXT;
47
return
true
;
48
}
49
50
if
( aText ==
"png"
)
51
{
52
aOut = Format::PNG;
53
return
true
;
54
}
55
56
if
( aText ==
"svg"
)
57
{
58
aOut = Format::SVG;
59
return
true
;
60
}
61
62
return
false
;
63
}
64
65
66
template
<
typename
Format>
67
bool
DiffOutputFormatRequiresOutputPath
(
Format
aFormat )
68
{
69
return
aFormat == Format::PNG || aFormat == Format::SVG;
70
}
71
72
73
inline
void
ReportInvalidDiffOutputFormat
(
const
std::string& aText )
74
{
75
wxFprintf( stderr,
_
(
"Invalid output format '%s' (expected 'json', 'text', 'png', or 'svg')\n"
),
76
wxString::FromUTF8( aText ) );
77
}
78
79
}
// namespace CLI
_
#define _(s)
Definition
eda_3d_actions.cpp:36
CLI
Definition
exit_codes.h:25
CLI::DiffOutputFormatRequiresOutputPath
bool DiffOutputFormatRequiresOutputPath(Format aFormat)
Definition
diff_format_helpers.h:67
CLI::ReportInvalidDiffOutputFormat
void ReportInvalidDiffOutputFormat(const std::string &aText)
Definition
diff_format_helpers.h:73
CLI::ParseDiffOutputFormat
bool ParseDiffOutputFormat(const std::string &aText, Format &aOut)
Definition
diff_format_helpers.h:36
Format
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition
ptree.cpp:194
src
kicad
cli
diff_format_helpers.h
Generated on Thu Jun 18 2026 00:06:56 for KiCad PCB EDA Suite by
1.13.2