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

string name
 
opt_string 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 593 of file eagle_parser.h.

Member Enumeration Documentation

anonymous enum
Enumerator
Off 
VALUE 
NAME 
BOTH 

Definition at line 604 of file eagle_parser.h.

604  { // for 'display'
605  Off,
606  VALUE,
607  NAME,
608  BOTH,
609  };

Constructor & Destructor Documentation

EATTR::EATTR ( wxXmlNode *  aTree)

Definition at line 454 of file eagle_parser.cpp.

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

455 {
456  /*
457  <!ELEMENT attribute EMPTY>
458  <!ATTLIST attribute
459  name %String; #REQUIRED
460  value %String; #IMPLIED
461  x %Coord; #IMPLIED
462  y %Coord; #IMPLIED
463  size %Dimension; #IMPLIED
464  layer %Layer; #IMPLIED
465  font %TextFont; #IMPLIED
466  ratio %Int; #IMPLIED
467  rot %Rotation; "R0"
468  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
469  constant %Bool; "no" -- only in <device> context --
470  >
471  */
472 
473  name = parseRequiredAttribute<string>( aTree, "name" );
474  value = parseOptionalAttribute<string>( aTree, "value" );
475 
476  x = parseOptionalAttribute<ECOORD>( aTree, "x" );
477  y = parseOptionalAttribute<ECOORD>( aTree, "y" );
478  size = parseOptionalAttribute<ECOORD>( aTree, "size" );
479 
480  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
481  // Eagle can it seems.
482  layer = parseOptionalAttribute<int>( aTree, "layer" );
483  ratio = parseOptionalAttribute<double>( aTree, "ratio" );
484  rot = parseOptionalAttribute<EROT>( aTree, "rot" );
485 
486  opt_string stemp = parseOptionalAttribute<string>( aTree, "display" );
487 
488  // (off | value | name | both)
489  if( stemp == "off" )
491  else if( stemp == "value" )
493  else if( stemp == "name" )
495  else if( stemp == "both" )
497 
498  stemp = parseOptionalAttribute<string>( aTree, "align" );
499 
500  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
501 }
opt_erot rot
Definition: eagle_parser.h:602
opt_int align
Definition: eagle_parser.h:611
opt_ecoord y
Definition: eagle_parser.h:598
string name
Definition: eagle_parser.h:595
opt_string value
Definition: eagle_parser.h:596
static int parseAlignment(const wxString &aAlignment)
opt_ecoord x
Definition: eagle_parser.h:597
opt_int layer
Definition: eagle_parser.h:600
constexpr auto DEFAULT_ALIGNMENT
opt_double ratio
Definition: eagle_parser.h:601
opt_int display
Definition: eagle_parser.h:610
opt_ecoord size
Definition: eagle_parser.h:599
EATTR::EATTR ( )
inline

Definition at line 614 of file eagle_parser.h.

614 {}

Member Data Documentation

opt_int EATTR::align

Definition at line 611 of file eagle_parser.h.

Referenced by EATTR().

opt_int EATTR::display

Definition at line 610 of file eagle_parser.h.

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

opt_int EATTR::layer

Definition at line 600 of file eagle_parser.h.

Referenced by EATTR().

string EATTR::name

Definition at line 595 of file eagle_parser.h.

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

opt_double EATTR::ratio

Definition at line 601 of file eagle_parser.h.

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

opt_erot EATTR::rot

Definition at line 602 of file eagle_parser.h.

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

opt_ecoord EATTR::size

Definition at line 599 of file eagle_parser.h.

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

opt_string EATTR::value
opt_ecoord EATTR::x

Definition at line 597 of file eagle_parser.h.

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

opt_ecoord EATTR::y

Definition at line 598 of file eagle_parser.h.

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


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