KiCad PCB EDA Suite
EATTR Struct Reference

Eagle "attribute" XML element, no foolin'. More...

Public Types

enum  { Off, VALUE, NAME, BOTH }
 

Public Member Functions

 EATTR (CPTREE &aTree)
 Constructor EATTR parses an Eagle "attribute" XML element. More...
 
 EATTR ()
 

Public Attributes

string name
 
opt_string value
 
opt_double x
 
opt_double y
 
opt_double size
 
opt_int layer
 
opt_double ratio
 
opt_erot rot
 
opt_int display
 

Detailed Description

Eagle "attribute" XML element, no foolin'.

Definition at line 458 of file eagle_plugin.cpp.

Member Enumeration Documentation

anonymous enum
Enumerator
Off 
VALUE 
NAME 
BOTH 

Definition at line 469 of file eagle_plugin.cpp.

469  { // for 'display'
470  Off,
471  VALUE,
472  NAME,
473  BOTH,
474  };

Constructor & Destructor Documentation

EATTR::EATTR ( CPTREE aAttribute)

Constructor 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 487 of file eagle_plugin.cpp.

References BOTH, NAME, Off, parseOptionalEROT(), and VALUE.

488 {
489  CPTREE& attribs = aAttribute.get_child( "<xmlattr>" );
490 
491  /*
492  <!ELEMENT attribute EMPTY>
493  <!ATTLIST attribute
494  name %String; #REQUIRED
495  value %String; #IMPLIED
496  x %Coord; #IMPLIED
497  y %Coord; #IMPLIED
498  size %Dimension; #IMPLIED
499  layer %Layer; #IMPLIED
500  font %TextFont; #IMPLIED
501  ratio %Int; #IMPLIED
502  rot %Rotation; "R0"
503  display %AttributeDisplay; "value" -- only in <element> or <instance> context --
504  constant %Bool; "no" -- only in <device> context --
505  >
506  */
507 
508  name = attribs.get<string>( "name" ); // #REQUIRED
509  value = attribs.get_optional<string>( "value" );
510 
511  x = attribs.get_optional<double>( "x" );
512  y = attribs.get_optional<double>( "y" );
513  size = attribs.get_optional<double>( "size" );
514 
515  // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE
516  // Eagle can it seems.
517  layer = attribs.get_optional<int>( "layer" );
518 
519  ratio = attribs.get_optional<double>( "ratio" );
520  rot = parseOptionalEROT( attribs );
521 
522  opt_string stemp = attribs.get_optional<string>( "display" );
523  if( stemp )
524  {
525  // (off | value | name | both)
526  if( !stemp->compare( "off" ) )
528  else if( !stemp->compare( "value" ) )
530  else if( !stemp->compare( "name" ) )
532  else if( !stemp->compare( "both" ) )
534  }
535 }
const PTREE CPTREE
Definition: eagle_plugin.h:63
static opt_erot parseOptionalEROT(CPTREE &attribs)
Eagle "rot" fields are optional, handle that by returning opt_erot.
opt_double size
opt_erot rot
string name
opt_string value
opt_double x
opt_int layer
opt_double ratio
opt_int display
opt_double y
EATTR::EATTR ( )
inline

Definition at line 478 of file eagle_plugin.cpp.

478 {}

Member Data Documentation

opt_int EATTR::display

Definition at line 475 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::loadElements().

opt_int EATTR::layer

Definition at line 465 of file eagle_plugin.cpp.

string EATTR::name

Definition at line 460 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::loadElements().

opt_double EATTR::ratio

Definition at line 466 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_erot EATTR::rot

Definition at line 467 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_double EATTR::size

Definition at line 464 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_string EATTR::value

Definition at line 461 of file eagle_plugin.cpp.

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

opt_double EATTR::x

Definition at line 462 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::orientModuleText().

opt_double EATTR::y

Definition at line 463 of file eagle_plugin.cpp.

Referenced by EAGLE_PLUGIN::orientModuleText().


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