31#include <wx/tokenzr.h>
78 bool& aLayerArgSet )
const
82 if( !aLayerString.IsEmpty() )
84 wxStringTokenizer layerTokens( aLayerString,
"," );
86 while( layerTokens.HasMoreTokens() )
88 std::string token =
TO_UTF8( layerTokens.GetNextToken() );
91 if( m_layerMasks.count( token ) )
93 for(
PCB_LAYER_ID layer : m_layerMasks.at( token ).Seq() )
94 layerMask.push_back( layer );
99 else if( m_layerGuiMasks.count( token ) )
101 for(
PCB_LAYER_ID layer : m_layerGuiMasks.at( token ).Seq() )
102 layerMask.push_back( layer );
108 wxFprintf( stderr,
_(
"Invalid layer name \"%s\"\n" ), token );
120 .default_value( std::string() )
122 _(
"Comma separated list of untranslated layer names to include such as "
124 .metavar(
"LAYER_LIST" );
126 m_hasLayerArg =
true;
127 m_requireLayers = aRequire;
137 LSEQ layerMask = convertLayerStringList( layers, m_selectedLayersSet );
139 if( m_requireLayers && layerMask.size() < 1 )
141 wxFprintf( stderr,
_(
"At least one layer must be specified\n" ) );
145 m_selectedLayers = layerMask;
void addCommonArgs(bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir)
Set up the most common of args used across cli.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
wxString From_UTF8(const char *cstring)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
PCB_EXPORT_BASE_COMMAND(const std::string &aName, bool aInputIsDir=false, bool aOutputIsDir=false)
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
std::map< std::string, LSET > m_layerMasks
LSEQ convertLayerStringList(wxString &aLayerString, bool &aLayerArgSet) const
std::map< std::string, LSET > m_layerGuiMasks
void addLayerArg(bool aRequire)