JSON_SETTINGS: Provide explicit CloneFrom

This commit is contained in:
Jon Evans 2021-07-05 12:26:14 -04:00
parent 515669284a
commit 3f55093bff
2 changed files with 8 additions and 2 deletions

View File

@ -270,7 +270,7 @@ bool COLOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
return false;
}
#include <iostream>
bool COLOR_SETTINGS::migrateSchema0to1()
{
/**
@ -298,7 +298,7 @@ bool COLOR_SETTINGS::migrateSchema0to1()
COLOR_SETTINGS* fpsettings = m_manager->AddNewColorSettings( filename );
// Start out with a clone
fpsettings->Set( "", At( "" ) );
fpsettings->m_internals->CloneFrom( *m_internals );
// Footprint editor now just looks at the "board" namespace
fpsettings->Set( "board", fpsettings->At( "fpedit" ) );

View File

@ -62,6 +62,12 @@ public:
{
return nlohmann::json::operator[]( PointerFromString( aPath ) );
}
void CloneFrom( const JSON_SETTINGS_INTERNALS& aOther )
{
nlohmann::json::json_pointer root( "" );
this->nlohmann::json::operator[]( root ) = aOther.nlohmann::json::operator[]( root );
}
};
#endif // KICAD_JSON_SETTINGS_INTERNALS_H