KiCad PCB EDA Suite
drawing_sheet_parser.cpp File Reference
#include <charconv>
#include <wx/ffile.h>
#include <wx/log.h>
#include <eda_item.h>
#include <locale_io.h>
#include <string_utils.h>
#include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/drawing_sheet_lexer.h>
#include <drawing_sheet/ds_file_versions.h>
#include <font/font.h>

Go to the source code of this file.

Classes

class  DRAWING_SHEET_PARSER
 DRAWING_SHEET_PARSER holds data and functions pertinent to parsing a S-expression file for a DS_DATA_MODEL. More...
 

Functions

wxString convertLegacyVariableRefs (const wxString &aTextbase)
 

Variables

const char defaultDrawingSheet []
 
const char emptyDrawingSheet []
 

Function Documentation

◆ convertLegacyVariableRefs()

wxString convertLegacyVariableRefs ( const wxString &  aTextbase)

Definition at line 126 of file drawing_sheet_parser.cpp.

127{
128 wxString msg;
129
130 /*
131 * Legacy formats
132 * %% = replaced by %
133 * %K = Kicad version
134 * %Z = paper format name (A4, USLetter)
135 * %Y = company name
136 * %D = date
137 * %R = revision
138 * %S = sheet number
139 * %N = number of sheets
140 * %L = layer name
141 * %Cx = comment (x = 0 to 9 to identify the comment)
142 * %F = filename
143 * %P = sheet path (sheet full name)
144 * %T = title
145 */
146
147 for( unsigned ii = 0; ii < aTextbase.Len(); ii++ )
148 {
149 if( aTextbase[ii] != '%' )
150 {
151 msg << aTextbase[ii];
152 continue;
153 }
154
155 if( ++ii >= aTextbase.Len() )
156 break;
157
158 wxChar format = aTextbase[ii];
159
160 switch( format )
161 {
162 case '%': msg += '%'; break;
163 case 'D': msg += wxT( "${ISSUE_DATE}" ); break;
164 case 'R': msg += wxT( "${REVISION}" ); break;
165 case 'K': msg += wxT( "${KICAD_VERSION}" ); break;
166 case 'Z': msg += wxT( "${PAPER}" ); break;
167 case 'S': msg += wxT( "${#}" ); break;
168 case 'N': msg += wxT( "${##}" ); break;
169 case 'F': msg += wxT( "${FILENAME}" ); break;
170 case 'L': msg += wxT( "${LAYER}" ); break;
171 case 'P': msg += wxT( "${SHEETPATH}" ); break;
172 case 'Y': msg += wxT( "${COMPANY}" ); break;
173 case 'T': msg += wxT( "${TITLE}" ); break;
174 case 'C':
175 format = aTextbase[++ii];
176
177 switch( format )
178 {
179 case '0': msg += wxT( "${COMMENT1}" ); break;
180 case '1': msg += wxT( "${COMMENT2}" ); break;
181 case '2': msg += wxT( "${COMMENT3}" ); break;
182 case '3': msg += wxT( "${COMMENT4}" ); break;
183 case '4': msg += wxT( "${COMMENT5}" ); break;
184 case '5': msg += wxT( "${COMMENT6}" ); break;
185 case '6': msg += wxT( "${COMMENT7}" ); break;
186 case '7': msg += wxT( "${COMMENT8}" ); break;
187 case '8': msg += wxT( "${COMMENT9}" ); break;
188 }
189 break;
190
191 default:
192 break;
193 }
194 }
195
196 return msg;
197}

Referenced by DRAWING_SHEET_PARSER::Parse().

Variable Documentation

◆ defaultDrawingSheet

const char defaultDrawingSheet[]
extern

◆ emptyDrawingSheet

const char emptyDrawingSheet[]
extern