KiCad PCB EDA Suite
EATTR Struct Reference

Class 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

Class 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 603 of file eagle_parser.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Off 
VALUE 
NAME 
BOTH 

Definition at line 614 of file eagle_parser.h.

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

Constructor & Destructor Documentation

◆ EATTR() [1/2]

EATTR::EATTR ( wxXmlNode *  aTree)

Definition at line 491 of file eagle_parser.cpp.

492 {
493  /*
494  <!ELEMENT attribute EMPTY>
495  <!ATTLIST attribute
496  name %String; #REQUIRED
497  value %String; #IMPLIED
498  x %Coord; #IMPLIED
499  y %Coord; #IMPLIED
500  size %Dimension; #IMPLIED
501  layer %Layer; #IMPLIED
502  font %TextFont; #IMPLIED
503  ratio %Int; #IMPLIED
504  rot %Rotation; "R0"
505  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
506  constant %Bool; "no" -- only in <device> context --
507  >
508  */
509 
510  name = parseRequiredAttribute<wxString>( aTree, "name" );
511  value = parseOptionalAttribute<wxString>( aTree, "value" );
512 
513  x = parseOptionalAttribute<ECOORD>( aTree, "x" );
514  y = parseOptionalAttribute<ECOORD>( aTree, "y" );
515  size = parseOptionalAttribute<ECOORD>( aTree, "size" );
516 
517  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
518  // Eagle can it seems.
519  layer = parseOptionalAttribute<int>( aTree, "layer" );
520  ratio = parseOptionalAttribute<double>( aTree, "ratio" );
521  rot = parseOptionalAttribute<EROT>( aTree, "rot" );
522 
523  opt_wxString stemp = parseOptionalAttribute<wxString>( aTree, "display" );
524 
525  // (off | value | name | both)
526  if( stemp == "off" )
528  else if( stemp == "name" )
530  else if( stemp == "both" )
532  else // "value" is the default
534 
535  stemp = parseOptionalAttribute<wxString>( aTree, "align" );
536 
537  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
538 }
opt_erot rot
Definition: eagle_parser.h:612
opt_int align
Definition: eagle_parser.h:621
wxString name
Definition: eagle_parser.h:605
opt_ecoord y
Definition: eagle_parser.h:608
opt_wxString value
Definition: eagle_parser.h:606
static int parseAlignment(const wxString &aAlignment)
opt_ecoord x
Definition: eagle_parser.h:607
opt_int layer
Definition: eagle_parser.h:610
constexpr auto DEFAULT_ALIGNMENT
opt_double ratio
Definition: eagle_parser.h:611
opt_int display
Definition: eagle_parser.h:620
opt_ecoord size
Definition: eagle_parser.h:609

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 624 of file eagle_parser.h.

624 {}

Member Data Documentation

◆ align

opt_int EATTR::align

Definition at line 621 of file eagle_parser.h.

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

◆ display

opt_int EATTR::display

Definition at line 620 of file eagle_parser.h.

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

◆ layer

opt_int EATTR::layer

Definition at line 610 of file eagle_parser.h.

Referenced by EATTR().

◆ name

wxString EATTR::name

Definition at line 605 of file eagle_parser.h.

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

◆ ratio

opt_double EATTR::ratio

Definition at line 611 of file eagle_parser.h.

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

◆ rot

opt_erot EATTR::rot

Definition at line 612 of file eagle_parser.h.

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

◆ size

opt_ecoord EATTR::size

Definition at line 609 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 607 of file eagle_parser.h.

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

◆ y

opt_ecoord EATTR::y

Definition at line 608 of file eagle_parser.h.

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


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