KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SEARCH_STACK Class Reference

Look for files in a number of paths. More...

#include <search_stack.h>

Inheritance diagram for SEARCH_STACK:
PROJECT::_ELEM

Public Member Functions

PROJECT::ELEM ProjectElementType () override
 
wxString FilenameWithRelativePathInSearchList (const wxString &aFullFilename, const wxString &aBaseDir)
 Return the shortest possible path which can be use later to find a full path from this SEARCH_STACK.
 
void AddPaths (const wxString &aPaths, int aIndex=-1)
 Insert or append path(s).
 
void RemovePaths (const wxString &aPaths)
 Remove the given path(s) from the library path list.
 
const wxString LastVisitedPath (const wxString &aSubPathToSearch=wxEmptyString)
 A quirky function inherited from old code that seems to serve particular needs in the UI.
 

Static Public Member Functions

static int Split (wxArrayString *aResult, const wxString &aPathString)
 Separate aPathString into individual paths.
 

Detailed Description

Look for files in a number of paths.

Augments wxPathList. I chose the name because it sounded like a stack of work, as a reminder that anything you put in here means searching work at some point in time. (An alternative is to simply know where something is.)

Definition at line 42 of file search_stack.h.

Member Function Documentation

◆ AddPaths()

void SEARCH_STACK::AddPaths ( const wxString &  aPaths,
int  aIndex = -1 
)

Insert or append path(s).

Parameters
aPathspath or path list to add. paths must be separated by ";" on windows, or ":" | ";" on unix.
aIndexinsertion point, -1 for append.

Definition at line 119 of file search_stack.cpp.

References path, and Split().

Referenced by add_search_paths(), GlobalPathsAppend(), DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable(), FP_LIB_TABLE::LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), PGM_KICAD::OnPgmInit(), PROJECT_SCH::SchSearchS(), SearchHelpFileFullPath(), SystemDirsAppend(), and DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow().

◆ FilenameWithRelativePathInSearchList()

wxString SEARCH_STACK::FilenameWithRelativePathInSearchList ( const wxString &  aFullFilename,
const wxString &  aBaseDir 
)

Return the shortest possible path which can be use later to find a full path from this SEARCH_STACK.

If the library path is already in the library search paths list, just add the library name to the list. Otherwise, add the library name with the full or relative path. The relative path is preferable because it preserves use of default libraries paths, when the path is a sub path of these default paths. Note we accept only sub paths not relative paths starting by ../ that are not subpaths and are outside KiCad library paths

Parameters
aFullFilenameThe filename with path and extension.
aBaseDirThe absolute path on which relative paths in this SEARCH_STACK are based.
Returns
a short filename (with extension) with only a relative path if this filename can be found in library paths

Definition at line 69 of file search_stack.cpp.

References base_dir().

◆ LastVisitedPath()

const wxString SEARCH_STACK::LastVisitedPath ( const wxString &  aSubPathToSearch = wxEmptyString)

A quirky function inherited from old code that seems to serve particular needs in the UI.

It returns what is called the last visited directory or if aSubPathToSearch is empty, the first path in this SEARCH_STACK ( but not the CWD ).

Todo:
add more here if you can figure it out.
Parameters
aSubPathToSearchis the preferred sub path to search in path list.

Definition at line 161 of file search_stack.cpp.

References path.

Referenced by SYMBOL_EDIT_FRAME::saveLibrary().

◆ ProjectElementType()

PROJECT::ELEM SEARCH_STACK::ProjectElementType ( )
inlineoverridevirtual

Implements PROJECT::_ELEM.

Definition at line 45 of file search_stack.h.

References PROJECT::SEARCH_STACK.

◆ RemovePaths()

void SEARCH_STACK::RemovePaths ( const wxString &  aPaths)

Remove the given path(s) from the library path list.

Parameters
aPathspath or list of paths to remove. If list, paths must be separated by ";" on windows, or ":" | ";" on unix.

Definition at line 100 of file search_stack.cpp.

References path, and Split().

◆ Split()

int SEARCH_STACK::Split ( wxArrayString *  aResult,
const wxString &  aPathString 
)
static

Separate aPathString into individual paths.

Parameters
aResultis where to put the paths, it should be empty upon entry.
aPathStringis concatenated string with interposing ';' or ':' separators.
Returns
the count of paths found in aPathString

Definition at line 39 of file search_stack.cpp.

References path, and PATH_SEPS.

Referenced by AddPaths(), RemovePaths(), and PROJECT_SCH::SchSearchS().


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