|
KiCad PCB EDA Suite
|
ReadStructure can recover from a body error when the prefix supplies a valid end offset. More...
#include <orcad_structures.h>
Public Member Functions | |
| ORCAD_STRUCT_READER (ORCAD_STREAM &aStream, const std::vector< std::string > *aStrings=nullptr, ORCAD_WARN_FN aWarn=nullptr, ORCAD_DIALECT aDialect={}) | |
| ORCAD_STREAM & | Stream () |
| const ORCAD_DIALECT & | Dialect () const |
| ORCAD_PREFIXES | ReadPrefixes (int aExpectedType=-1, size_t aEnclosingEnd=ORCAD_STREAM::npos, size_t aLongPrefixCount=ORCAD_STREAM::npos) |
| aLongPrefixCount overrides the type depth; aEnclosingEnd bounds all stops. | |
| uint32_t | ReadStrIdx () |
| A string-table index in the dialect's width. | |
| uint16_t | ReadCount () |
| A u16 list count. | |
| std::string | Resolve (uint32_t aIndex) const |
| String-table lookup; returns "" for out-of-range indices and the legacy sentinel. | |
| std::map< std::string, std::string > | PropsDict (const ORCAD_PREFIXES &aPrefixes) const |
| Resolve the short-prefix (nameIdx, valueIdx) pairs. | |
| void | SkipStructure (const ORCAD_PREFIXES &aPrefixes, const wxString &aWhat) |
| Throws IO_ERROR if the end is unknown or behind the cursor. | |
| ORCAD_READ_RESULT | ReadStructure () |
| Always resumes at the prefix end, skipping unknown bodies and undecoded trailers. | |
| void | Warn (const wxString &aMsg) const |
| Report a recoverable problem to the warning sink (no-op when none was given). | |
Private Member Functions | |
| ORCAD_PREFIXES | readLegacyPrefix (int aExpectedType) |
Private Attributes | |
| ORCAD_STREAM & | m_stream |
| const std::vector< std::string > * | m_strings |
| ORCAD_WARN_FN | m_warn |
| ORCAD_DIALECT | m_dialect |
ReadStructure can recover from a body error when the prefix supplies a valid end offset.
Definition at line 83 of file orcad_structures.h.
| ORCAD_STRUCT_READER::ORCAD_STRUCT_READER | ( | ORCAD_STREAM & | aStream, |
| const std::vector< std::string > * | aStrings = nullptr, | ||
| ORCAD_WARN_FN | aWarn = nullptr, | ||
| ORCAD_DIALECT | aDialect = {} ) |
|
inline |
Definition at line 91 of file orcad_structures.h.
References m_dialect.
Referenced by OrcadReadDisplayProp(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPlacedInstance(), OrcadReadPrimitive(), OrcadReadSymbolDef(), OrcadReadSymbolPin(), OrcadReadWire(), readOccScope(), readOccTree(), and readOccurrence().
| std::map< std::string, std::string > ORCAD_STRUCT_READER::PropsDict | ( | const ORCAD_PREFIXES & | aPrefixes | ) | const |
Resolve the short-prefix (nameIdx, valueIdx) pairs.
Modern files drop empty names.
Definition at line 257 of file orcad_structures.cpp.
References m_dialect, name, ORCAD_PREFIXES::props, and Resolve().
Referenced by OrcadParsePackageStream(), OrcadParsePage(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPackage(), OrcadReadPlacedInstance(), OrcadReadSymbolDef(), and readOccHeader().
| uint16_t ORCAD_STRUCT_READER::ReadCount | ( | ) |
A u16 list count.
Nothing bounds a legacy record, so a legacy count that cannot fit the remaining bytes throws rather than driving a runaway read.
Definition at line 231 of file orcad_structures.cpp.
References m_dialect, m_stream, and THROW_IO_ERRORF.
Referenced by OrcadParseCache(), OrcadParsePackageStream(), OrcadParsePage(), OrcadReadDevice(), OrcadReadDisplayPropList(), OrcadReadDrawnInstance(), OrcadReadPackage(), OrcadReadSymbolDef(), readOccScope(), readOccTree(), readOccurrence(), and storeLegacyCacheRecord().
|
private |
Definition at line 113 of file orcad_structures.cpp.
References ORCAD_PREFIXES::bodyStart, m_stream, ORCAD_PREFIXES::props, ORCAD_PREFIXES::start, THROW_IO_ERRORF, and ORCAD_PREFIXES::typeId.
Referenced by ReadPrefixes().
| ORCAD_PREFIXES ORCAD_STRUCT_READER::ReadPrefixes | ( | int | aExpectedType = -1, |
| size_t | aEnclosingEnd = ORCAD_STREAM::npos, | ||
| size_t | aLongPrefixCount = ORCAD_STREAM::npos ) |
aLongPrefixCount overrides the type depth; aEnclosingEnd bounds all stops.
Invalid or inconsistent prefixes throw IO_ERROR. Legacy prefixes leave the end unknown.
Definition at line 140 of file orcad_structures.cpp.
References ORCAD_PREFIXES::bodyLens, ORCAD_PREFIXES::bodyStart, ORCAD_PREFIXES::end, m_dialect, m_stream, ORCAD_STREAM::npos, OrcadLongPrefixCount(), ORCAD_PREFIXES::props, readLegacyPrefix(), ORCAD_PREFIXES::start, ORCAD_PREFIXES::stops, THROW_IO_ERROR, THROW_IO_ERRORF, and ORCAD_PREFIXES::typeId.
Referenced by OrcadParseCache(), OrcadParsePackageStream(), OrcadParsePage(), OrcadParsePageOrder(), OrcadParseSymbolStream(), OrcadReadDevice(), OrcadReadDrawnInstance(), OrcadReadSymbolPin(), readOccHeader(), ReadStructure(), and storeLegacyCacheRecord().
| uint32_t ORCAD_STRUCT_READER::ReadStrIdx | ( | ) |
A string-table index in the dialect's width.
Definition at line 225 of file orcad_structures.cpp.
References m_dialect, and m_stream.
Referenced by OrcadReadDisplayProp(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPlacedInstance(), and readOccurrence().
| ORCAD_READ_RESULT ORCAD_STRUCT_READER::ReadStructure | ( | ) |
Always resumes at the prefix end, skipping unknown bodies and undecoded trailers.
Definition at line 287 of file orcad_structures.cpp.
References ORCAD_PREFIXES::end, m_dialect, m_stream, ORCAD_ST_ALIAS, ORCAD_ST_BUS_ENTRY, ORCAD_ST_DRAWN_INSTANCE, ORCAD_ST_ERC_OBJECT, ORCAD_ST_GLOBAL, ORCAD_ST_GRAPHIC_ARC_INST, ORCAD_ST_GRAPHIC_BEZIER_INST, ORCAD_ST_GRAPHIC_BITMAP_INST, ORCAD_ST_GRAPHIC_BOX_INST, ORCAD_ST_GRAPHIC_COMMENT_TEXT_INST, ORCAD_ST_GRAPHIC_ELLIPSE_INST, ORCAD_ST_GRAPHIC_LINE_INST, ORCAD_ST_GRAPHIC_OLE_INST, ORCAD_ST_GRAPHIC_POLYGON_INST, ORCAD_ST_GRAPHIC_POLYLINE_INST, ORCAD_ST_OFFPAGE_CONNECTOR, ORCAD_ST_PLACED_INSTANCE, ORCAD_ST_PORT, ORCAD_ST_STH_IN_PAGES0, ORCAD_ST_SYMBOL_DISPLAY_PROP, ORCAD_ST_T0X10, ORCAD_ST_T0X11, ORCAD_ST_TITLEBLOCK, ORCAD_ST_WIRE_BUS, ORCAD_ST_WIRE_SCALAR, OrcadReadAlias(), OrcadReadBusEntryBody(), OrcadReadDisplayProp(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPinInst(), OrcadReadPlacedInstance(), OrcadReadSymbolDef(), OrcadReadWire(), ReadPrefixes(), result, THROW_IO_ERRORF, ORCAD_PREFIXES::typeId, Warn(), and IO_ERROR::What().
Referenced by OrcadParsePage(), OrcadReadDisplayPropList(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPlacedInstance(), OrcadReadSymbolDef(), and OrcadReadWire().
| std::string ORCAD_STRUCT_READER::Resolve | ( | uint32_t | aIndex | ) | const |
String-table lookup; returns "" for out-of-range indices and the legacy sentinel.
Definition at line 245 of file orcad_structures.cpp.
References m_dialect, and m_strings.
Referenced by OrcadReadDisplayProp(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPlacedInstance(), PropsDict(), and readOccurrence().
| void ORCAD_STRUCT_READER::SkipStructure | ( | const ORCAD_PREFIXES & | aPrefixes, |
| const wxString & | aWhat ) |
Throws IO_ERROR if the end is unknown or behind the cursor.
Definition at line 274 of file orcad_structures.cpp.
References ORCAD_PREFIXES::end, m_stream, and THROW_IO_ERRORF.
Referenced by storeFramedRecord().
|
inline |
Definition at line 89 of file orcad_structures.h.
References m_stream.
Referenced by OrcadReadAlias(), OrcadReadDevice(), OrcadReadDisplayProp(), OrcadReadDrawnInstance(), OrcadReadGraphicInst(), OrcadReadPackage(), OrcadReadPinInst(), OrcadReadPlacedInstance(), OrcadReadPrimitive(), OrcadReadSymbolDef(), OrcadReadSymbolPin(), OrcadReadWire(), readOccScope(), readOccTree(), readOccurrence(), storeFramedRecord(), and storeLegacyCacheRecord().
| void ORCAD_STRUCT_READER::Warn | ( | const wxString & | aMsg | ) | const |
Report a recoverable problem to the warning sink (no-op when none was given).
Definition at line 46 of file orcad_structures.cpp.
References m_warn.
Referenced by ReadStructure().
|
private |
Definition at line 126 of file orcad_structures.h.
Referenced by Dialect(), ORCAD_STRUCT_READER(), PropsDict(), ReadCount(), ReadPrefixes(), ReadStrIdx(), ReadStructure(), and Resolve().
|
private |
Definition at line 123 of file orcad_structures.h.
Referenced by ORCAD_STRUCT_READER(), ReadCount(), readLegacyPrefix(), ReadPrefixes(), ReadStrIdx(), ReadStructure(), SkipStructure(), and Stream().
|
private |
Definition at line 124 of file orcad_structures.h.
Referenced by ORCAD_STRUCT_READER(), and Resolve().
|
private |
Definition at line 125 of file orcad_structures.h.
Referenced by ORCAD_STRUCT_READER(), and Warn().