KiCad PCB EDA Suite
XPATH Class Reference

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

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

Member Function Documentation

◆ Attribute()

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

modify the last path node's attribute

Definition at line 133 of file eagle_parser.h.

134  {
135  p.back().attribute = aAttribute;
136  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:114

References p.

◆ clear()

void XPATH::clear ( )
inline

Definition at line 122 of file eagle_parser.h.

122 { p.clear(); }
std::vector< TRIPLET > p
Definition: eagle_parser.h:114

References p.

Referenced by EAGLE_PLUGIN::init().

◆ Contents()

wxString XPATH::Contents ( )
inline

return the contents of the XPATH as a single string

Definition at line 139 of file eagle_parser.h.

140  {
141  typedef std::vector<TRIPLET>::const_iterator CITER_TRIPLET;
142 
143  wxString ret;
144 
145  for( CITER_TRIPLET it = p.begin(); it != p.end(); ++it )
146  {
147  if( it != p.begin() )
148  ret += '.';
149 
150  ret += it->element;
151 
152  if( it->attribute[0] && it->value[0] )
153  {
154  ret += '[';
155  ret += it->attribute;
156  ret += '=';
157  ret += it->value;
158  ret += ']';
159  }
160  }
161 
162  return ret;
163  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:114

References p.

Referenced by EAGLE_PLUGIN::Load().

◆ pop()

◆ push()

void XPATH::push ( const char *  aPathSegment,
const char *  aAttribute = "" 
)
inline

Definition at line 117 of file eagle_parser.h.

118  {
119  p.emplace_back( aPathSegment, aAttribute );
120  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:114

References p.

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().

◆ Value()

void XPATH::Value ( const char *  aValue)
inline

modify the last path node's value

Definition at line 127 of file eagle_parser.h.

128  {
129  p.back().value = aValue;
130  }
std::vector< TRIPLET > p
Definition: eagle_parser.h:114

References p.

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

Member Data Documentation

◆ p

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

Definition at line 114 of file eagle_parser.h.

Referenced by Attribute(), clear(), Contents(), pop(), push(), and Value().


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