20#ifndef IMPORT_PROJ_PROPERTIES_H
21#define IMPORT_PROJ_PROPERTIES_H
61inline wxString
JoinList(
const wxArrayString& aItems )
67inline std::vector<wxString>
SplitList(
const wxString& aValue )
69 std::vector<wxString> out;
71 for(
const wxString& item : wxSplit( aValue,
LIST_SEPARATOR,
'\0' ) )
74 out.push_back( item );
90 for(
const auto& [source, target] : aNames )
100inline std::optional<std::map<wxString, wxString>>
SplitNetNameMap(
const wxString& aValue )
104 if( fields.IsEmpty() || fields[0] !=
NET_NAME_MAP_TAG || fields.GetCount() % 2 == 0 )
107 std::map<wxString, wxString> names;
109 for(
size_t i = 1; i < fields.GetCount(); i += 2 )
110 names.emplace( fields[i], fields[i + 1] );
117 std::vector<wxString>& aSourceFpLibs )
123 aCacheNickname = it->second.wx_str();
125 if(
auto it = aProps->find(
SOURCE_FP_LIBS ); it != aProps->end() )
126 aSourceFpLibs =
SplitList( it->second.wx_str() );
130inline void ReadSymbolProps(
const std::map<std::string, UTF8>* aProps, wxString& aCacheNickname,
131 std::vector<wxString>& aSourceSymLibs )
137 aCacheNickname = it->second.wx_str();
140 aSourceSymLibs =
SplitList( it->second.wx_str() );
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib)
Replace illegal LIB_ID item name characters with underscores '_'.
Property keys and codec threaded through IMPORT_PROJ_HELPER::m_properties to coordinate a non-KiCad p...
void ReadSymbolProps(const std::map< std::string, UTF8 > *aProps, wxString &aCacheNickname, std::vector< wxString > &aSourceSymLibs)
Read the symbol-import coordination properties out of a properties map.
wxString ManagedCacheOption()
Options string identifying a library-table row as a generated import cache.
constexpr char SOURCE_FP_LIBS[]
constexpr char MANAGED_CACHE_KEY[]
Library-table row option key marking a row as a generated import cache.
constexpr char SYM_CACHE_NICKNAME[]
constexpr char FP_CACHE_NICKNAME[]
wxString JoinList(const wxArrayString &aItems)
Encode library nicknames into a single list-property value.
wxString JoinNetNameMap(const std::map< wxString, wxString > &aNames)
Encode source-to-imported net names as a single property value.
wxString MakeCacheNickname(const wxString &aStem)
Derive the generated footprint-cache nickname from a project or file stem.
constexpr char NET_NAME_MAP_TAG[]
Leading field marking a value as an encoded net-name map, so a design that maps no nets is still dist...
wxString MakeSymbolCacheNickname(const wxString &aStem)
Derive the generated symbol-cache nickname from a project or file stem.
constexpr char LIST_SEPARATOR
Separator joining a list value within a single property.
std::vector< wxString > SplitList(const wxString &aValue)
Decode a list-property value back into nicknames, dropping empties.
std::optional< std::map< wxString, wxString > > SplitNetNameMap(const wxString &aValue)
Decode a net-name map property value, or nothing when the value is not one.
constexpr char SOURCE_SYM_LIBS[]
constexpr char NET_NAME_MAP[]
void ReadFootprintProps(const std::map< std::string, UTF8 > *aProps, wxString &aCacheNickname, std::vector< wxString > &aSourceFpLibs)
Read the footprint-import coordination properties out of a properties map.