|
KiCad PCB EDA Suite
|
Stream that reads primitive types from a memory buffer containing Allegro .brd (or .dra) file data. More...
#include <allegro_stream.h>
Public Member Functions | |
| FILE_STREAM (const uint8_t *aData, size_t aSize) | |
| size_t | Position () const |
| void | Seek (size_t aPos) |
| void | Skip (size_t aBytes) |
| bool | Eof () const |
| void | ReadBytes (void *aDest, size_t aSize) |
| Read a number of bytes from the stream into the destination buffer. | |
| template<typename T> | |
| T | Read () |
| std::string | ReadString (bool aRoundToNextU32) |
| std::string | ReadStringFixed (size_t aLen, bool aRoundToNextU32) |
| bool | GetU8 (uint8_t &value) |
| uint8_t | ReadU8 () |
| uint16_t | ReadU16 () |
| int16_t | ReadS16 () |
| uint32_t | ReadU32 () |
| int32_t | ReadS32 () |
| void | SkipU32 (size_t n=1) |
Static Private Member Functions | |
| template<typename T> | |
| static void | swapBytes (T &value) |
Private Attributes | |
| const uint8_t * | m_data |
| size_t | m_size |
| size_t | m_pos |
Static Private Attributes | |
| static constexpr bool | m_kNeedsSwap = std::endian::native != std::endian::little |
Stream that reads primitive types from a memory buffer containing Allegro .brd (or .dra) file data.
All multi-byte values are little-endian.
Definition at line 43 of file allegro_stream.h.
|
inline |
Definition at line 48 of file allegro_stream.h.
|
inline |
Definition at line 76 of file allegro_stream.h.
|
inline |
Definition at line 167 of file allegro_stream.h.
|
inline |
Definition at line 52 of file allegro_stream.h.
References m_pos.
Referenced by ParseBlock_0x01_ARC(), ParseBlock_0x03(), ParseBlock_0x04_NET_ASSIGNMENT(), ParseBlock_0x05_TRACK(), ParseBlock_0x06(), ParseBlock_0x07(), ParseBlock_0x08(), ParseBlock_0x09(), ParseBlock_0x0A_DRC(), ParseBlock_0x0C(), ParseBlock_0x0D_PAD(), ParseBlock_0x0E(), ParseBlock_0x0F(), ParseBlock_0x10(), ParseBlock_0x11(), ParseBlock_0x12(), ParseBlock_0x14(), ParseBlock_0x15_16_17_SEGMENT(), ParseBlock_0x1B_NET(), ParseBlock_0x1C_PADSTACK(), ParseBlock_0x1D(), ParseBlock_0x1E(), ParseBlock_0x1F(), ParseBlock_0x20(), ParseBlock_0x21(), ParseBlock_0x22(), ParseBlock_0x23_RATLINE(), ParseBlock_0x24_RECT(), ParseBlock_0x26(), ParseBlock_0x27(), ParseBlock_0x28_SHAPE(), ParseBlock_0x29_PIN(), ParseBlock_0x2A(), ParseBlock_0x2B(), ParseBlock_0x2C_TABLE(), ParseBlock_0x2D(), ParseBlock_0x2E(), ParseBlock_0x2F(), ParseBlock_0x30_STR_WRAPPER(), ParseBlock_0x31_SGRAPHIC(), ParseBlock_0x32_PLACED_PAD(), ParseBlock_0x33_VIA(), ParseBlock_0x34_KEEPOUT(), ParseBlock_0x35(), ParseBlock_0x36(), ParseBlock_0x37(), ParseBlock_0x38_FILM(), ParseBlock_0x39_FILM_LAYER_LIST(), ParseBlock_0x3A_FILM_LIST_NODE(), ParseBlock_0x3B(), ParseBlock_0x3C(), ALLEGRO_BLOCK_TEST_FIXTURE::RunBlockTest(), and ALLEGRO_BLOCK_TEST_FIXTURE::RunHeaderTest().
Definition at line 99 of file allegro_stream.h.
References m_kNeedsSwap, ReadBytes(), swapBytes(), and T.
Referenced by ReadS16(), ReadS32(), ReadU16(), ReadU32(), and ReadU8().
|
inline |
Read a number of bytes from the stream into the destination buffer.
It is your responsibility to ensure that the destination buffer is large enough to hold the requested number of bytes.
Definition at line 84 of file allegro_stream.h.
References m_data, m_pos, m_size, and THROW_IO_ERROR.
Referenced by ParseBlock_0x0F(), ParseBlock_0x1D(), ParseBlock_0x1F(), ParseBlock_0x21(), ParseBlock_0x35(), ParseBlock_0x36(), and Read().
|
inline |
|
inline |
Definition at line 180 of file allegro_stream.h.
References Read().
Referenced by ParseBlock_0x01_ARC(), ParseBlock_0x0A_DRC(), ParseBlock_0x0C(), ParseBlock_0x0D_PAD(), ParseBlock_0x0E(), ParseBlock_0x15_16_17_SEGMENT(), ParseBlock_0x1C_PADSTACK(), ParseBlock_0x23_RATLINE(), ParseBlock_0x24_RECT(), ParseBlock_0x28_SHAPE(), ParseBlock_0x29_PIN(), ParseBlock_0x2D(), ParseBlock_0x32_PLACED_PAD(), and ParseBlock_0x33_VIA().
|
inline |
Definition at line 114 of file allegro_stream.h.
References end, m_data, m_pos, m_size, Skip(), and THROW_IO_ERROR.
Referenced by ReadStringMap().
|
inline |
Definition at line 143 of file allegro_stream.h.
References m_data, m_pos, m_size, Skip(), and THROW_IO_ERROR.
Referenced by ParseBlock_0x03(), ParseBlock_0x1E(), ParseBlock_0x2A(), ParseBlock_0x31_SGRAPHIC(), ParseBlock_0x36(), ParseBlock_0x38_FILM(), and ParseBlock_0x3B().
|
inline |
Definition at line 177 of file allegro_stream.h.
References Read().
Referenced by ParseBlock_0x03(), ParseBlock_0x04_NET_ASSIGNMENT(), ParseBlock_0x08(), ParseBlock_0x11(), ParseBlock_0x12(), ParseBlock_0x1C_PADSTACK(), ParseBlock_0x1D(), ParseBlock_0x1E(), ParseBlock_0x1F(), ParseBlock_0x20(), ParseBlock_0x21(), ParseBlock_0x22(), ParseBlock_0x26(), ParseBlock_0x29_PIN(), ParseBlock_0x2A(), ParseBlock_0x2C_TABLE(), ParseBlock_0x2D(), ParseBlock_0x2E(), ParseBlock_0x2F(), ParseBlock_0x31_SGRAPHIC(), ParseBlock_0x35(), ParseBlock_0x36(), ParseBlock_0x37(), ParseBlock_0x39_FILM_LAYER_LIST(), ParseBlock_0x3B(), ParseBlock_0x3C(), and ReadField().
|
inline |
Definition at line 179 of file allegro_stream.h.
References Read().
Referenced by ParseBlock_0x01_ARC(), ParseBlock_0x03(), ParseBlock_0x04_NET_ASSIGNMENT(), ParseBlock_0x05_TRACK(), ParseBlock_0x06(), ParseBlock_0x07(), ParseBlock_0x08(), ParseBlock_0x09(), ParseBlock_0x0A_DRC(), ParseBlock_0x0C(), ParseBlock_0x0D_PAD(), ParseBlock_0x0E(), ParseBlock_0x0F(), ParseBlock_0x10(), ParseBlock_0x11(), ParseBlock_0x12(), ParseBlock_0x14(), ParseBlock_0x15_16_17_SEGMENT(), ParseBlock_0x1B_NET(), ParseBlock_0x1C_PADSTACK(), ParseBlock_0x1D(), ParseBlock_0x1E(), ParseBlock_0x1F(), ParseBlock_0x20(), ParseBlock_0x21(), ParseBlock_0x22(), ParseBlock_0x23_RATLINE(), ParseBlock_0x24_RECT(), ParseBlock_0x26(), ParseBlock_0x27(), ParseBlock_0x28_SHAPE(), ParseBlock_0x29_PIN(), ParseBlock_0x2A(), ParseBlock_0x2B(), ParseBlock_0x2C_TABLE(), ParseBlock_0x2D(), ParseBlock_0x2E(), ParseBlock_0x2F(), ParseBlock_0x30_STR_WRAPPER(), ParseBlock_0x31_SGRAPHIC(), ParseBlock_0x32_PLACED_PAD(), ParseBlock_0x33_VIA(), ParseBlock_0x34_KEEPOUT(), ParseBlock_0x36(), ParseBlock_0x37(), ParseBlock_0x38_FILM(), ParseBlock_0x39_FILM_LAYER_LIST(), ParseBlock_0x3A_FILM_LIST_NODE(), ParseBlock_0x3B(), ParseBlock_0x3C(), ReadAllegroFloat(), ReadArrayU32(), ReadField(), ReadLL(), and ReadStringMap().
|
inline |
Definition at line 176 of file allegro_stream.h.
References Read().
Referenced by ParseBlock_0x01_ARC(), ParseBlock_0x03(), ParseBlock_0x04_NET_ASSIGNMENT(), ParseBlock_0x08(), ParseBlock_0x0A_DRC(), ParseBlock_0x0C(), ParseBlock_0x0E(), ParseBlock_0x11(), ParseBlock_0x12(), ParseBlock_0x14(), ParseBlock_0x1C_PADSTACK(), ParseBlock_0x1E(), ParseBlock_0x20(), ParseBlock_0x21(), ParseBlock_0x22(), ParseBlock_0x23_RATLINE(), ParseBlock_0x24_RECT(), ParseBlock_0x26(), ParseBlock_0x28_SHAPE(), ParseBlock_0x29_PIN(), ParseBlock_0x2C_TABLE(), ParseBlock_0x2D(), ParseBlock_0x2E(), ParseBlock_0x2F(), ParseBlock_0x30_STR_WRAPPER(), ParseBlock_0x31_SGRAPHIC(), ParseBlock_0x32_PLACED_PAD(), ParseBlock_0x34_KEEPOUT(), ParseBlock_0x35(), ParseBlock_0x36(), ParseBlock_0x37(), ParseBlock_0x3B(), ParseBlock_0x3C(), ParseLayerInfo(), ParseTextProps(), and ReadField().
|
inline |
Definition at line 54 of file allegro_stream.h.
References m_pos, m_size, and THROW_IO_ERROR.
Referenced by ReadStringMap().
|
inline |
Definition at line 65 of file allegro_stream.h.
References m_pos, m_size, and THROW_IO_ERROR.
Referenced by ParseBlock_0x01_ARC(), ParseBlock_0x03(), ParseBlock_0x05_TRACK(), ParseBlock_0x06(), ParseBlock_0x07(), ParseBlock_0x09(), ParseBlock_0x0D_PAD(), ParseBlock_0x0F(), ParseBlock_0x10(), ParseBlock_0x15_16_17_SEGMENT(), ParseBlock_0x1B_NET(), ParseBlock_0x1D(), ParseBlock_0x1F(), ParseBlock_0x27(), ParseBlock_0x2A(), ParseBlock_0x2B(), ParseBlock_0x33_VIA(), ParseBlock_0x36(), ParseBlock_0x38_FILM(), ParseBlock_0x39_FILM_LAYER_LIST(), ParseBlock_0x3A_FILM_LIST_NODE(), ReadString(), ReadStringFixed(), and SkipU32().
|
inline |
Definition at line 182 of file allegro_stream.h.
References Skip().
|
private |
Definition at line 192 of file allegro_stream.h.
Referenced by FILE_STREAM(), GetU8(), ReadBytes(), ReadString(), and ReadStringFixed().
|
staticconstexprprivate |
Definition at line 45 of file allegro_stream.h.
Referenced by Read().
|
private |
Definition at line 194 of file allegro_stream.h.
Referenced by Eof(), FILE_STREAM(), GetU8(), Position(), ReadBytes(), ReadString(), ReadStringFixed(), Seek(), and Skip().
|
private |
Definition at line 193 of file allegro_stream.h.
Referenced by Eof(), FILE_STREAM(), GetU8(), ReadBytes(), ReadString(), ReadStringFixed(), Seek(), and Skip().