KiCad PCB EDA Suite
Loading...
Searching...
No Matches
GENERATED_TABLE_SCHEMA Class Reference

The columns one generator (the drill chart, a stackup table, ...) can produce, and the units and precision it starts from. More...

#include <generated_table_schema.h>

Public Member Functions

 GENERATED_TABLE_SCHEMA (std::vector< GENERATED_TABLE_COLUMN_DEF > aDefs, GENERATED_TABLE_UNITS aDefaultUnits, int aDefaultPrecision)
 
const std::vector< GENERATED_TABLE_COLUMN_DEF > & Defs () const
 
const GENERATED_TABLE_COLUMN_DEF * Find (int aId) const
 
const GENERATED_TABLE_COLUMN_DEF * FindToken (const wxString &aToken) const
 
const char * Token (int aId) const
 The file token for a known id, or a stable placeholder for one the schema does not recognize, so a writer always has something parseable to put in "(id ...)".
 
GENERATED_TABLE_COLUMN DefaultColumn (int aId) const
 
std::vector< GENERATED_TABLE_COLUMN > Defaults () const
 
bool Validate (std::vector< GENERATED_TABLE_COLUMN > &aColumns) const
 Drop a column whose id the schema does not know and a column that repeats an id already kept, then clamp every surviving width.
 
GENERATED_TABLE_UNITS DefaultUnits () const
 
int DefaultPrecision () const
 

Private Attributes

std::vector< GENERATED_TABLE_COLUMN_DEF > m_defs
 
GENERATED_TABLE_UNITS m_defaultUnits
 
int m_defaultPrecision
 

Detailed Description

The columns one generator (the drill chart, a stackup table, ...) can produce, and the units and precision it starts from.

A schema is immutable once built, so every consumer reading the same id sees the same heading, alignment and default. Stable ids and tokens let a saved file outlive a KiCad release that reorders or extends the column list.

Definition at line 101 of file generated_table_schema.h.

Constructor & Destructor Documentation

◆ GENERATED_TABLE_SCHEMA()

GENERATED_TABLE_SCHEMA::GENERATED_TABLE_SCHEMA ( std::vector< GENERATED_TABLE_COLUMN_DEF > aDefs,
GENERATED_TABLE_UNITS aDefaultUnits,
int aDefaultPrecision )

Definition at line 31 of file generated_table_schema.cpp.

References m_defaultPrecision, m_defaultUnits, m_defs, and move.

Member Function Documentation

◆ DefaultColumn()

GENERATED_TABLE_COLUMN GENERATED_TABLE_SCHEMA::DefaultColumn ( int aId) const

◆ DefaultPrecision()

int GENERATED_TABLE_SCHEMA::DefaultPrecision ( ) const
inline

◆ Defaults()

std::vector< GENERATED_TABLE_COLUMN > GENERATED_TABLE_SCHEMA::Defaults ( ) const

◆ DefaultUnits()

GENERATED_TABLE_UNITS GENERATED_TABLE_SCHEMA::DefaultUnits ( ) const
inline

◆ Defs()

const std::vector< GENERATED_TABLE_COLUMN_DEF > & GENERATED_TABLE_SCHEMA::Defs ( ) const
inline

Definition at line 107 of file generated_table_schema.h.

References m_defs.

◆ Find()

const GENERATED_TABLE_COLUMN_DEF * GENERATED_TABLE_SCHEMA::Find ( int aId) const

◆ FindToken()

const GENERATED_TABLE_COLUMN_DEF * GENERATED_TABLE_SCHEMA::FindToken ( const wxString & aToken) const

◆ Token()

const char * GENERATED_TABLE_SCHEMA::Token ( int aId) const

The file token for a known id, or a stable placeholder for one the schema does not recognize, so a writer always has something parseable to put in "(id ...)".

Definition at line 64 of file generated_table_schema.cpp.

References Find(), m_defs, and GENERATED_TABLE_COLUMN_DEF::m_Token.

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

◆ Validate()

bool GENERATED_TABLE_SCHEMA::Validate ( std::vector< GENERATED_TABLE_COLUMN > & aColumns) const

Drop a column whose id the schema does not know and a column that repeats an id already kept, then clamp every surviving width.

False when nothing usable is left or the clamped total is implausibly wide, so a hostile or truncated file cannot hand a caller an empty table to divide by or push its geometry past int range.

Definition at line 102 of file generated_table_schema.cpp.

References Find(), GENERATED_TABLE_MAX_COLUMN_WIDTH, and GENERATED_TABLE_MAX_TOTAL_WIDTH.

Referenced by PCB_IO_KICAD_SEXPR_PARSER::parseGeneratedTable(), and UnpackGeneratedTable().

Member Data Documentation

◆ m_defaultPrecision

int GENERATED_TABLE_SCHEMA::m_defaultPrecision
private

Definition at line 135 of file generated_table_schema.h.

Referenced by DefaultPrecision(), and GENERATED_TABLE_SCHEMA().

◆ m_defaultUnits

GENERATED_TABLE_UNITS GENERATED_TABLE_SCHEMA::m_defaultUnits
private

Definition at line 134 of file generated_table_schema.h.

Referenced by DefaultUnits(), and GENERATED_TABLE_SCHEMA().

◆ m_defs

std::vector<GENERATED_TABLE_COLUMN_DEF> GENERATED_TABLE_SCHEMA::m_defs
private

Definition at line 133 of file generated_table_schema.h.

Referenced by Defaults(), Defs(), Find(), FindToken(), GENERATED_TABLE_SCHEMA(), and Token().


The documentation for this class was generated from the following files: