KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pads_common.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 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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PADS_COMMON_H
21#define PADS_COMMON_H
22
23#include <kiid.h>
24#include <string>
25
27#include <stroke_params.h>
28#include <wx/string.h>
29
38
39namespace PADS_COMMON
40{
41
56KIID GenerateDeterministicUuid( const std::string& aIdentifier );
57
58
68
69
74{
75 wxString pcbFile;
76 wxString schematicFile;
77
78 bool HasPcb() const { return !pcbFile.IsEmpty(); }
79 bool HasSchematic() const { return !schematicFile.IsEmpty(); }
80 bool HasBoth() const { return HasPcb() && HasSchematic(); }
81};
82
83
90PADS_FILE_TYPE DetectPadsFileType( const wxString& aFilePath );
91
92
105RELATED_FILES FindRelatedPadsFiles( const wxString& aFilePath );
106
107
112int ParseInt( const std::string& aStr, int aDefault = 0, const std::string& aContext = {} );
113
118double ParseDouble( const std::string& aStr, double aDefault = 0.0,
119 const std::string& aContext = {} );
120
134wxString ConvertInvertedNetName( const std::string& aNetName );
135
145wxString ConvertText( const std::string& aText );
146
153LINE_STYLE PadsLineStyleToKiCad( int aPadsStyle );
154
171void DecodeJustification( int aJustification, GR_TEXT_H_ALIGN_T& aHJustify,
172 GR_TEXT_V_ALIGN_T& aVJustify );
173
174} // namespace PADS_COMMON
175
176#endif // PADS_COMMON_H
PADS_FILE_TYPE
Types of PADS files that can be detected.
Definition pads_common.h:63
@ PCB_ASCII
PADS PowerPCB ASCII (.asc)
Definition pads_common.h:65
@ SCHEMATIC_ASCII
PADS Logic ASCII (.asc or .txt)
Definition pads_common.h:66
void DecodeJustification(int aJustification, GR_TEXT_H_ALIGN_T &aHJustify, GR_TEXT_V_ALIGN_T &aVJustify)
Decode a PADS text justification code into KiCad horizontal and vertical alignment.
RELATED_FILES FindRelatedPadsFiles(const wxString &aFilePath)
Find related PADS project files from a given source file.
int ParseInt(const std::string &aStr, int aDefault, const std::string &aContext)
Parse integer from string with error context.
wxString ConvertText(const std::string &aText)
Decode text from a PADS file, which uses an 8-bit codepage rather than UTF-8.
PADS_FILE_TYPE DetectPadsFileType(const wxString &aFilePath)
Detect the type of a PADS file by examining its header.
wxString ConvertInvertedNetName(const std::string &aNetName)
Convert a PADS net name to KiCad format, handling inverted signal notation.
LINE_STYLE PadsLineStyleToKiCad(int aPadsStyle)
Convert a PADS line style integer to a KiCad LINE_STYLE enum value.
KIID GenerateDeterministicUuid(const std::string &aIdentifier)
Generate a deterministic KIID from a PADS component identifier.
double ParseDouble(const std::string &aStr, double aDefault, const std::string &aContext)
Parse double from string with error context.
LINE_STYLE
Dashed line types.
Result of detecting related PADS project files.
Definition pads_common.h:74
wxString schematicFile
Path to schematic file if found.
Definition pads_common.h:76
wxString pcbFile
Path to PCB file if found.
Definition pads_common.h:75
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.