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 285 of file kiid.cpp.

286 {
287  for( const wxString& pathStep : wxSplit( aString, '/' ) )
288  {
289  if( !pathStep.empty() )
290  emplace_back( KIID( pathStep ) );
291  }
292 }
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 295 of file kiid.cpp.

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

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: