25 #ifndef ALTIUM_PARSER_H 26 #define ALTIUM_PARSER_H 31 #include <wx/gdicmn.h> 37 class CompoundFileReader;
38 struct COMPOUND_FILE_ENTRY;
43 const CFB::CompoundFileReader& aReader,
const char* aStreamName );
49 ALTIUM_PARSER(
const CFB::CompoundFileReader& aReader,
const CFB::COMPOUND_FILE_ENTRY* aEntry );
50 ALTIUM_PARSER( std::unique_ptr<
char[]>& aContent,
size_t aSize );
53 template <
typename Type>
58 Type val = *(Type*) (
m_pos );
59 m_pos +=
sizeof( Type );
71 uint8_t len = Read<uint8_t>();
76 wxString val = wxString(
m_pos, wxConvISO8859_1, len );
83 return wxString( wxEmptyString );
89 std::map<uint32_t, wxString> table;
92 while( remaining >= 8 )
94 uint32_t index = Read<uint32_t>();
95 uint32_t length = Read<uint32_t>();
103 if( length > remaining )
106 str = wxString(
m_pos, wxMBConvUTF16LE(), length - 2 );
109 table.emplace( index, str );
126 std::vector<char> data(
m_pos,
m_pos + aSize );
163 uint32_t length = Read<uint32_t>();
172 static int ReadInt(
const std::map<wxString, wxString>& aProps,
173 const wxString& aKey,
int aDefault );
175 static double ReadDouble(
const std::map<wxString, wxString>& aProps,
176 const wxString& aKey,
double aDefault );
178 static bool ReadBool(
const std::map<wxString, wxString>& aProps,
179 const wxString& aKey,
bool aDefault );
181 static int32_t
ReadKicadUnit(
const std::map<wxString, wxString>& aProps,
182 const wxString& aKey,
const wxString& aDefault );
184 static wxString
ReadString(
const std::map<wxString, wxString>& aProps,
185 const wxString& aKey,
const wxString& aDefault );
238 #endif //ALTIUM_PARSER_H
size_t GetRemainingBytes() const
std::map< uint32_t, wxString > ReadWideStringTable()
void Skip(size_t aLength)
static double ReadDouble(const std::map< wxString, wxString > &aProps, const wxString &aKey, double aDefault)
size_t GetRemainingSubrecordBytes() const
std::vector< char > ReadVector(size_t aSize)
size_t ReadAndSetSubrecordLength()
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
std::map< wxString, wxString > ReadProperties()
static bool ReadBool(const std::map< wxString, wxString > &aProps, const wxString &aKey, bool aDefault)
ALTIUM_PARSER(const CFB::CompoundFileReader &aReader, const CFB::COMPOUND_FILE_ENTRY *aEntry)
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
const CFB::COMPOUND_FILE_ENTRY * FindStream(const CFB::CompoundFileReader &aReader, const char *aStreamName)
std::unique_ptr< char[]> m_content
static int32_t ConvertToKicadUnit(const double aValue)