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

Node type: root. More...

#include <lib_tree_model.h>

Inheritance diagram for LIB_TREE_NODE_ROOT:
LIB_TREE_NODE

Public Types

enum  TYPE {
  ROOT , LIBRARY , ITEM , UNIT ,
  INVALID
}
 
typedef std::vector< std::unique_ptr< LIB_TREE_NODE > > PTR_VECTOR
 

Public Member Functions

 LIB_TREE_NODE_ROOT (LIB_TREE_NODE_ROOT const &_)=delete
 The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around.
 
void operator= (LIB_TREE_NODE_ROOT const &_)=delete
 
 LIB_TREE_NODE_ROOT ()
 Construct the root node.
 
LIB_TREE_NODE_LIBRARYAddLib (wxString const &aName, wxString const &aDesc)
 Construct an empty library node, add it to the root, and return it.
 
void UpdateScore (EDA_COMBINED_MATCHER *aMatcher, const wxString &aLib, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
 Update the score for this part.
 
virtual void ResetScore ()
 Initialize scores recursively.
 
virtual void ForceScore (int aScore)
 
void AssignIntrinsicRanks (bool presorted=false)
 Store intrinsic ranks on all children of this node.
 
void SortNodes (bool aUseScores)
 Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
 

Static Public Member Functions

static bool Compare (LIB_TREE_NODE const &aNode1, LIB_TREE_NODE const &aNode2, bool aUseScores)
 Compare two nodes.
 

Public Attributes

LIB_TREE_NODEm_Parent
 
PTR_VECTOR m_Children
 
enum TYPE m_Type
 
int m_IntrinsicRank
 The rank of the item before any search terms are applied.
 
int m_Score
 
bool m_Pinned
 
wxString m_Name
 
wxString m_Desc
 
wxString m_Footprint
 
int m_PinCount
 
std::vector< SEARCH_TERMm_SearchTerms
 
std::map< wxString, wxString > m_Fields
 List of weighted search terms.
 
LIB_ID m_LibId
 
int m_Unit
 
bool m_IsRoot
 

Detailed Description

Node type: root.

Definition at line 268 of file lib_tree_model.h.

Member Typedef Documentation

◆ PTR_VECTOR

typedef std::vector<std::unique_ptr<LIB_TREE_NODE> > LIB_TREE_NODE::PTR_VECTOR
inherited

Definition at line 123 of file lib_tree_model.h.

Member Enumeration Documentation

◆ TYPE

enum LIB_TREE_NODE::TYPE
inherited
Enumerator
ROOT 
LIBRARY 
ITEM 
UNIT 
INVALID 

Definition at line 114 of file lib_tree_model.h.

Constructor & Destructor Documentation

◆ LIB_TREE_NODE_ROOT() [1/2]

LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT ( LIB_TREE_NODE_ROOT const &  _)
delete

The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around.

◆ LIB_TREE_NODE_ROOT() [2/2]

LIB_TREE_NODE_ROOT::LIB_TREE_NODE_ROOT ( )

Construct the root node.

Root nodes have no properties.

Definition at line 344 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Type, and LIB_TREE_NODE::ROOT.

Member Function Documentation

◆ AddLib()

LIB_TREE_NODE_LIBRARY & LIB_TREE_NODE_ROOT::AddLib ( wxString const &  aName,
wxString const &  aDesc 
)

Construct an empty library node, add it to the root, and return it.

Definition at line 350 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Children.

Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode().

◆ AssignIntrinsicRanks()

◆ Compare()

bool LIB_TREE_NODE::Compare ( LIB_TREE_NODE const &  aNode1,
LIB_TREE_NODE const &  aNode2,
bool  aUseScores 
)
staticinherited

Compare two nodes.

Returns true if aNode1 < aNode2.

Definition at line 83 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_IntrinsicRank, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_Pinned, LIB_TREE_NODE::m_Score, and LIB_TREE_NODE::m_Type.

◆ ForceScore()

virtual void LIB_TREE_NODE::ForceScore ( int  aScore)
inlinevirtualinherited

Definition at line 92 of file lib_tree_model.h.

References LIB_TREE_NODE::m_Score.

◆ operator=()

void LIB_TREE_NODE_ROOT::operator= ( LIB_TREE_NODE_ROOT const &  _)
delete

◆ ResetScore()

void LIB_TREE_NODE::ResetScore ( )
virtualinherited

Initialize scores recursively.

Definition at line 33 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Children, and LIB_TREE_NODE::m_Score.

Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().

◆ SortNodes()

void LIB_TREE_NODE::SortNodes ( bool  aUseScores)
inherited

Sort child nodes quickly and recursively (IntrinsicRanks must have been set).

Definition at line 70 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Children.

Referenced by LIB_TREE_MODEL_ADAPTER::resortTree(), and LIB_TREE_MODEL_ADAPTER::UpdateSearchString().

◆ UpdateScore()

void LIB_TREE_NODE_ROOT::UpdateScore ( EDA_COMBINED_MATCHER aMatcher,
const wxString &  aLib,
std::function< bool(LIB_TREE_NODE &aNode)> *  aFilter 
)
overridevirtual

Update the score for this part.

This is accumulative - it will be called once per search term.

Parameters
aMatcheran EDA_COMBINED_MATCHER initialized with the search term

Implements LIB_TREE_NODE.

Definition at line 358 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Children.

Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().

Member Data Documentation

◆ m_Children

◆ m_Desc

◆ m_Fields

std::map<wxString, wxString> LIB_TREE_NODE::m_Fields
inherited

◆ m_Footprint

wxString LIB_TREE_NODE::m_Footprint
inherited

◆ m_IntrinsicRank

int LIB_TREE_NODE::m_IntrinsicRank
inherited

The rank of the item before any search terms are applied.

This is a fairly expensive sort (involving string compares) so it helps to store the result of that sort.

Definition at line 134 of file lib_tree_model.h.

Referenced by LIB_TREE_NODE::AssignIntrinsicRanks(), LIB_TREE_NODE::Compare(), and LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ m_IsRoot

◆ m_LibId

◆ m_Name

◆ m_Parent

◆ m_PinCount

int LIB_TREE_NODE::m_PinCount
inherited

◆ m_Pinned

◆ m_Score

◆ m_SearchTerms

◆ m_Type

◆ m_Unit


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