KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EASYEDAPRO::V3_DOC_PARSER Class Reference

Parses EasyEDA Pro v3 .epro2 archives. More...

#include <easyedapro_v3_parser.h>

Public Member Functions

 V3_DOC_PARSER (const wxString &aFileName)
 
void Load ()
 Load all v3 docs from the archive.
 
void LoadLibrary ()
 Load all v3 docs from a library archive.
 
const nlohmann::json & GetProject2 () const
 
const nlohmann::json & GetLibraryIndex () const
 
const std::map< wxString, V3_DOC_RAW > & GetRawDocs (const wxString &aDocType) const
 
const V3_DOC_RAWFindRawDoc (const wxString &aDocType, const wxString &aUuid) const
 
int GetSkippedCount () const
 

Static Public Member Functions

static bool IsV3Archive (const wxString &aFileName)
 Return true if aFileName looks like an EasyEDA Pro v3 archive.
 
static bool IsV3Library (const wxString &aFileName, const wxString &aRequiredDocType=wxEmptyString)
 Return true if aFileName looks like an EasyEDA Pro v3 library archive.
 

Private Attributes

wxString m_fileName
 
nlohmann::json m_project2
 
nlohmann::json m_libraryIndex
 
std::map< wxString, std::map< wxString, V3_DOC_RAW > > m_rawDocs
 
int m_skippedCount = 0
 

Detailed Description

Parses EasyEDA Pro v3 .epro2 archives.

Provides raw document access (GetRawDocs/FindRawDoc) for direct v3 parsing.

Definition at line 91 of file easyedapro_v3_parser.h.

Constructor & Destructor Documentation

◆ V3_DOC_PARSER()

EASYEDAPRO::V3_DOC_PARSER::V3_DOC_PARSER ( const wxString & aFileName)
explicit

Definition at line 610 of file easyedapro_v3_parser.cpp.

References m_fileName.

Member Function Documentation

◆ FindRawDoc()

const V3_DOC_RAW * EASYEDAPRO::V3_DOC_PARSER::FindRawDoc ( const wxString & aDocType,
const wxString & aUuid ) const

◆ GetLibraryIndex()

const nlohmann::json & EASYEDAPRO::V3_DOC_PARSER::GetLibraryIndex ( ) const
inline

◆ GetProject2()

const nlohmann::json & EASYEDAPRO::V3_DOC_PARSER::GetProject2 ( ) const
inline

Definition at line 129 of file easyedapro_v3_parser.h.

References m_project2.

◆ GetRawDocs()

const std::map< wxString, V3_DOC_RAW > & EASYEDAPRO::V3_DOC_PARSER::GetRawDocs ( const wxString & aDocType) const

◆ GetSkippedCount()

int EASYEDAPRO::V3_DOC_PARSER::GetSkippedCount ( ) const
inline

Definition at line 137 of file easyedapro_v3_parser.h.

References m_skippedCount.

Referenced by PCB_IO_EASYEDAPRO_V3::LoadBoard().

◆ IsV3Archive()

bool EASYEDAPRO::V3_DOC_PARSER::IsV3Archive ( const wxString & aFileName)
static

Return true if aFileName looks like an EasyEDA Pro v3 archive.

Supported detection:

  • .epro2 extension
  • .zip containing project2.json and at least one .epru document file

Definition at line 616 of file easyedapro_v3_parser.cpp.

References zip.

Referenced by PCB_IO_EASYEDAPRO_V3::CanReadBoard(), SCH_IO_EASYEDAPRO_V3::CanReadSchematicFile(), and IMPORT_PROJ_HELPER::ImportFiles().

◆ IsV3Library()

bool EASYEDAPRO::V3_DOC_PARSER::IsV3Library ( const wxString & aFileName,
const wxString & aRequiredDocType = wxEmptyString )
static

Return true if aFileName looks like an EasyEDA Pro v3 library archive.

Detection requires a .elibz2 extension with a ZIP containing symbol2.json, footprint2.json or device2.json and at least one .elibu document file. When aRequiredDocType is set, the .elibu document file must also contain that document type.

Definition at line 659 of file easyedapro_v3_parser.cpp.

Referenced by PCB_IO_EASYEDAPRO_V3::CanReadLibrary(), and SCH_IO_EASYEDAPRO_V3::CanReadLibrary().

◆ Load()

void EASYEDAPRO::V3_DOC_PARSER::Load ( )

Load all v3 docs from the archive.

Exceptions
IO_ERRORon malformed v3 archives or parse failures.

Definition at line 678 of file easyedapro_v3_parser.cpp.

References m_fileName, m_libraryIndex, m_project2, m_rawDocs, and m_skippedCount.

Referenced by IMPORT_PROJ_HELPER::EasyEDAProProjectHandler(), and PCB_IO_EASYEDAPRO_V3::LoadBoard().

◆ LoadLibrary()

void EASYEDAPRO::V3_DOC_PARSER::LoadLibrary ( )

Load all v3 docs from a library archive.

Exceptions
IO_ERRORon malformed v3 library archives or parse failures.

Definition at line 694 of file easyedapro_v3_parser.cpp.

References m_fileName, m_libraryIndex, m_project2, m_rawDocs, and m_skippedCount.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

Member Data Documentation

◆ m_fileName

wxString EASYEDAPRO::V3_DOC_PARSER::m_fileName
private

Definition at line 140 of file easyedapro_v3_parser.h.

Referenced by Load(), LoadLibrary(), and V3_DOC_PARSER().

◆ m_libraryIndex

nlohmann::json EASYEDAPRO::V3_DOC_PARSER::m_libraryIndex
private

Definition at line 142 of file easyedapro_v3_parser.h.

Referenced by GetLibraryIndex(), Load(), and LoadLibrary().

◆ m_project2

nlohmann::json EASYEDAPRO::V3_DOC_PARSER::m_project2
private

Definition at line 141 of file easyedapro_v3_parser.h.

Referenced by GetProject2(), Load(), and LoadLibrary().

◆ m_rawDocs

std::map<wxString, std::map<wxString, V3_DOC_RAW> > EASYEDAPRO::V3_DOC_PARSER::m_rawDocs
private

Definition at line 143 of file easyedapro_v3_parser.h.

Referenced by FindRawDoc(), GetRawDocs(), Load(), and LoadLibrary().

◆ m_skippedCount

int EASYEDAPRO::V3_DOC_PARSER::m_skippedCount = 0
private

Definition at line 144 of file easyedapro_v3_parser.h.

Referenced by GetSkippedCount(), Load(), and LoadLibrary().


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