KiCad PCB EDA Suite
XPATH Class Reference

Class XPATH keeps track of what we are working on within a PTREE. More...

#include <eagle_parser.h>

Public Member Functions

void push (const char *aPathSegment, const char *aAttribute="")
 
void clear ()
 
void pop ()
 
void Value (const char *aValue)
 modify the last path node's value More...
 
void Attribute (const char *aAttribute)
 modify the last path node's attribute More...
 
wxString Contents ()
 return the contents of the XPATH as a single string More...
 

Private Attributes

std::vector< TRIPLETp
 

Detailed Description

Class XPATH keeps track of what we are working on within a PTREE.

Then if an exception is thrown, the place within the tree that gave us grief can be reported almost accurately. To minimally impact speed, merely assign const char* pointers during the tree walking expedition. The const char* pointers must be to C strings residing either in the data or code segment (i.e. "compiled in") or within the XML document, but not on the stack, since the stack is unwound during the throwing of the exception. The XML document will not immediately vanish since we capture the xpath (using function Contents()) before the XML document tree (PTREE) is destroyed.

Definition at line 109 of file eagle_parser.h.

Member Function Documentation

void XPATH::Attribute ( const char *  aAttribute)
inline

modify the last path node's attribute

Definition at line 130 of file eagle_parser.h.

131  {
132  p.back().attribute = aAttribute;
133  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:111
void XPATH::clear ( )
inline

Definition at line 119 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::init().

119 { p.clear(); }
std::vector< TRIPLET > p
Definition: eagle_parser.h:111
wxString XPATH::Contents ( )
inline

return the contents of the XPATH as a single string

Definition at line 136 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::Load().

137  {
138  typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
139 
140  wxString ret;
141 
142  for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
143  {
144  if( it != p.begin() )
145  ret += '.';
146 
147  ret += it->element;
148 
149  if( it->attribute[0] && it->value[0] )
150  {
151  ret += '[';
152  ret += it->attribute;
153  ret += '=';
154  ret += it->value;
155  ret += ']';
156  }
157  }
158 
159  return ret;
160  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:111
void XPATH::push ( const char *  aPathSegment,
const char *  aAttribute = "" 
)
inline

Definition at line 114 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::cacheLib(), EAGLE_PLUGIN::loadAllSections(), EAGLE_PLUGIN::loadDesignRules(), EAGLE_PLUGIN::loadElements(), EAGLE_PLUGIN::loadLibraries(), EAGLE_PLUGIN::loadLibrary(), EAGLE_PLUGIN::loadPlain(), and EAGLE_PLUGIN::loadSignals().

115  {
116  p.push_back( TRIPLET( aPathSegment, aAttribute ) );
117  }
segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
Definition: eagle_parser.h:82
std::vector< TRIPLET > p
Definition: eagle_parser.h:111
void XPATH::Value ( const char *  aValue)
inline

modify the last path node's value

Definition at line 124 of file eagle_parser.h.

Referenced by EAGLE_PLUGIN::loadElements(), EAGLE_PLUGIN::loadLibraries(), EAGLE_PLUGIN::loadLibrary(), and EAGLE_PLUGIN::loadSignals().

125  {
126  p.back().value = aValue;
127  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:111

Member Data Documentation

std::vector<TRIPLET> XPATH::p
private

Definition at line 111 of file eagle_parser.h.


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