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 455 of file eagle_parser.cpp.

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

456 {
457  /*
458  <!ELEMENT attribute EMPTY>
459  <!ATTLIST attribute
460  name %String; #REQUIRED
461  value %String; #IMPLIED
462  x %Coord; #IMPLIED
463  y %Coord; #IMPLIED
464  size %Dimension; #IMPLIED
465  layer %Layer; #IMPLIED
466  font %TextFont; #IMPLIED
467  ratio %Int; #IMPLIED
468  rot %Rotation; "R0"
469  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
470  constant %Bool; "no" -- only in <device> context --
471  >
472  */
473 
474  name = parseRequiredAttribute<string>( aTree, "name" );
475  value = parseOptionalAttribute<string>( aTree, "value" );
476 
477  x = parseOptionalAttribute<ECOORD>( aTree, "x" );
478  y = parseOptionalAttribute<ECOORD>( aTree, "y" );
479  size = parseOptionalAttribute<ECOORD>( aTree, "size" );
480 
481  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
482  // Eagle can it seems.
483  layer = parseOptionalAttribute<int>( aTree, "layer" );
484  ratio = parseOptionalAttribute<double>( aTree, "ratio" );
485  rot = parseOptionalAttribute<EROT>( aTree, "rot" );
486 
487  opt_string stemp = parseOptionalAttribute<string>( aTree, "display" );
488 
489  // (off | value | name | both)
490  if( stemp == "off" )
492  else if( stemp == "value" )
494  else if( stemp == "name" )
496  else if( stemp == "both" )
498 
499  stemp = parseOptionalAttribute<string>( aTree, "align" );
500 
501  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
502 }
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: