21#ifndef KICAD_DATABASE_LIB_SETTINGS_H
22#define KICAD_DATABASE_LIB_SETTINGS_H
65 bool aVisibleOnAdd,
bool aVisibleInChooser,
bool aShowName,
66 bool aInheritProperties );
68 void SetName(
const std::string& aName );
108 std::vector<DATABASE_FIELD_MAPPING>
fields;
145 void Load()
override;
151 bool Store()
override;
189 bool* aLoaded =
nullptr );
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
Read a model file and creates a generic display structure.
bool m_GloballyUniqueKeys
static DATABASE_LIB_TABLE tableFromJson(const nlohmann::json &aEntry)
Missing or mistyped keys load as defaults so one incomplete entry cannot stop the others.
void ResolvePassword(const DATABASE_SECRET_LOOKUP &aLookup=nullptr)
Fills in the source password from the keyring when the file has none.
virtual ~DATABASE_LIB_SETTINGS()
DATABASE_LIB_SETTINGS(const std::string &aFilename)
wxString getFileExt() const override
static DATABASE_FIELD_MAPPING fieldFromJson(const nlohmann::json &aEntry)
bool Store() override
Stores parameters, then restores the raw file value of every scalar the caller left unchanged so that...
std::string m_Description
std::vector< DATABASE_LIB_TABLE > m_Tables
static nlohmann::json tableToJson(const DATABASE_LIB_TABLE &aTable)
DATABASE_CACHE_SETTINGS m_Cache
static nlohmann::json fieldToJson(const DATABASE_FIELD_MAPPING &aField)
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
KICOMMON_API bool StoreDatabasePassword(const DATABASE_SOURCE &aSource, const std::string &aPassword)
Stores the password for the source's DSN login in the system keyring, or removes the entry when the p...
KICOMMON_API void ResolveDatabasePassword(DATABASE_SOURCE &aSource, const DATABASE_SECRET_LOOKUP &aLookup=nullptr)
Fills in the source password from the keyring, but only when the library file did not supply one.
KICOMMON_API wxString DefaultDatabaseLibFileName(const wxString &aLibName)
KICOMMON_API DATABASE_SECRET_LOOKUP DefaultDatabaseSecretLookup()
The lookup used when none is injected, which must never prompt to unlock the keyring.
std::function< bool(const wxString &aService, const wxString &aKey, wxString &aSecret)> DATABASE_SECRET_LOOKUP
Keyring lookup signature, matching KIPLATFORM::SECRETS::GetSecretNoPrompt.
KICOMMON_API bool GetDatabasePassword(const DATABASE_SOURCE &aSource, std::string &aPassword, const DATABASE_SECRET_LOOKUP &aLookup=nullptr)
DSN passwords that are not saved in the (often shared) library file live in the system keyring,...
KICOMMON_API bool IsNoPromptSecretLookup(const DATABASE_SECRET_LOOKUP &aLookup)
KICOMMON_API std::unique_ptr< DATABASE_LIB_SETTINGS > LoadDatabaseLibSettingsReadOnly(const wxString &aPath, bool *aLoaded=nullptr)
Loads a database library settings file without allowing the load itself (e.g.
int max_age
Max age of a cached table before it expires, in seconds.
int max_size
Maximum number of tables to cache, each holding the rows read from it.
bool visible_in_chooser
Whether the column is shown by default in the chooser.
std::string column
Database column name.
std::string name
KiCad field name.
void SetName(const std::string &aName)
bool inherit_properties
Whether or not to inherit properties from symbol field.
bool visible_on_add
Whether to show the field when placing the symbol.
bool show_name
Whether or not to show the field name as well as its value.
nlohmann::json source
Raw JSON as loaded; untouched keys are written back verbatim.
wxString name_wx
KiCad field name (converted)
Scalar settings as parsed at load, so Store() can tell which ones the caller changed.
DATABASE_CACHE_SETTINGS cache
A database library table will be mapped to a sub-library provided by the database library entry in th...
std::string key_col
Unique key column name (will form part of the LIB_ID)
std::string name
KiCad library nickname (will form part of the LIB_ID)
nlohmann::json source
Raw JSON as loaded; untouched keys are written back verbatim.
std::string symbols_col
Column name containing KiCad symbol refs.
std::string footprints_col
Column name containing KiCad footprint refs.
std::vector< DATABASE_FIELD_MAPPING > fields
std::string table
Database table to pull content from.
MAPPABLE_SYMBOL_PROPERTIES properties
std::string pins_col
Column name containing JSON pin assignments (optional)
std::string connection_string
DATABASE_SOURCE_TYPE type
std::string footprint_filters
std::string exclude_from_sim
bool operator==(const MAPPABLE_SYMBOL_PROPERTIES &aOther) const =default
std::string exclude_from_board
std::string exclude_from_bom