29#include <template_fieldnames_lexer.h>
33using namespace TFIELD_T;
36#define REFERENCE_CANONICAL "Reference"
37#define VALUE_CANONICAL "Value"
38#define FOOTPRINT_CANONICAL "Footprint"
39#define DATASHEET_CANONICAL "Datasheet"
40#define DESCRIPTION_CANONICAL "Description"
50 if( !aTranslateForHI )
62 wxString str( wxS(
"Field" ) );
63#if wxUSE_UNICODE_WCHAR
64 str << std::to_wstring( aFieldNdx );
66 str << std::to_string( aFieldNdx );
78 default:
return wxString::Format(
_(
"Field%d" ), aFieldNdx );
88 out->
Print( 0,
" visible" );
91 out->
Print( 0,
" url" );
93 out->
Print( 0,
")\n" );
103 if( ( tok = in->NextTok() ) != T_name )
104 in->Expecting( T_name );
106 in->NeedSYMBOLorNUMBER();
112 while( (tok = in->NextTok() ) != T_RIGHT && tok != T_EOF )
122 in->NeedSYMBOLorNUMBER();
135 in->Expecting(
"value|url|visible" );
146 out->
Print( nestLevel,
"(templatefields" );
152 if( !temp.m_Name.IsEmpty() )
153 temp.Format( out, nestLevel+1 );
156 out->
Print( 0,
")\n" );
164 while( ( tok = in->NextTok() ) != T_RIGHT && tok != T_EOF )
171 case T_templatefields:
187 if( !field.
m_Name.IsEmpty() )
193 in->Unexpected( in->CurText() );
213 bool overriddenInProject =
false;
217 if( global.m_Name ==
project.m_Name )
219 overriddenInProject =
true;
224 if( !overriddenInProject )
246 if( temp.m_Name == aFieldName.
m_Name )
256 target.push_back( aFieldName );
263 TEMPLATE_FIELDNAMES_LEXER field_lexer(
TO_UTF8( aSerializedFieldNames ) );
267 parse( &field_lexer,
true );
317 if( field.m_Name == aName )
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
TEMPLATE_FIELDNAMES m_globals
void AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName, bool aGlobal)
Insert or append a wanted symbol field name into the field names template.
void AddTemplateFieldNames(const wxString &aSerializedFieldNames)
Add a serialized list of template field names.
TEMPLATE_FIELDNAMES m_project
TEMPLATE_FIELDNAMES m_resolved
const TEMPLATE_FIELDNAME * GetFieldName(const wxString &aName)
Search for aName in the template field name list.
void DeleteAllFieldNameTemplates(bool aGlobal)
Delete the entire contents.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Return a template field name list for read only access.
void parse(TEMPLATE_FIELDNAMES_LEXER *in, bool aGlobal)
void Format(OUTPUTFORMATTER *out, int nestLevel, bool aGlobal) const
Serialize this object out as text into the given OUTPUTFORMATTER.
wxString From_UTF8(const char *cstring)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Hold a name of a symbol's field, field value, and default visibility.
void Format(OUTPUTFORMATTER *out, int nestLevel) const
Serialize this object out as text into the given OUTPUTFORMATTER.
void Parse(TEMPLATE_FIELDNAMES_LEXER *aSpec)
Fill this object from information in the input stream aSpec, which is a #TEMPLATE_FIELDNAMES_LEXER.
static const wxString GetDefaultFieldName(int aFieldNdx, bool aTranslateForHI=false)
Return a default symbol field name for field aFieldNdx for all components.
#define FOOTPRINT_CANONICAL
static wxString s_CanonicalReference(REFERENCE_CANONICAL)
static wxString s_CanonicalValue(VALUE_CANONICAL)
static wxString s_CanonicalFootprint(FOOTPRINT_CANONICAL)
static wxString s_CanonicalDatasheet(DATASHEET_CANONICAL)
#define DATASHEET_CANONICAL
#define DESCRIPTION_CANONICAL
static wxString s_CanonicalDescription(DESCRIPTION_CANONICAL)
#define REFERENCE_CANONICAL
wxString GetCanonicalFieldName(int idx)
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ DESCRIPTION_FIELD
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES