KiCad PCB EDA Suite
EATTR Struct Reference

EATTR parses an Eagle "attribute" XML element. More...

#include <eagle_parser.h>

Public Types

enum  { Off, VALUE, NAME, BOTH }
 

Public Member Functions

 EATTR (wxXmlNode *aTree)
 
 EATTR ()
 

Public Attributes

wxString name
 
opt_wxString value
 
opt_ecoord x
 
opt_ecoord y
 
opt_ecoord size
 
opt_int layer
 
opt_double ratio
 
opt_erot rot
 
opt_int display
 
opt_int align
 

Detailed Description

EATTR parses an Eagle "attribute" XML element.

Note that an attribute element is different than an XML element attribute. The attribute element is a full XML node in and of itself, and has attributes of its own. Blame Eagle.

Definition at line 602 of file eagle_parser.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Off 
VALUE 
NAME 
BOTH 

Definition at line 613 of file eagle_parser.h.

613  { // for 'display'
614  Off,
615  VALUE,
616  NAME,
617  BOTH,
618  };

Constructor & Destructor Documentation

◆ EATTR() [1/2]

EATTR::EATTR ( wxXmlNode *  aTree)

Definition at line 474 of file eagle_parser.cpp.

475 {
476  /*
477  <!ELEMENT attribute EMPTY>
478  <!ATTLIST attribute
479  name %String; #REQUIRED
480  value %String; #IMPLIED
481  x %Coord; #IMPLIED
482  y %Coord; #IMPLIED
483  size %Dimension; #IMPLIED
484  layer %Layer; #IMPLIED
485  font %TextFont; #IMPLIED
486  ratio %Int; #IMPLIED
487  rot %Rotation; "R0"
488  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
489  constant %Bool; "no" -- only in <device> context --
490  >
491  */
492 
493  name = parseRequiredAttribute<wxString>( aTree, "name" );
494  value = parseOptionalAttribute<wxString>( aTree, "value" );
495 
496  x = parseOptionalAttribute<ECOORD>( aTree, "x" );
497  y = parseOptionalAttribute<ECOORD>( aTree, "y" );
498  size = parseOptionalAttribute<ECOORD>( aTree, "size" );
499 
500  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
501  // Eagle can it seems.
502  layer = parseOptionalAttribute<int>( aTree, "layer" );
503  ratio = parseOptionalAttribute<double>( aTree, "ratio" );
504  rot = parseOptionalAttribute<EROT>( aTree, "rot" );
505 
506  opt_wxString stemp = parseOptionalAttribute<wxString>( aTree, "display" );
507 
508  // (off | value | name | both)
509  if( stemp == "off" )
511  else if( stemp == "name" )
513  else if( stemp == "both" )
515  else // "value" is the default
517 
518  stemp = parseOptionalAttribute<wxString>( aTree, "align" );
519 
520  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
521 }
opt_erot rot
Definition: eagle_parser.h:611
opt_int align
Definition: eagle_parser.h:620
wxString name
Definition: eagle_parser.h:604
opt_ecoord y
Definition: eagle_parser.h:607
opt_wxString value
Definition: eagle_parser.h:605
static int parseAlignment(const wxString &aAlignment)
opt_ecoord x
Definition: eagle_parser.h:606
opt_int layer
Definition: eagle_parser.h:609
constexpr auto DEFAULT_ALIGNMENT
opt_double ratio
Definition: eagle_parser.h:610
opt_int display
Definition: eagle_parser.h:619
opt_ecoord size
Definition: eagle_parser.h:608

References align, BOTH, DEFAULT_ALIGNMENT, display, layer, name, NAME, Off, parseAlignment(), ratio, rot, size, value, VALUE, x, and y.

◆ EATTR() [2/2]

EATTR::EATTR ( )
inline

Definition at line 623 of file eagle_parser.h.

623 {}

Member Data Documentation

◆ align

opt_int EATTR::align

Definition at line 620 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().

◆ display

opt_int EATTR::display

Definition at line 619 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::loadElements().

◆ layer

opt_int EATTR::layer

Definition at line 609 of file eagle_parser.h.

Referenced by EATTR().

◆ name

wxString EATTR::name

Definition at line 604 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::loadElements().

◆ ratio

opt_double EATTR::ratio

Definition at line 610 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().

◆ rot

opt_erot EATTR::rot

Definition at line 611 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().

◆ size

opt_ecoord EATTR::size

Definition at line 608 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().

◆ value

opt_wxString EATTR::value

◆ x

opt_ecoord EATTR::x

Definition at line 606 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().

◆ y

opt_ecoord EATTR::y

Definition at line 607 of file eagle_parser.h.

Referenced by EATTR(), and EAGLE_PLUGIN::orientModuleText().


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