KiCad PCB EDA Suite
Loading...
Searching...
No Matches
TEXT_VAR_REF_KEY Struct Reference

Identifies a single resolvable source that a text item's ${...} reference depends on. More...

#include <text_var_dependency.h>

Public Types

enum class  KIND : std::uint8_t {
  LOCAL , CROSS_REF , PROJECT_VAR , ENV_VAR ,
  TITLE_BLOCK , SPECIAL , OP
}
 Categorizes a reference by the source that will produce its value. More...
 

Public Member Functions

bool operator== (const TEXT_VAR_REF_KEY &) const =default
 
bool IsTrackable () const
 

Static Public Member Functions

static TEXT_VAR_REF_KEY FromToken (const wxString &aToken)
 Parse a raw token (the text between ${ and }) into a key using lexical classification only — no lookup against project state or item context.
 

Public Attributes

KIND kind = KIND::LOCAL
 
wxString primary
 
wxString secondary
 

Detailed Description

Identifies a single resolvable source that a text item's ${...} reference depends on.

Keys are the currency of the dependency index. An edit that invalidates a key fans out to every EDA_ITEM registered under that key. The encoding mirrors the shape of the source token so that lexical extraction maps 1:1 to key creation with no resolver context needed.

Definition at line 47 of file text_var_dependency.h.

Member Enumeration Documentation

◆ KIND

enum class TEXT_VAR_REF_KEY::KIND : std::uint8_t
strong

Categorizes a reference by the source that will produce its value.

The listener adapter for each module routes invalidation based on KIND, so expanding this taxonomy was a prerequisite for accurate fan-out (see Phase 3b plan).

  • LOCAL: ${VALUE}, ${REFERENCE} etc. — resolved against the item's own context (a footprint's fields, a symbol's fields). Changes fan out only to self.
  • CROSS_REF: ${REFDES:FIELD} — primary=refdes, secondary=field. Keyed by refdes string so renames fire on both old/new.
  • PROJECT_VAR: user-defined text var in project settings. Invalidated when PROJECT::IncrementTextVarsTicker fires.
  • ENV_VAR: ${KICAD_FOOTPRINT_DIR} etc. — OS/KiCad env vars.
  • TITLE_BLOCK: ${PROJECTNAME}, ${REVISION}, ${ISSUE_DATE}, etc. Owned by PROJECT/title block, not any item.
  • SPECIAL: ${SHEETNAME}, ${SHEETPATH}, ${FILENAME}, ${CURRENT_DATE}, ${VCSHASH}. Context-dependent resolution; mostly non-user-editable.
  • OP: ${OP}, ${OP:port} — SPICE operating points. Recomputed from simulation state, not edits; tracker deliberately does not register OP-kind keys as dependencies (no listener drives them).
Enumerator
LOCAL 
CROSS_REF 
PROJECT_VAR 
ENV_VAR 
TITLE_BLOCK 
SPECIAL 
OP 

Definition at line 73 of file text_var_dependency.h.

Member Function Documentation

◆ FromToken()

TEXT_VAR_REF_KEY TEXT_VAR_REF_KEY::FromToken ( const wxString & aToken)
static

Parse a raw token (the text between ${ and }) into a key using lexical classification only — no lookup against project state or item context.

Tokens with an embedded : become CROSS_REF or OP; tokens whose name matches a known built-in (PROJECTNAME, SHEETNAME, etc.) are categorized into TITLE_BLOCK / SPECIAL; everything else defaults to LOCAL and the adapter promotes to PROJECT_VAR or ENV_VAR based on the project state at registration time.

Definition at line 60 of file text_var_dependency.cpp.

References CROSS_REF, kind, left, LOCAL, OP, primary, right, secondary, SPECIAL, and TITLE_BLOCK.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and operator==().

◆ IsTrackable()

bool TEXT_VAR_REF_KEY::IsTrackable ( ) const
inline

Definition at line 101 of file text_var_dependency.h.

References kind, and OP.

Referenced by BOOST_AUTO_TEST_CASE().

◆ operator==()

bool TEXT_VAR_REF_KEY::operator== ( const TEXT_VAR_REF_KEY & ) const
default

References FromToken().

Member Data Documentation

◆ kind

◆ primary

◆ secondary


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