KiCad PCB EDA Suite
Loading...
Searching...
No Matches
macros.h File Reference

This file contains miscellaneous commonly used macros and functions. More...

#include <wx/string.h>

Go to the source code of this file.

Macros

#define KI_HAS_ATTRIBUTE(x)   0
 
#define KI_HAS_CPP_ATTRIBUTE(x)   0
 
#define KI_FALLTHROUGH   ( ( void ) 0 )
 The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from one to the next. More...
 
#define TO_UTF8(wxstring)   ( (const char*) (wxstring).utf8_str() )
 Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes. More...
 
#define TO_STR2(x)   #x
 Stringifies the given parameter by placing in quotes. More...
 
#define TO_STR(x)   TO_STR2(x)
 
#define UNIMPLEMENTED_FOR(type)    wxFAIL_MSG( wxString::Format( wxT( "%s: unimplemented for %s" ), __FUNCTION__, type ) )
 

Functions

static wxString FROM_UTF8 (const char *cstring)
 Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes. More...
 

Detailed Description

This file contains miscellaneous commonly used macros and functions.

Definition in file macros.h.

Macro Definition Documentation

◆ KI_FALLTHROUGH

#define KI_FALLTHROUGH   ( ( void ) 0 )

The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from one to the next.

It must be followed by a ";".

Sample code: switch( a ) { case 1: // Some code KI_FALLTHROUGH;

case 2: // More code break; }

Definition at line 83 of file macros.h.

◆ KI_HAS_ATTRIBUTE

#define KI_HAS_ATTRIBUTE (   x)    0

Definition at line 39 of file macros.h.

◆ KI_HAS_CPP_ATTRIBUTE

#define KI_HAS_CPP_ATTRIBUTE (   x)    0

Definition at line 46 of file macros.h.

◆ TO_STR

#define TO_STR (   x)    TO_STR2(x)

Definition at line 105 of file macros.h.

◆ TO_STR2

#define TO_STR2 (   x)    #x

Stringifies the given parameter by placing in quotes.

Parameters
cstringSTRING (no spaces)
Returns
"STRING"

Definition at line 104 of file macros.h.

◆ TO_UTF8

#define TO_UTF8 (   wxstring)    ( (const char*) (wxstring).utf8_str() )

Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.

wxstring is a wxString, not a wxT() or _(). The scope of the return value is very limited and volatile, but can be used with printf() style functions well.

Note
Trying to convert it to a function is tricky because of the type of the parameter!

Definition at line 96 of file macros.h.

◆ UNIMPLEMENTED_FOR

#define UNIMPLEMENTED_FOR (   type)     wxFAIL_MSG( wxString::Format( wxT( "%s: unimplemented for %s" ), __FUNCTION__, type ) )

Definition at line 120 of file macros.h.

Function Documentation

◆ FROM_UTF8()

static wxString FROM_UTF8 ( const char *  cstring)
inlinestatic

Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.

Definition at line 110 of file macros.h.

Referenced by DXF_IMPORT_PLUGIN::addLinetype(), SCH_REFERENCE::Annotate(), SCH_EDITOR_CONTROL::AssignFootprints(), MARKUP::NODE::asWxString(), CVPCB_MAINFRAME::buildEquivalenceList(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), detect_file_type(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), CLI::EXPORT_PCB_BASE_COMMAND::doPerform(), CLI::EXPORT_PCB_DRILL_COMMAND::doPerform(), CLI::EXPORT_PCB_DXF_COMMAND::doPerform(), CLI::EXPORT_PCB_GERBERS_COMMAND::doPerform(), CLI::EXPORT_PCB_PDF_COMMAND::doPerform(), CLI::EXPORT_PCB_POS_COMMAND::doPerform(), CLI::EXPORT_PCB_STEP_COMMAND::doPerform(), CLI::EXPORT_PCB_SVG_COMMAND::doPerform(), CLI::EXPORT_SCH_BOM_COMMAND::doPerform(), CLI::EXPORT_SCH_NETLIST_COMMAND::doPerform(), CLI::EXPORT_SCH_PLOT_COMMAND::doPerform(), CLI::EXPORT_SCH_PYTHONBOM_COMMAND::doPerform(), CLI::FP_EXPORT_SVG_COMMAND::doPerform(), CLI::FP_UPGRADE_COMMAND::doPerform(), CLI::SYM_EXPORT_SVG_COMMAND::doPerform(), CLI::SYM_UPGRADE_COMMAND::doPerform(), CLI::VERSION_COMMAND::doPerform(), EXCELLON_IMAGE::Execute_EXCELLON_G_Command(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::Export_IDF3(), EXPORTER_PCB_VRML::ExportVRML_File(), GPCB_PLUGIN::FootprintEnumerate(), LEGACY_PLUGIN::FootprintEnumerate(), GERBER_JOBFILE_READER::formatStringFromJSON(), DSN::SPECCTRA_DB::FromSESSION(), GENDRILL_WRITER_BASE::genDrillMapFile(), fontconfig::FONTCONFIG::getFamilyStringByLang(), SEXPR::PARSER::GetFileContents(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), GetIllegalFileNameWxChars(), BACK_ANNOTATE::getPcbModulesFromString(), NETLIST_READER::GuessNetlistFileType(), PGM_BASE::HandleException(), EDA_3D_CANVAS::initializeOpenGL(), fontconfig::FONTCONFIG::ListFonts(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadComponent(), LEGACY_PLUGIN::loadDIMENSION(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), LEGACY_PLUGIN::loadFOOTPRINT(), LEGACY_NETLIST_READER::loadFootprintFilters(), LEGACY_NETLIST_READER::loadNet(), LEGACY_PLUGIN::loadNETCLASS(), LEGACY_PLUGIN::loadNETINFO_ITEM(), LEGACY_PLUGIN::loadPAD(), LEGACY_PLUGIN::loadPCB_TEXT(), LEGACY_PLUGIN::loadSETUP(), LEGACY_PLUGIN::loadSHEET(), SCH_LEGACY_PLUGIN::loadText(), main(), DSN::SPECCTRA_DB::makeTRACK(), DSN::SPECCTRA_DB::makeVIA(), EDA_3D_MODEL_VIEWER::ogl_initialize(), APP_TEST::OnInit(), APP_TEST::OnRun(), PCB_PLOT_PARAMS_PARSER::Parse(), TEMPLATE_FIELDNAME::Parse(), X2_ATTRIBUTE::ParseAttribCmd(), KICAD_NETLIST_PARSER::parseComponent(), PCB_PARSER::parseLayer(), KICAD_NETLIST_PARSER::parseLibPartList(), KICAD_NETLIST_PARSER::parseNet(), parseQuotedString(), PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr(), PCB_PARSER::parseRenderCache(), parseUnquotedString(), pcbnewRunPythonMethodWithReturnedString(), CLI::EXPORT_PCB_GERBER_COMMAND::populateJob(), CLI::COMMAND::PrintHelp(), printHelp(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), Py2wxString(), GERBER_FILE_IMAGE::ReadApertureMacro(), ReadDelimitedText(), CVPCB_MAINFRAME::readNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), CVPCB_MAINFRAME::refreshAfterSymbolSearch(), REPORTER::Report(), PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataToWindow(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), and DS_DATA_MODEL_STRINGIO::~DS_DATA_MODEL_STRINGIO().