KiCad PCB EDA Suite
Loading...
Searching...
No Matches
orcad_cache.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
24#ifndef ORCAD_CACHE_H_
25#define ORCAD_CACHE_H_
26
27#include <cstdint>
28#include <map>
29#include <optional>
30#include <string>
31#include <vector>
32
36
39std::optional<ORCAD_PRIMITIVE> OrcadReadPrimitive( ORCAD_STREAM& aStream );
40
42std::optional<ORCAD_SYMBOL_PIN> OrcadReadSymbolPin( ORCAD_STRUCT_READER& aReader );
43
46 const ORCAD_PREFIXES& aPrefixes, bool aWithPins );
47
48
50 const ORCAD_PREFIXES& aPrefixes );
51
52
54 const ORCAD_PREFIXES& aPrefixes );
55
56
58
59
61
64void OrcadParseCache( const std::vector<char>& aData, const std::vector<std::string>& aStrings,
65 const ORCAD_WARN_FN& aWarn, std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
66 std::map<std::string, ORCAD_PACKAGE>& aPackages );
67
69void OrcadParseSymbolStream( const std::vector<char>& aData, const std::vector<std::string>& aStrings,
70 std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols );
71
73void OrcadParsePackageStream( const std::vector<char>& aData, const std::vector<std::string>& aStrings,
74 std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
75 std::map<std::string, ORCAD_PACKAGE>& aPackages );
76
78void OrcadMergeCacheStreams( std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
79 std::map<std::string, ORCAD_PACKAGE>& aPackages,
80 std::map<std::string, ORCAD_SYMBOL_DEF>&& aExtraSymbols,
81 std::map<std::string, ORCAD_PACKAGE>&& aExtraPackages );
82
83void OrcadMergeSymbolGeneralProperties( std::map<std::string, ORCAD_SYMBOL_DEF>& aSymbols,
84 const std::map<std::string, ORCAD_SYMBOL_DEF>& aMetadataSymbols );
85
86#endif // ORCAD_CACHE_H_
The caller owns the buffer.
ReadStructure can recover from a body error when the prefix supplies a valid end offset.
void OrcadMergeSymbolGeneralProperties(std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, const std::map< std::string, ORCAD_SYMBOL_DEF > &aMetadataSymbols)
void OrcadMergeCacheStreams(std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages, std::map< std::string, ORCAD_SYMBOL_DEF > &&aExtraSymbols, std::map< std::string, ORCAD_PACKAGE > &&aExtraPackages)
Existing symbols gain variants.
ORCAD_DEVICE OrcadReadDevice(ORCAD_STRUCT_READER &aReader)
std::optional< ORCAD_SYMBOL_PIN > OrcadReadSymbolPin(ORCAD_STRUCT_READER &aReader)
A zero byte marks an empty pin slot and returns nullopt.
void OrcadParseSymbolStream(const std::vector< char > &aData, const std::vector< std::string > &aStrings, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols)
Throws IO_ERROR for invalid framing or trailing bytes.
ORCAD_PACKAGE OrcadReadPackage(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
ORCAD_DRAWN_INSTANCE OrcadReadDrawnInstance(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
std::optional< ORCAD_PRIMITIVE > OrcadReadPrimitive(ORCAD_STREAM &aStream)
Consumes one primitive and its optional preamble.
void OrcadParseCache(const std::vector< char > &aData, const std::vector< std::string > &aStrings, const ORCAD_WARN_FN &aWarn, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages)
The first entry is the default; later entries become variants.
void OrcadParsePackageStream(const std::vector< char > &aData, const std::vector< std::string > &aStrings, std::map< std::string, ORCAD_SYMBOL_DEF > &aSymbols, std::map< std::string, ORCAD_PACKAGE > &aPackages)
Package streams contain counted PartCells and LibraryParts, followed by one Package.
ORCAD_SYMBOL_DEF OrcadReadSymbolDef(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes, bool aWithPins)
Set aWithPins to read the trailing pin and property lists.
ORCAD_SYMBOL_DEF OrcadReadSthInPages0(ORCAD_STRUCT_READER &aReader, const ORCAD_PREFIXES &aPrefixes)
std::function< void(const wxString &aMsg)> ORCAD_WARN_FN
Coordinates use DBU with Y down.
Device unit names omit the view suffix.
The inline LibraryPart defines the block interface; placed pin records supply absolute positions.
Prefix lengths supply structure bounds.
The bounding box occupies the final eight bytes before the next prefix stop.