KiCad PCB EDA Suite
Loading...
Searching...
No Matches
design_block.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <design_block.h>
21
22#include <wx/tokenzr.h>
23
24
25std::vector<SEARCH_TERM> DESIGN_BLOCK::GetSearchTerms()
26{
27 std::vector<SEARCH_TERM> terms;
28
29 terms.emplace_back( SEARCH_TERM( GetLibNickname(), 4 ) );
30 terms.emplace_back( SEARCH_TERM( GetName(), 8 ) );
31 terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) );
32
33 wxStringTokenizer keywordTokenizer( GetKeywords(), wxS( " " ), wxTOKEN_STRTOK );
34
35 while( keywordTokenizer.HasMoreTokens() )
36 terms.emplace_back( SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) );
37
38 // Also include keywords as one long string, just in case
39 terms.emplace_back( SEARCH_TERM( GetKeywords(), 1 ) );
40 terms.emplace_back( SEARCH_TERM( GetDesc(), 1 ) );
41
42 return terms;
43}
wxString GetLibNickname() const override
wxString GetDesc() override
LIB_ID GetLIB_ID() const override
std::vector< SEARCH_TERM > GetSearchTerms() override
const wxString & GetKeywords() const
wxString GetName() const override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition ptree.cpp:198
A structure for storing weighted search terms.