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 139 of file kiid.h.

Constructor & Destructor Documentation

◆ KIID_PATH() [1/2]

KIID_PATH::KIID_PATH ( )
inline

Definition at line 142 of file kiid.h.

143 {
144 }

◆ KIID_PATH() [2/2]

KIID_PATH::KIID_PATH ( const wxString &  aString)

Definition at line 301 of file kiid.cpp.

302{
303 for( const wxString& pathStep : wxSplit( aString, '/' ) )
304 {
305 if( !pathStep.empty() )
306 emplace_back( KIID( pathStep ) );
307 }
308}
Definition: kiid.h:48

Member Function Documentation

◆ AsString()

◆ MakeRelativeTo()

bool KIID_PATH::MakeRelativeTo ( const KIID_PATH aPath)

Definition at line 311 of file kiid.cpp.

312{
313 KIID_PATH copy = *this;
314 clear();
315
316 if( aPath.size() > copy.size() )
317 return false; // this path is not contained within aPath
318
319 for( size_t i = 0; i < aPath.size(); ++i )
320 {
321 if( copy.at( i ).AsString() != aPath.at( i ).AsString() )
322 return false; // this path is not contained within aPath
323 }
324
325 for( size_t i = aPath.size(); i < copy.size(); ++i )
326 push_back( copy.at( i ) );
327
328 return true;
329}
wxString AsString() const
Definition: kiid.cpp:332

References AsString(), and copy.

◆ operator<()

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

Definition at line 166 of file kiid.h.

167 {
168 if( size() != rhs.size() )
169 return size() < rhs.size();
170
171 for( size_t i = 0; i < size(); ++i )
172 {
173 if( at( i ) < rhs.at( i ) )
174 return true;
175
176 if( at( i ) != rhs.at( i ) )
177 return false;
178 }
179
180 return false;
181 }

◆ operator==()

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

Definition at line 152 of file kiid.h.

153 {
154 if( size() != rhs.size() )
155 return false;
156
157 for( size_t i = 0; i < size(); ++i )
158 {
159 if( at( i ) != rhs.at( i ) )
160 return false;
161 }
162
163 return true;
164 }

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