37 LL_WALKER fieldWalker{ aFieldsPtr, aEndKey, aDb };
41 if( block->GetBlockType() != 0x03 )
46 if( field.m_Hdr1 != aFieldCode )
49 switch( field.m_SubType )
53 const std::string* str = std::get_if<std::string>( &field.m_Substruct );
56 return wxString( *str );
62 const uint32_t* val = std::get_if<uint32_t>( &field.m_Substruct );
84 if( uint32_t* val = std::get_if<uint32_t>( &
result.value() ) )
85 return static_cast<int>( *val );
93 wxArrayString components = wxSplit( aName,
':',
'\0' );
95 for( wxString& component : components )
97 if( component.length() > 2 && component.StartsWith( wxS(
"\\" ) ) && component.EndsWith( wxS(
"\\" ) )
98 && component.find(
'\\', 1 ) == component.length() - 1 )
100 component = component.Mid( 1, component.length() - 2 );
104 return wxJoin( components,
':',
'\0' );
Utility functions that operate over BRD_DBs and BLOCKs.
The base class for all blocks in the main body of an Allegro file.
An Allegro board database representing the contents of a .brd (and presumably .dra) file.
Range-for-compatible walker over a linked list of BLOCK_BASE objects in a BRD_DB.
std::optional< FIELD_VALUE > GetFirstFieldOfType(const BRD_DB &aDb, uint32_t aFieldsPtr, uint32_t aEndKey, uint16_t aFieldCode)
Look up the first 0x03 FIELD value of a given type in a linked field chain.
std::optional< int > GetFirstFieldOfTypeInt(const BRD_DB &aDb, uint32_t aFieldsPtr, uint32_t aEndKey, uint16_t aFieldCode)
Convenience wrapper around GetFirstFieldOfType() for integer-valued fields.
uint32_t GetPrimaryNext(const BLOCK_BASE &aBlock)
Get the next block key in the linked list for a given block.
wxString DecodeEscapedIdentifiers(const wxString &aName)
Remove the backslash wrapper Cadence puts around an identifier that holds special characters.
const BLK_T & BlockDataAs(const BLOCK_BASE &aBlock)
Cast a BLOCK_BASE to a typed BLOCK<T> and return the data.
wxString result
Test unit parsing edge cases and error handling.