24#include <wx/translation.h>
37 return !( lhs == rhs );
57 j.at(
"name" ).get_to( f.
name );
58 j.at(
"label" ).get_to( f.
label );
59 j.at(
"show" ).get_to( f.
show );
60 j.at(
"group_by" ).get_to( f.
groupBy );
64bool operator!=(
const BOM_PRESET& lhs,
const BOM_PRESET& rhs )
66 return !( lhs == rhs );
70bool operator<(
const BOM_PRESET& lhs,
const BOM_PRESET& rhs )
72 return lhs.name < rhs.name;
76void to_json( nlohmann::json& j,
const BOM_PRESET& p )
80 {
"sort_field", p.sortField },
81 {
"sort_asc", p.sortAsc },
82 {
"filter_string", p.filterString },
83 {
"filter_scope", p.filterScope },
84 {
"group_symbols", p.groupSymbols },
85 {
"exclude_dnp", p.excludeDNP },
86 {
"include_excluded_from_bom", p.includeExcludedFromBOM },
89 if( p.fieldsOrdered.size() > 0 )
90 j[
"fields_ordered"] = p.fieldsOrdered;
94void from_json(
const nlohmann::json& j, BOM_PRESET& f )
96 j.at(
"name" ).get_to( f.name );
97 j.at(
"fields_ordered" ).get_to( f.fieldsOrdered );
98 j.at(
"sort_field" ).get_to( f.sortField );
99 j.at(
"sort_asc" ).get_to( f.sortAsc );
100 j.at(
"filter_string" ).get_to( f.filterString );
102 j.at(
"group_symbols" ).get_to( f.groupSymbols );
103 j.at(
"exclude_dnp" ).get_to( f.excludeDNP );
106 f.includeExcludedFromBOM = j.value(
"include_excluded_from_bom",
false );
111bool BOM_PRESET::operator==(
const BOM_PRESET& rhs )
const
113 return this->
name == rhs.name
114 && this->readOnly == rhs.readOnly
115 && this->fieldsOrdered == rhs.fieldsOrdered
116 && this->sortField == rhs.sortField
117 && this->sortAsc == rhs.sortAsc
118 && this->filterString == rhs.filterString
119 && this->filterScope == rhs.filterScope
120 && this->groupSymbols == rhs.groupSymbols
121 && this->excludeDNP == rhs.excludeDNP
122 && this->includeExcludedFromBOM == rhs.includeExcludedFromBOM;
126BOM_PRESET BOM_PRESET::DefaultEditing()
133 p.fieldsOrdered = std::vector<BOM_FIELD>{
134 {
"Reference",
"Reference",
true,
false },
135 {
"${QUANTITY}",
"Qty",
true,
false },
136 {
"Value",
"Value",
true,
true },
137 {
"${DNP}",
"DNP",
true,
true },
138 {
"${EXCLUDE_FROM_BOM}",
"Exclude from BOM",
true,
true },
139 {
"${EXCLUDE_FROM_BOARD}",
"Exclude from Board",
true,
true },
140 {
"${EXCLUDE_FROM_SIM}",
"Exclude from Simulation",
true,
true },
141 {
"${EXCLUDE_FROM_POS_FILES}",
"Exclude from Position Files",
true,
true },
142 {
"Footprint",
"Footprint",
true,
true },
143 {
"Datasheet",
"Datasheet",
true,
false },
150BOM_PRESET BOM_PRESET::GroupedByValue()
157 p.fieldsOrdered = std::vector<BOM_FIELD>{
158 {
"Reference",
"Reference",
true,
false },
159 {
"Value",
"Value",
true,
true },
160 {
"Datasheet",
"Datasheet",
true,
false },
161 {
"Footprint",
"Footprint",
true,
false },
162 {
"${QUANTITY}",
"Qty",
true,
false },
163 {
"${DNP}",
"DNP",
true,
true },
170BOM_PRESET BOM_PRESET::GroupedByValueFootprint()
173 _HKI(
"Grouped By Value and Footprint" ),
true, {},
_(
"Reference" ),
true,
"",
177 p.fieldsOrdered = std::vector<BOM_FIELD>{
178 {
"Reference",
"Reference",
true,
false },
179 {
"Value",
"Value",
true,
true },
180 {
"Datasheet",
"Datasheet",
true,
false },
181 {
"Footprint",
"Footprint",
true,
true },
182 {
"${QUANTITY}",
"Qty",
true,
false },
183 {
"${DNP}",
"DNP",
true,
true },
190BOM_PRESET BOM_PRESET::Attributes()
197 p.fieldsOrdered = std::vector<BOM_FIELD>{
198 {
"Reference",
"Reference",
true,
false },
199 {
"Value",
"Value",
true,
true },
200 {
"Datasheet",
"Datasheet",
false,
false },
201 {
"Footprint",
"Footprint",
false,
true },
202 {
"${DNP}",
"Do Not Place",
true,
false },
203 {
"${EXCLUDE_FROM_BOM}",
"Exclude from BOM",
true,
false },
204 {
"${EXCLUDE_FROM_BOARD}",
"Exclude from Board",
true,
false },
205 {
"${EXCLUDE_FROM_SIM}",
"Exclude from Simulation",
true,
false },
206 {
"${EXCLUDE_FROM_POS_FILES}",
"Exclude from Position Files",
true,
false },
213std::vector<BOM_PRESET> BOM_PRESET::BuiltInPresets()
215 return { BOM_PRESET::DefaultEditing(), BOM_PRESET::GroupedByValue(),
216 BOM_PRESET::GroupedByValueFootprint(), BOM_PRESET::Attributes() };
234 return !( lhs == rhs );
246 j = nlohmann::json{ {
"name", p.
name },
259 j.at(
"name" ).get_to( f.
name );
264 j.at(
"keep_tabs" ).get_to( f.
keepTabs );
273 return {
_HKI(
"CSV" ),
true, wxS(
"," ), wxT(
"\"" ), wxT(
"," ), wxT(
"" ),
false,
false,
false };
279 return {
_HKI(
"TSV" ),
true, wxS(
"\t" ), wxT(
"" ), wxT(
"," ), wxT(
"" ),
false,
false,
false };
286 _HKI(
"Semicolons" ),
true, wxS(
";" ), wxT(
"'" ), wxT(
"," ), wxT(
"" ),
false,
false,
false
297#if !defined( __MINGW32__ )
void to_json(nlohmann::json &j, const BOM_FIELD &f)
bool operator<(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
void from_json(const nlohmann::json &j, BOM_FIELD &f)
bool operator!=(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
bool operator==(const BOM_FIELD &rhs) const
bool operator==(const BOM_FMT_PRESET &rhs) const
bool includeByteOrderMark
static BOM_FMT_PRESET CSV()
static std::vector< BOM_FMT_PRESET > BuiltInPresets()
static BOM_FMT_PRESET TSV()
wxString refRangeDelimiter
static BOM_FMT_PRESET Semicolons()