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

Member Enumeration Documentation

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::EATTR ( wxXmlNode *  aTree)

Definition at line 484 of file eagle_parser.cpp.

References BOTH, DEFAULT_ALIGNMENT, name, NAME, Off, parseAlignment(), and VALUE.

485 {
486  /*
487  <!ELEMENT attribute EMPTY>
488  <!ATTLIST attribute
489  name %String; #REQUIRED
490  value %String; #IMPLIED
491  x %Coord; #IMPLIED
492  y %Coord; #IMPLIED
493  size %Dimension; #IMPLIED
494  layer %Layer; #IMPLIED
495  font %TextFont; #IMPLIED
496  ratio %Int; #IMPLIED
497  rot %Rotation; "R0"
498  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
499  constant %Bool; "no" -- only in <device> context --
500  >
501  */
502 
503  name = parseRequiredAttribute<wxString>( aTree, "name" );
504  value = parseOptionalAttribute<wxString>( aTree, "value" );
505 
506  x = parseOptionalAttribute<ECOORD>( aTree, "x" );
507  y = parseOptionalAttribute<ECOORD>( aTree, "y" );
508  size = parseOptionalAttribute<ECOORD>( aTree, "size" );
509 
510  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
511  // Eagle can it seems.
512  layer = parseOptionalAttribute<int>( aTree, "layer" );
513  ratio = parseOptionalAttribute<double>( aTree, "ratio" );
514  rot = parseOptionalAttribute<EROT>( aTree, "rot" );
515 
516  opt_wxString stemp = parseOptionalAttribute<wxString>( aTree, "display" );
517 
518  // (off | value | name | both)
519  if( stemp == "off" )
521  else if( stemp == "value" )
523  else if( stemp == "name" )
525  else if( stemp == "both" )
527 
528  stemp = parseOptionalAttribute<wxString>( aTree, "align" );
529 
530  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
531 }
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
EATTR::EATTR ( )
inline

Definition at line 623 of file eagle_parser.h.

623 {}

Member Data Documentation

opt_int EATTR::align

Definition at line 620 of file eagle_parser.h.

opt_int EATTR::display

Definition at line 619 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::loadElements().

opt_int EATTR::layer

Definition at line 609 of file eagle_parser.h.

wxString EATTR::name

Definition at line 604 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::loadElements().

opt_double EATTR::ratio

Definition at line 610 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_erot EATTR::rot

Definition at line 611 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_ecoord EATTR::size

Definition at line 608 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_wxString EATTR::value

Definition at line 605 of file eagle_parser.h.

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

opt_ecoord EATTR::x

Definition at line 606 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_ecoord EATTR::y

Definition at line 607 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::orientModuleText().


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