KiCad PCB EDA Suite
Loading...
Searching...
No Matches
EASYEDAPRO Namespace Reference

Classes

struct  BLOB
 
struct  PCB_ATTR
 
struct  PIN_INFO
 
struct  POURED
 
struct  PRJ_BOARD
 
struct  PRJ_DEVICE
 
struct  PRJ_FOOTPRINT
 
struct  PRJ_SCHEMATIC
 
struct  PRJ_SHEET
 
struct  PRJ_SYMBOL
 
struct  SCH_ATTR
 
struct  SCH_COMPONENT
 
struct  SCH_WIRE
 
struct  SYM_HEAD
 
struct  SYM_INFO
 
struct  SYM_PIN
 
struct  V3_DEVICE_DATA
 
class  V3_DOC_PARSER
 Parses EasyEDA Pro v3 .epro2 archives. More...
 
struct  V3_DOC_RAW
 Raw parsed document from an EasyEDA Pro v3 .epru stream. More...
 
struct  V3_ROW
 One parsed row from an EasyEDA Pro v3 .epru document stream. More...
 
struct  V3_SYMBOL_LIB_ITEM
 Build the schematic-library name map for a v3 .elibz2. More...
 

Enumerations

enum class  SYMBOL_TYPE {
  NORMAL = 2 , POWER_PORT = 18 , NETPORT = 19 , SHEET_SYMBOL = 20 ,
  SHORT = 22
}
 
enum class  FOOTPRINT_TYPE { NORMAL = 4 }
 

Functions

wxString ShortenLibName (wxString aProjectName)
 
LIB_ID ToKiCadLibID (const wxString &aLibName, const wxString &aLibReference)
 
std::vector< IMPORT_PROJECT_DESCProjectToSelectorDialog (const nlohmann::json &aProject, bool aPcbOnly=false, bool aSchOnly=false)
 
nlohmann::json FindJsonFile (const wxString &aZipFileName, const std::set< wxString > &aFileNames)
 
nlohmann::json ReadProjectOrDeviceFile (const wxString &aZipFileName)
 
void IterateZipFiles (const wxString &aFileName, std::function< bool(const wxString &, const wxString &, wxInputStream &)> aCallback)
 
std::vector< nlohmann::json > ParseJsonLines (wxInputStream &aInput, const wxString &aSource)
 
std::vector< std::vector< nlohmann::json > > ParseJsonLinesWithSeparation (wxInputStream &aInput, const wxString &aSource)
 Multiple document types (e.g.
 
std::map< wxString, wxString > AnyMapToStringMap (const std::map< wxString, nlohmann::json > &aInput)
 
nlohmann::json BuildV3ProjectIndexFromRawDocs (const V3_DOC_PARSER &aParser, bool aIncludeLibraryMetadata=true)
 Build a minimal legacy-style project index from parsed v3 raw documents.
 
std::map< wxString, BLOBBuildV3BlobMap (const V3_DOC_PARSER &aParser)
 
wxString GetV3LibraryItemTitle (const nlohmann::json &aMetadata, const wxString &aUuid)
 
wxString KeywordsFromV3Tags (const nlohmann::json &aTags)
 Build KiCad keywords from a v3 tags object (parent_tag / child_tag name fields).
 
wxString ResolveDeviceFieldVariables (const wxString &aInput, const std::map< wxString, wxString > &aDeviceAttributes)
 Resolve EasyEDA ={Var} / ={A}text{B} field expressions against device attributes.
 
wxString NormalizeEasyEDAText (wxString aText)
 Replace EasyEDA temperature glyph (℃) with °C.
 
wxString MakeUniqueLibName (std::set< wxString > &aUsedNames, const wxString &aName, const wxString &aFallback)
 Allocate a unique library item name, recording it in aUsedNames.
 
std::map< wxString, wxString > BuildV3DeviceLibNames (nlohmann::json &aProject, const std::map< wxString, PRJ_DEVICE > &aDevices, std::set< wxString > *aUsedNames=nullptr)
 Stable project-lib item names keyed by Device UUID (one entry per Device).
 
wxString LookupV3DeviceLibName (const nlohmann::json &aProject, const wxString &aDeviceUuid)
 
V3_DEVICE_DATA GetV3DeviceData (const nlohmann::json &aProject, const wxString &aDeviceUuid)
 
wxString ResolveV3DeviceValueText (const std::map< wxString, wxString > &aDeviceAttributes)
 Preferred Value text: Value attribute, else Name, with variables resolved.
 
void ForEachImportedDeviceField (const std::map< wxString, wxString > &aDeviceAttributes, bool aIncludeValue, const std::function< void(const wxString &aKey, const wxString &aValue)> &aCallback)
 Invoke aCallback for each non-empty whitelisted Device field (resolved + normalized).
 
std::map< wxString, V3_SYMBOL_LIB_ITEMBuildV3SymbolLibraryMap (const V3_DOC_PARSER &aParser)
 
std::map< wxString, wxString > BuildV3LibraryItemMap (const V3_DOC_PARSER &aParser, const char *aIndexKey, const wxString &aDocType)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::SCH_ATTR &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PCB_ATTR &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::SCH_COMPONENT &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::SCH_WIRE &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::SYM_PIN &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::SYM_HEAD &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_SHEET &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_SCHEMATIC &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_BOARD &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_SYMBOL &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_FOOTPRINT &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::PRJ_DEVICE &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::BLOB &d)
 
void from_json (const nlohmann::json &j, EASYEDAPRO::POURED &d)
 
wxString V3JsonToString (const nlohmann::json &aValue, const wxString &aDefault)
 
wxString V3GetString (const nlohmann::json &aObj, const char *aKey, const wxString &aDefault)
 
wxString V3GetString (const nlohmann::json &aObj, const wxString &aKey, const wxString &aDefault)
 
double V3GetDouble (const nlohmann::json &aObj, const char *aKey, double aDefault)
 
int V3GetInt (const nlohmann::json &aObj, const char *aKey, int aDefault)
 
bool V3GetBool (const nlohmann::json &aObj, const char *aKey, bool aDefault)
 
bool V3IsNullOrMissing (const nlohmann::json &aObj, const char *aKey)
 
nlohmann::json V3ParseIdArray (const wxString &aId)
 
int AlignToFontV (const wxString &aAlign)
 Map an EasyEDA "HORIZ_VERT" alignment token to a KiCad justify code (0 top/left, 1 center, 2 bottom/right).
 
int AlignToFontH (const wxString &aAlign)
 

Variables

static const bool IMPORT_POURED = true
 
static const bool IMPORT_POURED_ECOP = false
 

Enumeration Type Documentation

◆ FOOTPRINT_TYPE

enum class EASYEDAPRO::FOOTPRINT_TYPE
strong
Enumerator
NORMAL 

Definition at line 52 of file easyedapro_parser.h.

◆ SYMBOL_TYPE

enum class EASYEDAPRO::SYMBOL_TYPE
strong
Enumerator
NORMAL 
POWER_PORT 
NETPORT 
SHEET_SYMBOL 
SHORT 

Definition at line 43 of file easyedapro_parser.h.

Function Documentation

◆ AlignToFontH()

int EASYEDAPRO::AlignToFontH ( const wxString & aAlign)

◆ AlignToFontV()

int EASYEDAPRO::AlignToFontV ( const wxString & aAlign)

Map an EasyEDA "HORIZ_VERT" alignment token to a KiCad justify code (0 top/left, 1 center, 2 bottom/right).

Definition at line 83 of file sch_easyedapro_v3_parser.cpp.

Referenced by ApplyV3AttrToField(), SCH_EASYEDAPRO_V3_PARSER::ApplyV3FontStyle(), BOOST_AUTO_TEST_CASE(), and SCH_EASYEDAPRO_V3_PARSER::ParseSymbol().

◆ AnyMapToStringMap()

std::map< wxString, wxString > EASYEDAPRO::AnyMapToStringMap ( const std::map< wxString, nlohmann::json > & aInput)

◆ BuildV3BlobMap()

◆ BuildV3DeviceLibNames()

std::map< wxString, wxString > EASYEDAPRO::BuildV3DeviceLibNames ( nlohmann::json & aProject,
const std::map< wxString, PRJ_DEVICE > & aDevices,
std::set< wxString > * aUsedNames = nullptr )

Stable project-lib item names keyed by Device UUID (one entry per Device).

Also writes project["device_lib_names"] for place-time symbol LIB_ID lookup. When aUsedNames is non-null, it receives the allocated names (for orphan uniqueness).

Definition at line 772 of file easyedapro_import_utils.cpp.

References MakeUniqueLibName().

Referenced by SCH_IO_EASYEDAPRO_V3::LoadSchematicFile().

◆ BuildV3LibraryItemMap()

◆ BuildV3ProjectIndexFromRawDocs()

nlohmann::json EASYEDAPRO::BuildV3ProjectIndexFromRawDocs ( const V3_DOC_PARSER & aParser,
bool aIncludeLibraryMetadata = true )

Build a minimal legacy-style project index from parsed v3 raw documents.

The result is compatible with ProjectToSelectorDialog and legacy metadata readers, and contains at least schematics / boards / pcbs. When aIncludeLibraryMetadata is true, symbols / footprints / devices maps are also populated from their META rows.

Definition at line 424 of file easyedapro_import_utils.cpp.

References empty(), EASYEDAPRO::V3_DOC_PARSER::GetRawDocs(), info, name, NORMAL, project, ToStdString(), and V3GetString().

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

◆ BuildV3SymbolLibraryMap()

◆ FindJsonFile()

nlohmann::json EASYEDAPRO::FindJsonFile ( const wxString & aZipFileName,
const std::set< wxString > & aFileNames )

Definition at line 246 of file easyedapro_import_utils.cpp.

References _, name, THROW_IO_ERRORF, and zip.

Referenced by ReadProjectOrDeviceFile().

◆ ForEachImportedDeviceField()

void EASYEDAPRO::ForEachImportedDeviceField ( const std::map< wxString, wxString > & aDeviceAttributes,
bool aIncludeValue,
const std::function< void(const wxString &aKey, const wxString &aValue)> & aCallback )

Invoke aCallback for each non-empty whitelisted Device field (resolved + normalized).

When aIncludeValue is false, skips the Value key (callers often handle it separately).

Definition at line 850 of file easyedapro_import_utils.cpp.

References get_opt(), NormalizeEasyEDAText(), and ResolveDeviceFieldVariables().

Referenced by PCB_IO_EASYEDAPRO_V3_PARSER::ParseBoard(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDAPRO_V3_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDAPRO_V3_PARSER::ParseSymbol().

◆ from_json() [1/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::BLOB & d )

Definition at line 285 of file easyedapro_parser.cpp.

References EASYEDAPRO::BLOB::objectId, and EASYEDAPRO::BLOB::url.

◆ from_json() [2/14]

◆ from_json() [3/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::POURED & d )

◆ from_json() [4/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::PRJ_BOARD & d )

◆ from_json() [5/14]

◆ from_json() [6/14]

◆ from_json() [7/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::PRJ_SCHEMATIC & d )

◆ from_json() [8/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::PRJ_SHEET & d )

◆ from_json() [9/14]

◆ from_json() [10/14]

◆ from_json() [11/14]

◆ from_json() [12/14]

void EASYEDAPRO::from_json ( const nlohmann::json & j,
EASYEDAPRO::SCH_WIRE & d )

◆ from_json() [13/14]

◆ from_json() [14/14]

◆ GetV3DeviceData()

◆ GetV3LibraryItemTitle()

wxString EASYEDAPRO::GetV3LibraryItemTitle ( const nlohmann::json & aMetadata,
const wxString & aUuid )

◆ IterateZipFiles()

void EASYEDAPRO::IterateZipFiles ( const wxString & aFileName,
std::function< bool(const wxString &, const wxString &, wxInputStream &)> aCallback )

◆ KeywordsFromV3Tags()

wxString EASYEDAPRO::KeywordsFromV3Tags ( const nlohmann::json & aTags)

Build KiCad keywords from a v3 tags object (parent_tag / child_tag name fields).

Definition at line 659 of file easyedapro_import_utils.cpp.

References name, and V3GetString().

Referenced by SCH_IO_EASYEDAPRO_V3::LoadSchematicFile(), and LoadV3LibrarySymbolItem().

◆ LookupV3DeviceLibName()

wxString EASYEDAPRO::LookupV3DeviceLibName ( const nlohmann::json & aProject,
const wxString & aDeviceUuid )

◆ MakeUniqueLibName()

wxString EASYEDAPRO::MakeUniqueLibName ( std::set< wxString > & aUsedNames,
const wxString & aName,
const wxString & aFallback )

Allocate a unique library item name, recording it in aUsedNames.

Definition at line 757 of file easyedapro_import_utils.cpp.

Referenced by BuildV3DeviceLibNames(), PCB_IO_EASYEDAPRO_V3::LoadBoard(), and SCH_IO_EASYEDAPRO_V3::LoadSchematicFile().

◆ NormalizeEasyEDAText()

◆ ParseJsonLines()

std::vector< nlohmann::json > EASYEDAPRO::ParseJsonLines ( wxInputStream & aInput,
const wxString & aSource )

◆ ParseJsonLinesWithSeparation()

std::vector< std::vector< nlohmann::json > > EASYEDAPRO::ParseJsonLinesWithSeparation ( wxInputStream & aInput,
const wxString & aSource )

Multiple document types (e.g.

footprint and PCB) can be put into a single file, separated by empty line.

Definition at line 369 of file easyedapro_import_utils.cpp.

References traceEasyEdaIo.

Referenced by PCB_IO_EASYEDAPRO::LoadBoard().

◆ ProjectToSelectorDialog()

◆ ReadProjectOrDeviceFile()

◆ ResolveDeviceFieldVariables()

wxString EASYEDAPRO::ResolveDeviceFieldVariables ( const wxString & aInput,
const std::map< wxString, wxString > & aDeviceAttributes )

◆ ResolveV3DeviceValueText()

wxString EASYEDAPRO::ResolveV3DeviceValueText ( const std::map< wxString, wxString > & aDeviceAttributes)

Preferred Value text: Value attribute, else Name, with variables resolved.

Definition at line 839 of file easyedapro_import_utils.cpp.

References get_def(), NormalizeEasyEDAText(), and ResolveDeviceFieldVariables().

Referenced by PCB_IO_EASYEDAPRO_V3_PARSER::ParseBoard().

◆ ShortenLibName()

◆ ToKiCadLibID()

◆ V3GetBool()

◆ V3GetDouble()

◆ V3GetInt()

◆ V3GetString() [1/2]

◆ V3GetString() [2/2]

wxString EASYEDAPRO::V3GetString ( const nlohmann::json & aObj,
const wxString & aKey,
const wxString & aDefault )

Definition at line 93 of file easyedapro_v3_parser.cpp.

References ToStdString(), and V3GetString().

◆ V3IsNullOrMissing()

bool EASYEDAPRO::V3IsNullOrMissing ( const nlohmann::json & aObj,
const char * aKey )

◆ V3JsonToString()

◆ V3ParseIdArray()

nlohmann::json EASYEDAPRO::V3ParseIdArray ( const wxString & aId)

Definition at line 202 of file easyedapro_v3_parser.cpp.

References ToStdString().

Referenced by PCB_IO_EASYEDAPRO_V3_PARSER::ParseBoard().

Variable Documentation

◆ IMPORT_POURED

const bool EASYEDAPRO::IMPORT_POURED = true
static

◆ IMPORT_POURED_ECOP

const bool EASYEDAPRO::IMPORT_POURED_ECOP = false
static

Definition at line 41 of file easyedapro_parser.h.

Referenced by PCB_IO_EASYEDAPRO::LoadAllDataFromProject().