KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_re_rule_loader.h
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 (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef DRC_RE_RULE_LOADER_H_
25#define DRC_RE_RULE_LOADER_H_
26
27#include <memory>
28#include <set>
29#include <vector>
30
31#include <wx/string.h>
32
33#include <drc/drc_rule.h>
34
35#include "drc_re_loaded_rule.h"
37
38
48{
49public:
51
62 std::vector<DRC_RE_LOADED_PANEL_ENTRY> LoadRule( const DRC_RULE& aRule,
63 const wxString& aOriginalText );
64
71 std::vector<DRC_RE_LOADED_PANEL_ENTRY> LoadFile( const wxString& aPath );
72
79 std::vector<DRC_RE_LOADED_PANEL_ENTRY> LoadFromString( const wxString& aRulesText );
80
81private:
90 std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>
92 const DRC_RULE& aRule,
93 const std::set<DRC_CONSTRAINT_T>& aClaimedConstraints );
94
102 const DRC_CONSTRAINT* findConstraint( const DRC_RULE& aRule, DRC_CONSTRAINT_T aType );
103
107 double toMM( int aValue );
108
110};
111
112
113#endif // DRC_RE_RULE_LOADER_H_
Maps DRC rule constraints to appropriate editor panels.
double toMM(int aValue)
Convert internal units (nanometers) to millimeters.
DRC_PANEL_MATCHER m_matcher
std::vector< DRC_RE_LOADED_PANEL_ENTRY > LoadRule(const DRC_RULE &aRule, const wxString &aOriginalText)
Load a single DRC_RULE and convert it to panel entries.
std::vector< DRC_RE_LOADED_PANEL_ENTRY > LoadFromString(const wxString &aRulesText)
Load rules from a text string.
const DRC_CONSTRAINT * findConstraint(const DRC_RULE &aRule, DRC_CONSTRAINT_T aType)
Find a constraint of a specific type in a rule.
std::vector< DRC_RE_LOADED_PANEL_ENTRY > LoadFile(const wxString &aPath)
Load all rules from a .kicad_dru file.
std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > createConstraintData(DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, const DRC_RULE &aRule, const std::set< DRC_CONSTRAINT_T > &aClaimedConstraints)
Create the appropriate constraint data object for a panel type.
DRC_CONSTRAINT_T
Definition drc_rule.h:47
DRC_RULE_EDITOR_CONSTRAINT_NAME