KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TEMPLATES Class Reference

#include <template_fieldnames.h>

Public Types

enum class  SCOPE { PROJECT , GLOBAL }
 

Public Member Functions

 TEMPLATES ()
 
void Format (OUTPUTFORMATTER *out, SCOPE aScope) const
 Serialize this object out as text into the given OUTPUTFORMATTER.
 
void AddTemplateFieldName (const TEMPLATE_FIELDNAME &aFieldName, SCOPE aScope)
 Insert or append a wanted symbol field name into the field names template.
 
void AddTemplateFieldNames (const wxString &aSerializedFieldNames, SCOPE aScope)
 Add a serialized list of template field names.
 
void DeleteFieldNameTemplates (SCOPE aScope)
 Delete the contents of a scope.
 
const std::vector< TEMPLATE_FIELDNAME > & GetResolvedTemplateFieldNames ()
 Return the resolved project and global template field name list for read only access.
 
const std::vector< TEMPLATE_FIELDNAME > & GetTemplateFieldNames (SCOPE aScope)
 Return a specific list (global or project) for read only access.
 
const TEMPLATE_FIELDNAMEGetFieldName (const wxString &aName)
 Search for aName in the template field name list.
 

Protected Member Functions

void resolveTemplates ()
 Flatten project and global templates into a single list.
 
void parse (TEMPLATE_FIELDNAMES_LEXER *in, SCOPE aScope)
 

Private Attributes

std::vector< TEMPLATE_FIELDNAMEm_globals
 
std::vector< TEMPLATE_FIELDNAMEm_project
 
std::vector< TEMPLATE_FIELDNAMEm_resolved
 
bool m_resolvedDirty
 

Detailed Description

Definition at line 162 of file template_fieldnames.h.

Member Enumeration Documentation

◆ SCOPE

enum class TEMPLATES::SCOPE
strong
Enumerator
PROJECT 
GLOBAL 

Definition at line 165 of file template_fieldnames.h.

Constructor & Destructor Documentation

◆ TEMPLATES()

TEMPLATES::TEMPLATES ( )
inline

Definition at line 171 of file template_fieldnames.h.

References m_resolvedDirty.

Member Function Documentation

◆ AddTemplateFieldName()

void TEMPLATES::AddTemplateFieldName ( const TEMPLATE_FIELDNAME & aFieldName,
SCOPE aScope )

Insert or append a wanted symbol field name into the field names template.

Should be used for any symbol property editor. If the name already exists, it overwrites the same name.

Parameters
aFieldNameis a full description of the wanted field, and it must not match any of the default field names.
aScopeindicates whether to add to the global or project table.

Definition at line 273 of file template_fieldnames.cpp.

References GetDefaultFieldName(), m_globals, TEMPLATE_FIELDNAME::m_Name, m_project, m_resolvedDirty, MANDATORY_FIELDS, and UNTRANSLATED.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), parse(), and SETTINGS_MANAGER::SyncGlobalFieldNameTemplatesToProjects().

◆ AddTemplateFieldNames()

void TEMPLATES::AddTemplateFieldNames ( const wxString & aSerializedFieldNames,
SCOPE aScope )

Add a serialized list of template field names.

Definition at line 304 of file template_fieldnames.cpp.

References parse(), and TO_UTF8.

Referenced by EESCHEMA_SETTINGS::migrateFieldNameTemplates().

◆ DeleteFieldNameTemplates()

void TEMPLATES::DeleteFieldNameTemplates ( SCOPE aScope)

Delete the contents of a scope.

Definition at line 318 of file template_fieldnames.cpp.

References m_globals, m_project, m_resolved, and m_resolvedDirty.

Referenced by SETTINGS_MANAGER::SyncGlobalFieldNameTemplatesToProjects().

◆ Format()

void TEMPLATES::Format ( OUTPUTFORMATTER * out,
SCOPE aScope ) const

Serialize this object out as text into the given OUTPUTFORMATTER.

Definition at line 183 of file template_fieldnames.cpp.

References m_globals, m_project, and OUTPUTFORMATTER::Print().

◆ GetFieldName()

const TEMPLATE_FIELDNAME * TEMPLATES::GetFieldName ( const wxString & aName)

Search for aName in the template field name list.

Parameters
aNameA wxString object containing the field name to search for.
Returns
the template field name if found; NULL otherwise.

Definition at line 353 of file template_fieldnames.cpp.

References m_resolved, m_resolvedDirty, and resolveTemplates().

Referenced by SYMBOL_FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), and FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::applyDataToFootprint().

◆ GetResolvedTemplateFieldNames()

const std::vector< TEMPLATE_FIELDNAME > & TEMPLATES::GetResolvedTemplateFieldNames ( )

Return the resolved project and global template field name list for read only access.

Definition at line 335 of file template_fieldnames.cpp.

References m_resolved, m_resolvedDirty, and resolveTemplates().

Referenced by BOOST_AUTO_TEST_CASE(), hasTemplate(), EESCHEMA_JOBS_HANDLER::JobExportBom(), and DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow().

◆ GetTemplateFieldNames()

const std::vector< TEMPLATE_FIELDNAME > & TEMPLATES::GetTemplateFieldNames ( SCOPE aScope)

Return a specific list (global or project) for read only access.

Definition at line 344 of file template_fieldnames.cpp.

References m_globals, and m_project.

Referenced by PANEL_TEMPLATE_FIELDNAMES::ImportSettingsFrom(), and EESCHEMA_SETTINGS::migrateFieldNameTemplates().

◆ parse()

void TEMPLATES::parse ( TEMPLATE_FIELDNAMES_LEXER * in,
SCOPE aScope )
protected

◆ resolveTemplates()

void TEMPLATES::resolveTemplates ( )
protected

Flatten project and global templates into a single list.

(Project templates take precedence.)

Definition at line 245 of file template_fieldnames.cpp.

References m_globals, m_project, m_resolved, m_resolvedDirty, and project.

Referenced by GetFieldName(), and GetResolvedTemplateFieldNames().

Member Data Documentation

◆ m_globals

std::vector<TEMPLATE_FIELDNAME> TEMPLATES::m_globals
private

◆ m_project

std::vector<TEMPLATE_FIELDNAME> TEMPLATES::m_project
private

◆ m_resolved

std::vector<TEMPLATE_FIELDNAME> TEMPLATES::m_resolved
private

◆ m_resolvedDirty

bool TEMPLATES::m_resolvedDirty
private

The documentation for this class was generated from the following files: