KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drill_chart_template.h File Reference
#include <optional>
#include <vector>
#include <lset.h>
#include <math/vector2d.h>
#include <wx/string.h>

Go to the source code of this file.

Classes

struct  DRILL_CHART_COLUMN
 
struct  DRILL_CHART_FILTER
 Which holes a chart reports on. More...
 
class  DRILL_CHART_TEMPLATE
 The column set and formatting a new chart starts from. More...
 

Enumerations

enum class  DRILL_CHART_COLUMN_ID {
  SYMBOL , DRILL_DIAMETER , SLOT_SIZE , PLATING ,
  OPERATION_COUNT , SITE_COUNT , LAYER_SPAN , OPERATION ,
  PROTECTION , BACKDRILL_STUB , ASPECT_RATIO , DESCRIPTION
}
 
enum class  DRILL_CHART_ALIGN { LEFT , CENTER , RIGHT }
 
enum class  DRILL_CHART_UNITS { MM , INCH }
 

Functions

LSET DrillDocumentationLayers ()
 Layers a chart or map may live on.
 
bool ValidateDrillChartColumns (std::vector< DRILL_CHART_COLUMN > &aColumns)
 Reject a column set that repeats an id or is implausibly wide.
 
bool DrillChartDefaultColumn (DRILL_CHART_COLUMN_ID aId, DRILL_CHART_COLUMN &aColumn)
 The heading and alignment a column starts with, so the writer can leave them out of the file and the parser can put the same values back.
 
const char * DrillChartUnitsToken (DRILL_CHART_UNITS aUnits)
 Stable file tokens, independent of enum ordering so inserting a value later cannot change what an existing board file means.
 
const char * DrillChartColumnToken (DRILL_CHART_COLUMN_ID aId)
 
const char * DrillChartAlignToken (DRILL_CHART_ALIGN aAlign)
 
bool DrillChartUnitsFromToken (const wxString &aToken, DRILL_CHART_UNITS &aUnits)
 
bool DrillChartColumnFromToken (const wxString &aToken, DRILL_CHART_COLUMN_ID &aId)
 
bool DrillChartAlignFromToken (const wxString &aToken, DRILL_CHART_ALIGN &aAlign)
 

Variables

constexpr int DRILL_CHART_MAX_COLUMN_WIDTH = 1000 * 1000000
 A chart column can be no wider than this, and no chart wider than that in total.
 
constexpr int64_t DRILL_CHART_MAX_TOTAL_WIDTH = 10LL * 1000 * 1000000
 

Enumeration Type Documentation

◆ DRILL_CHART_ALIGN

enum class DRILL_CHART_ALIGN
strong
Enumerator
LEFT 
CENTER 
RIGHT 

Definition at line 48 of file drill_chart_template.h.

◆ DRILL_CHART_COLUMN_ID

enum class DRILL_CHART_COLUMN_ID
strong
Enumerator
SYMBOL 
DRILL_DIAMETER 
SLOT_SIZE 
PLATING 
OPERATION_COUNT 
SITE_COUNT 
LAYER_SPAN 
OPERATION 
PROTECTION 
BACKDRILL_STUB 
ASPECT_RATIO 
DESCRIPTION 

Definition at line 31 of file drill_chart_template.h.

◆ DRILL_CHART_UNITS

enum class DRILL_CHART_UNITS
strong
Enumerator
MM 
INCH 

Definition at line 57 of file drill_chart_template.h.

Function Documentation

◆ DrillChartAlignFromToken()

bool DrillChartAlignFromToken ( const wxString & aToken,
DRILL_CHART_ALIGN & aAlign )

◆ DrillChartAlignToken()

const char * DrillChartAlignToken ( DRILL_CHART_ALIGN aAlign)

◆ DrillChartColumnFromToken()

bool DrillChartColumnFromToken ( const wxString & aToken,
DRILL_CHART_COLUMN_ID & aId )

◆ DrillChartColumnToken()

const char * DrillChartColumnToken ( DRILL_CHART_COLUMN_ID aId)

◆ DrillChartDefaultColumn()

bool DrillChartDefaultColumn ( DRILL_CHART_COLUMN_ID aId,
DRILL_CHART_COLUMN & aColumn )

The heading and alignment a column starts with, so the writer can leave them out of the file and the parser can put the same values back.

False for a column with no default.

Definition at line 112 of file drill_chart_template.cpp.

References DRILL_CHART_COLUMN::m_Align, DRILL_CHART_COLUMN::m_Heading, and DRILL_CHART_COLUMN::m_Id.

Referenced by PCB_IO_KICAD_SEXPR::format(), DRILL_CHART_TEMPLATE::MakeDefault(), and PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART().

◆ DrillChartUnitsFromToken()

bool DrillChartUnitsFromToken ( const wxString & aToken,
DRILL_CHART_UNITS & aUnits )

◆ DrillChartUnitsToken()

const char * DrillChartUnitsToken ( DRILL_CHART_UNITS aUnits)

Stable file tokens, independent of enum ordering so inserting a value later cannot change what an existing board file means.

Definition at line 209 of file drill_chart_template.cpp.

Referenced by PCB_IO_KICAD_SEXPR::format(), and DRILL_CHART_TEMPLATE::SaveToFile().

◆ DrillDocumentationLayers()

LSET DrillDocumentationLayers ( )

Layers a chart or map may live on.

Excludes copper, silkscreen, mask, paste, adhesive, Edge.Cuts, Margin, courtyard and rescue layers. Chart artwork and hole symbols must not alter fabrication outputs or DRC constraints.

Definition at line 74 of file drill_chart_template.cpp.

References LSET::AllNonCuMask(), B_CrtYd, Edge_Cuts, F_CrtYd, Margin, Rescue, and BASE_SET::reset().

Referenced by PCB_DRILL_CHART::Deserialize(), PCB_DRILL_MAP::Deserialize(), DIALOG_DRILL_CHART_PROPERTIES::DIALOG_DRILL_CHART_PROPERTIES(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_MAP(), PCB_CONTROL::PlaceDrillChart(), and PCB_CONTROL::PlaceDrillMap().

◆ ValidateDrillChartColumns()

bool ValidateDrillChartColumns ( std::vector< DRILL_CHART_COLUMN > & aColumns)

Reject a column set that repeats an id or is implausibly wide.

Shared so the s-expression parser, the protobuf decoder and template import cannot disagree about what is acceptable.

Definition at line 55 of file drill_chart_template.cpp.

References DRILL_CHART_MAX_COLUMN_WIDTH, and DRILL_CHART_MAX_TOTAL_WIDTH.

Referenced by PCB_DRILL_CHART::Deserialize(), DRILL_CHART_TEMPLATE::LoadFromFile(), and PCB_IO_KICAD_SEXPR_PARSER::parsePCB_DRILL_CHART().

Variable Documentation

◆ DRILL_CHART_MAX_COLUMN_WIDTH

int DRILL_CHART_MAX_COLUMN_WIDTH = 1000 * 1000000
constexpr

A chart column can be no wider than this, and no chart wider than that in total.

Bounds hostile input from any decoder. No real chart column is a metre across, and the totals are summed in int64 before being checked so the check itself cannot overflow.

Definition at line 78 of file drill_chart_template.h.

Referenced by BOOST_FIXTURE_TEST_CASE(), PCB_DRILL_CHART::Deserialize(), and ValidateDrillChartColumns().

◆ DRILL_CHART_MAX_TOTAL_WIDTH

int64_t DRILL_CHART_MAX_TOTAL_WIDTH = 10LL * 1000 * 1000000
constexpr

Definition at line 79 of file drill_chart_template.h.

Referenced by ValidateDrillChartColumns().