KiCad PCB EDA Suite
Loading...
Searching...
No Matches
allegro_db_utils.h File Reference

Utility functions that operate over BRD_DBs and BLOCKs. More...

#include <concepts>
#include <cstdint>
#include <functional>
#include <optional>
#include <type_traits>
#include <unordered_set>
#include <variant>
#include <ki_exception.h>
#include <convert/allegro_pcb_structs.h>
#include <convert/allegro_db.h>
#include <wx/log.h>
#include <wx/string.h>

Go to the source code of this file.

Classes

class  ALLEGRO::BLOCK_REF< BLK_T >
 Non-owning, typed reference to a BLOCK in the database. More...
 
class  ALLEGRO::LL_WALKER
 Range-for-compatible walker over a linked list of BLOCK_BASE objects in a BRD_DB. More...
 
class  ALLEGRO::LL_WALKER::ITERATOR
 
class  ALLEGRO::TYPED_LL_WALKER< T >
 Range-for-compatible walker that yields only typed data from a linked list. More...
 
class  ALLEGRO::TYPED_LL_WALKER< T >::ITERATOR
 

Namespaces

namespace  ALLEGRO
 

Typedefs

using ALLEGRO::MISMATCH_REPORTER = std::function<void( uint8_t aGotType, const BLOCK_BASE& aBlock )>
 Callback signature for MISMATCH_POLICY::REPORT.
 
using ALLEGRO::FIELD_VALUE = std::variant<wxString, uint32_t>
 Some value stored in an 0x03 FIELD block.
 

Enumerations

enum class  ALLEGRO::MISMATCH_POLICY { ALLEGRO::SKIP , ALLEGRO::LOG_TRACE , ALLEGRO::THROW , ALLEGRO::REPORT }
 Policy for TYPED_LL_WALKER when a block with an unexpected type code is encountered. More...
 

Functions

template<ALLEGRO_BLOCK_DATA BLK_T>
constexpr bool ALLEGRO::BlockTypeMatches (uint8_t aType)
 Check whether a runtime block type code matches the expected type for T.
 
template<ALLEGRO_BLOCK_DATA BLK_T>
const BLK_T & ALLEGRO::BlockDataAs (const BLOCK_BASE &aBlock)
 Cast a BLOCK_BASE to a typed BLOCK<T> and return the data.
 
uint32_t ALLEGRO::GetPrimaryNext (const BLOCK_BASE &aBlock)
 Get the next block key in the linked list for a given block.
 
std::optional< FIELD_VALUEALLEGRO::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 > ALLEGRO::GetFirstFieldOfTypeInt (const BRD_DB &aDb, uint32_t aFieldsPtr, uint32_t aEndKey, uint16_t aFieldCode)
 Convenience wrapper around GetFirstFieldOfType() for integer-valued fields.
 

Variables

const wxChar *const ALLEGRO::traceAllegroUtils = wxT( "KICAD_ALLEGRO_BUILDER" )
 

Detailed Description

Utility functions that operate over BRD_DBs and BLOCKs.

Definition in file allegro_db_utils.h.