KiCad PCB EDA Suite
drawing_sheet_parser.cpp File Reference
#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 125 of file drawing_sheet_parser.cpp.

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

Referenced by DRAWING_SHEET_PARSER::Parse().

Variable Documentation

◆ defaultDrawingSheet

const char defaultDrawingSheet[]
extern

◆ emptyDrawingSheet

const char emptyDrawingSheet[]
extern