KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ORCAD_STRUCT_READER Class Reference

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
 

Detailed Description

ReadStructure can recover from a body error when the prefix supplies a valid end offset.

Definition at line 83 of file orcad_structures.h.

Constructor & Destructor Documentation

◆ ORCAD_STRUCT_READER()

ORCAD_STRUCT_READER::ORCAD_STRUCT_READER ( ORCAD_STREAM & aStream,
const std::vector< std::string > * aStrings = nullptr,
ORCAD_WARN_FN aWarn = nullptr,
ORCAD_DIALECT aDialect = {} )

Definition at line 36 of file orcad_structures.cpp.

References m_dialect, m_stream, m_strings, m_warn, and move.

Member Function Documentation

◆ Dialect()

◆ PropsDict()

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().

◆ ReadCount()

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().

◆ readLegacyPrefix()

ORCAD_PREFIXES ORCAD_STRUCT_READER::readLegacyPrefix ( int aExpectedType)
private

◆ ReadPrefixes()

ORCAD_PREFIXES ORCAD_STRUCT_READER::ReadPrefixes ( int aExpectedType = -1,
size_t aEnclosingEnd = ORCAD_STREAM::npos,
size_t aLongPrefixCount = ORCAD_STREAM::npos )

◆ ReadStrIdx()

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().

◆ ReadStructure()

◆ Resolve()

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().

◆ SkipStructure()

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().

◆ Stream()

◆ Warn()

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().

Member Data Documentation

◆ m_dialect

ORCAD_DIALECT ORCAD_STRUCT_READER::m_dialect
private

◆ m_stream

ORCAD_STREAM& ORCAD_STRUCT_READER::m_stream
private

◆ m_strings

const std::vector<std::string>* ORCAD_STRUCT_READER::m_strings
private

Definition at line 124 of file orcad_structures.h.

Referenced by ORCAD_STRUCT_READER(), and Resolve().

◆ m_warn

ORCAD_WARN_FN ORCAD_STRUCT_READER::m_warn
private

Definition at line 125 of file orcad_structures.h.

Referenced by ORCAD_STRUCT_READER(), and Warn().


The documentation for this class was generated from the following files: