KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_io_pads.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) 2025 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 3
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 along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCH_IO_PADS_H_
21#define SCH_IO_PADS_H_
22
23#include <sch_io/sch_io.h>
24#include <sch_io/sch_io_mgr.h>
25
26#include <map>
27#include <memory>
28#include <unordered_map>
29
30class SCH_SCREEN;
31class SCH_SHEET;
32class SCHEMATIC;
33class LIB_SYMBOL;
34
41class SCH_IO_PADS : public SCH_IO
42{
43public:
46
48 {
49 return IO_BASE::IO_FILE_DESC( _HKI( "PADS Logic schematic files" ), { "asc", "txt" } );
50 }
51
53 {
54 return IO_BASE::IO_FILE_DESC( _HKI( "PADS Logic library files" ), { "asc", "txt" } );
55 }
56
57 bool CanReadSchematicFile( const wxString& aFileName ) const override;
58 bool CanReadLibrary( const wxString& aFileName ) const override;
59
60 int GetModifyHash() const override { return 0; }
61
62 SCH_SHEET* LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
63 SCH_SHEET* aAppendToMe = nullptr,
64 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
65
66 void EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath,
67 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
68
69 void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList, const wxString& aLibraryPath,
70 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
71
72 LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aPartName,
73 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
74
75 bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
76
77private:
84 bool checkFileHeader( const wxString& aFileName ) const;
85
90 void ensureLoadedLibrary( const wxString& aLibraryPath );
91
92 long long getLibraryTimestamp( const wxString& aLibraryPath ) const;
93
94 std::unordered_map<wxString, SEVERITY> m_errorMessages;
95
98 bool m_libraryCacheValid = false;
99 std::map<wxString, std::unique_ptr<LIB_SYMBOL>> m_librarySymbols;
100};
101
102#endif // SCH_IO_PADS_H_
Define a library symbol object.
Definition lib_symbol.h:83
Holds all the data relating to one schematic.
Definition schematic.h:89
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_librarySymbols
Definition sch_io_pads.h:99
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
long long getLibraryTimestamp(const wxString &aLibraryPath) const
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
Definition sch_io_pads.h:52
int GetModifyHash() const override
Return the modification hash from the library cache.
Definition sch_io_pads.h:60
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
bool checkFileHeader(const wxString &aFileName) const
Check if the file header indicates a PADS Logic schematic file.
void ensureLoadedLibrary(const wxString &aLibraryPath)
Parse the PADS Logic ASCII file and populate the library symbol cache.
wxString m_cachedLibraryPath
Definition sch_io_pads.h:96
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
Definition sch_io_pads.h:75
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
Returns schematic file description for the SCH_IO.
Definition sch_io_pads.h:47
long long m_cachedLibraryTimestamp
Definition sch_io_pads.h:97
std::unordered_map< wxString, SEVERITY > m_errorMessages
Definition sch_io_pads.h:94
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
bool m_libraryCacheValid
Definition sch_io_pads.h:98
SCH_IO(const wxString &aName)
Definition sch_io.h:375
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:48
#define _HKI(x)
Definition page_info.cpp:44
Container that describes file type info.
Definition io_base.h:43