KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_io_orcad.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 * Based on the dsn2kicad reference implementation and on OrCAD file format
7 * documentation from the OpenOrCadParser project (MIT licensed).
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCH_IO_ORCAD_H_
24#define SCH_IO_ORCAD_H_
25
26#include <sch_io/sch_io.h>
27#include <sch_io/sch_io_mgr.h>
28#include <reporter.h>
29
30#include <map>
31#include <memory>
32#include <vector>
33
34
35class SCH_SHEET;
36class LIB_SYMBOL;
37class SCH_SCREEN;
38class SCHEMATIC;
39
40std::string OrcadNormalizeCfbName( const std::string& aName );
41
42
61class SCH_IO_ORCAD : public SCH_IO
62{
63public:
64 SCH_IO_ORCAD() : SCH_IO( wxS( "OrCAD Schematic" ) )
65 {
67 }
68
70
72 {
73 return IO_BASE::IO_FILE_DESC( _HKI( "OrCAD Capture schematic files" ), { "dsn" } );
74 }
75
77 {
78 return IO_BASE::IO_FILE_DESC( _HKI( "OrCAD Capture symbol library files" ), { "olb" } );
79 }
80
87 bool CanReadSchematicFile( const wxString& aFileName ) const override;
88
89 int GetModifyHash() const override { return 0; }
90
100 SCH_SHEET* LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
101 SCH_SHEET* aAppendToMe = nullptr,
102 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
103
109 void EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath,
110 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
111
112 void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList, const wxString& aLibraryPath,
113 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
114
115 LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
116 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
117
118 bool IsLibraryWritable( const wxString& aLibraryPath ) override { return false; }
119
120private:
123 const std::vector<std::unique_ptr<LIB_SYMBOL>>& loadOlbSymbols( const wxString& aLibraryPath );
124
125 std::map<wxString, std::vector<std::unique_ptr<LIB_SYMBOL>>> m_libCache;
126};
127
128#endif // SCH_IO_ORCAD_H_
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
Definition io_base.h:237
Define a library symbol object.
Definition lib_symbol.h:114
Holds all the data relating to one schematic.
Definition schematic.h:90
const std::vector< std::unique_ptr< LIB_SYMBOL > > & loadOlbSymbols(const wxString &aLibraryPath)
Parse an .OLB and build its KiCad library symbols, cached by library path.
std::map< wxString, std::vector< std::unique_ptr< LIB_SYMBOL > > > m_libCache
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
bool CanReadSchematicFile(const wxString &aFileName) const override
The .dsn extension collides with SPECCTRA PCB session files (plain text), so beyond the extension gat...
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Orchestration: root sheet/screen boilerplate (honoring aAppendToMe), CFB open, Library parse + versio...
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, 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
Enumerate the symbols of an OrCAD .OLB library (an OLE2/CFB compound document with the same Library/C...
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
Returns schematic file description for the SCH_IO.
int GetModifyHash() const override
Return the modification hash from the library cache.
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
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:44
static REPORTER & GetInstance()
Definition reporter.cpp:279
#define _HKI(x)
Definition page_info.cpp:40
std::string OrcadNormalizeCfbName(const std::string &aName)
Container that describes file type info.
Definition io_base.h:43