KiCad PCB EDA Suite
EATTR Struct Reference

Parse 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

Parse an Eagle "attribute" XML element.

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Off 
VALUE 
NAME 
BOTH 

Definition at line 605 of file eagle_parser.h.

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

Constructor & Destructor Documentation

◆ EATTR() [1/2]

EATTR::EATTR ( wxXmlNode *  aTree)

Definition at line 482 of file eagle_parser.cpp.

483 {
484  /*
485  <!ELEMENT attribute EMPTY>
486  <!ATTLIST attribute
487  name %String; #REQUIRED
488  value %String; #IMPLIED
489  x %Coord; #IMPLIED
490  y %Coord; #IMPLIED
491  size %Dimension; #IMPLIED
492  layer %Layer; #IMPLIED
493  font %TextFont; #IMPLIED
494  ratio %Int; #IMPLIED
495  rot %Rotation; "R0"
496  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
497  constant %Bool; "no" -- only in <device> context --
498  >
499  */
500 
501  name = parseRequiredAttribute<wxString>( aTree, wxT( "name" ) );
502  value = parseOptionalAttribute<wxString>( aTree, wxT( "value" ) );
503 
504  x = parseOptionalAttribute<ECOORD>( aTree, wxT( "x" ) );
505  y = parseOptionalAttribute<ECOORD>( aTree, wxT( "y" ) );
506  size = parseOptionalAttribute<ECOORD>( aTree, wxT( "size" ) );
507 
508  layer = parseOptionalAttribute<int>( aTree, wxT( "layer" ) );
509  ratio = parseOptionalAttribute<double>( aTree, wxT( "ratio" ) );
510  rot = parseOptionalAttribute<EROT>( aTree, wxT( "rot" ) );
511 
512  opt_wxString stemp = parseOptionalAttribute<wxString>( aTree, wxT( "display" ) );
513 
514  // (off | value | name | both)
515  if( stemp == wxT( "off" ) )
517  else if( stemp == wxT( "name" ) )
519  else if( stemp == wxT( "both" ) )
521  else // "value" is the default
523 
524  stemp = parseOptionalAttribute<wxString>( aTree, wxT( "align" ) );
525 
526  align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
527 }
opt_erot rot
Definition: eagle_parser.h:603
opt_int align
Definition: eagle_parser.h:612
wxString name
Definition: eagle_parser.h:596
opt_ecoord y
Definition: eagle_parser.h:599
opt_wxString value
Definition: eagle_parser.h:597
static int parseAlignment(const wxString &aAlignment)
opt_ecoord x
Definition: eagle_parser.h:598
opt_int layer
Definition: eagle_parser.h:601
constexpr auto DEFAULT_ALIGNMENT
opt_double ratio
Definition: eagle_parser.h:602
opt_int display
Definition: eagle_parser.h:611
opt_ecoord size
Definition: eagle_parser.h:600

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

615 {}

Member Data Documentation

◆ align

opt_int EATTR::align

◆ display

opt_int EATTR::display

◆ layer

opt_int EATTR::layer

Definition at line 601 of file eagle_parser.h.

Referenced by EATTR().

◆ name

wxString EATTR::name

◆ ratio

opt_double EATTR::ratio

Definition at line 602 of file eagle_parser.h.

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

◆ rot

opt_erot EATTR::rot

◆ size

opt_ecoord EATTR::size

Definition at line 600 of file eagle_parser.h.

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

◆ value

opt_wxString EATTR::value

Definition at line 597 of file eagle_parser.h.

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

◆ x

opt_ecoord EATTR::x

◆ y

opt_ecoord EATTR::y

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