KiCad PCB EDA Suite
KIID_PATH Class Reference

#include <kiid.h>

Inheritance diagram for KIID_PATH:

Public Member Functions

 KIID_PATH ()
 
 KIID_PATH (const wxString &aString)
 
bool MakeRelativeTo (const KIID_PATH &aPath)
 
wxString AsString () const
 
bool operator== (KIID_PATH const &rhs) const
 
bool operator< (KIID_PATH const &rhs) const
 

Detailed Description

Definition at line 134 of file kiid.h.

Constructor & Destructor Documentation

◆ KIID_PATH() [1/2]

KIID_PATH::KIID_PATH ( )
inline

Definition at line 137 of file kiid.h.

138  {
139  }

◆ KIID_PATH() [2/2]

KIID_PATH::KIID_PATH ( const wxString &  aString)

Definition at line 279 of file kiid.cpp.

280 {
281  for( const wxString& pathStep : wxSplit( aString, '/' ) )
282  {
283  if( !pathStep.empty() )
284  emplace_back( KIID( pathStep ) );
285  }
286 }
Definition: kiid.h:44

Member Function Documentation

◆ AsString()

wxString KIID_PATH::AsString ( ) const

◆ MakeRelativeTo()

bool KIID_PATH::MakeRelativeTo ( const KIID_PATH aPath)

Definition at line 289 of file kiid.cpp.

290 {
291  KIID_PATH copy = *this;
292  clear();
293 
294  if( aPath.size() > copy.size() )
295  return false; // this path is not contained within aPath
296 
297  for( size_t i = 0; i < aPath.size(); ++i )
298  {
299  if( copy.at( i ).AsString() != aPath.at( i ).AsString() )
300  return false; // this path is not contained within aPath
301  }
302 
303  for( size_t i = aPath.size(); i < copy.size(); ++i )
304  push_back( copy.at( i ) );
305 
306  return true;
307 }
wxString AsString() const
Definition: kiid.cpp:310

References AsString(), and copy.

◆ operator<()

bool KIID_PATH::operator< ( KIID_PATH const &  rhs) const
inline

Definition at line 161 of file kiid.h.

162  {
163  if( size() != rhs.size() )
164  return size() < rhs.size();
165 
166  for( size_t i = 0; i < size(); ++i )
167  {
168  if( at( i ) < rhs.at( i ) )
169  return true;
170 
171  if( at( i ) != rhs.at( i ) )
172  return false;
173  }
174 
175  return false;
176  }

◆ operator==()

bool KIID_PATH::operator== ( KIID_PATH const &  rhs) const
inline

Definition at line 147 of file kiid.h.

148  {
149  if( size() != rhs.size() )
150  return false;
151 
152  for( size_t i = 0; i < size(); ++i )
153  {
154  if( at( i ) != rhs.at( i ) )
155  return false;
156  }
157 
158  return true;
159  }

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