mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-14 15:59:36 +00:00
Cleanup creation of all our smart pointers
This commit is contained in:
parent
2e94be0855
commit
31e626f279
common
eeschema
class_library.cpp
dialogs
eeschema.cpplibarch.cppproject_rescue.cppsch_plugins
sheet.cppsim
symbol_lib_table.cppgerbview
pcb_calculator
pcbnew
class_dimension.cppclass_zone.cppfp_tree_model_adapter.cppgraphics_cleaner.cpp
import_gfx
netlist_reader
pcb_expr_evaluator.cpppcb_shape.cpppcbnew_printout.cppplugins
router
tracks_cleaner.cppqa/eeschema
@ -87,7 +87,7 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
|
||||
while( ( tok = in->NextTok() ) != T_RIGHT )
|
||||
{
|
||||
std::unique_ptr< FP_LIB_TABLE_ROW > row( new FP_LIB_TABLE_ROW );
|
||||
std::unique_ptr<FP_LIB_TABLE_ROW> row = std::make_unique<FP_LIB_TABLE_ROW>();
|
||||
|
||||
if( tok == T_EOF )
|
||||
in->Expecting( T_RIGHT );
|
||||
|
@ -690,7 +690,7 @@ void TREE_NODE::SetUop( int aOp, double aValue )
|
||||
{
|
||||
delete uop;
|
||||
|
||||
std::unique_ptr<VALUE> val( new VALUE( aValue ) );
|
||||
std::unique_ptr<VALUE> val = std::make_unique<VALUE>( aValue );
|
||||
uop = new UOP( aOp, std::move( val ) );
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ void TREE_NODE::SetUop( int aOp, const wxString& aValue, bool aStringIsWildcard
|
||||
{
|
||||
delete uop;
|
||||
|
||||
std::unique_ptr<VALUE> val( new VALUE( aValue, aStringIsWildcard ) );
|
||||
std::unique_ptr<VALUE> val = std::make_unique<VALUE>( aValue, aStringIsWildcard );
|
||||
uop = new UOP( aOp, std::move( val ) );
|
||||
}
|
||||
|
||||
@ -785,7 +785,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
|
||||
if( !m_tree )
|
||||
{
|
||||
std::unique_ptr<VALUE> val( new VALUE( 1.0 ) );
|
||||
std::unique_ptr<VALUE> val = std::make_unique<VALUE>( 1.0 );
|
||||
// Empty expression returns true
|
||||
aCode->AddOp( new UOP( TR_UOP_PUSH_VALUE, std::move(val) ) );
|
||||
return true;
|
||||
|
@ -219,7 +219,7 @@ bool PGM_BASE::InitPgm()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_settings_manager = std::unique_ptr<SETTINGS_MANAGER>( new SETTINGS_MANAGER );
|
||||
m_settings_manager = std::make_unique<SETTINGS_MANAGER>();
|
||||
|
||||
// Something got in the way of settings load: can't continue
|
||||
if( !m_settings_manager->IsOK() )
|
||||
|
@ -237,7 +237,7 @@ LIB_PART* PART_LIB::ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart )
|
||||
|
||||
PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
|
||||
{
|
||||
std::unique_ptr<PART_LIB> lib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) );
|
||||
std::unique_ptr<PART_LIB> lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
|
||||
|
||||
std::vector<LIB_PART*> parts;
|
||||
// This loads the library.
|
||||
|
@ -541,7 +541,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
|
||||
if( useScreen )
|
||||
{
|
||||
// Create a temporary sheet for recursion testing to prevent a possible recursion error.
|
||||
std::unique_ptr< SCH_SHEET> tmpSheet( new SCH_SHEET );
|
||||
std::unique_ptr< SCH_SHEET> tmpSheet = std::make_unique<SCH_SHEET>();
|
||||
tmpSheet->GetFields()[SHEETNAME] = m_fields->at( SHEETNAME );
|
||||
tmpSheet->GetFields()[SHEETFILENAME].SetText( nativeFileName.GetFullPath() );
|
||||
tmpSheet->SetScreen( useScreen );
|
||||
|
@ -62,7 +62,7 @@ namespace SCH {
|
||||
static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFilename )
|
||||
{
|
||||
auto pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD );
|
||||
std::unique_ptr<SCHEMATIC> schematic( new SCHEMATIC ( nullptr ) );
|
||||
std::unique_ptr<SCHEMATIC> schematic = std::make_unique<SCHEMATIC>( nullptr );
|
||||
|
||||
auto &manager = Pgm().GetSettingsManager();
|
||||
|
||||
@ -100,7 +100,7 @@ static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFil
|
||||
|
||||
bool generateSchematicNetlist( const wxString& aFilename, wxString& aNetlist )
|
||||
{
|
||||
std::unique_ptr<SCHEMATIC> schematic ( readSchematicFromFile( aFilename.ToStdString() ) );
|
||||
std::unique_ptr<SCHEMATIC> schematic = readSchematicFromFile( aFilename.ToStdString() );
|
||||
NETLIST_EXPORTER_KICAD exporter( schematic.get() );
|
||||
STRING_FORMATTER formatter;
|
||||
|
||||
|
@ -69,7 +69,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
||||
SCH_SCREENS screens( Schematic().Root() );
|
||||
|
||||
// Create a new empty library to archive components:
|
||||
std::unique_ptr<PART_LIB> archLib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) );
|
||||
std::unique_ptr<PART_LIB> archLib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
|
||||
|
||||
// Save symbols to file only when the library will be fully filled
|
||||
archLib->EnableBuffering();
|
||||
|
@ -643,8 +643,8 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
||||
{
|
||||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||
|
||||
std::unique_ptr<PART_LIB> rescue_lib(
|
||||
new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() ) );
|
||||
std::unique_ptr<PART_LIB> rescue_lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
fn.GetFullPath() );
|
||||
|
||||
m_rescue_lib = std::move( rescue_lib );
|
||||
m_rescue_lib->EnableBuffering();
|
||||
|
@ -556,7 +556,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
||||
|
||||
while( partNode )
|
||||
{
|
||||
std::unique_ptr<EPART> epart( new EPART( partNode ) );
|
||||
std::unique_ptr<EPART> epart = std::make_unique<EPART>( partNode );
|
||||
|
||||
// N.B. Eagle parts are case-insensitive in matching but we keep the display case
|
||||
m_partlist[epart->name.Upper()] = std::move( epart );
|
||||
@ -596,8 +596,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
||||
|
||||
while( sheetNode )
|
||||
{
|
||||
wxPoint pos = wxPoint( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
|
||||
std::unique_ptr<SCH_SHEET> sheet( new SCH_SHEET( m_rootSheet, pos ) );
|
||||
wxPoint pos = wxPoint( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
|
||||
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>( m_rootSheet, pos );
|
||||
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
|
||||
|
||||
sheet->SetScreen( screen );
|
||||
@ -964,7 +964,7 @@ void SCH_EAGLE_PLUGIN::loadSegments(
|
||||
|
||||
SCH_LINE* SCH_EAGLE_PLUGIN::loadWire( wxXmlNode* aWireNode )
|
||||
{
|
||||
std::unique_ptr<SCH_LINE> wire( new SCH_LINE );
|
||||
std::unique_ptr<SCH_LINE> wire = std::make_unique<SCH_LINE>();
|
||||
|
||||
auto ewire = EWIRE( aWireNode );
|
||||
|
||||
@ -989,7 +989,7 @@ SCH_LINE* SCH_EAGLE_PLUGIN::loadWire( wxXmlNode* aWireNode )
|
||||
|
||||
SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction )
|
||||
{
|
||||
std::unique_ptr<SCH_JUNCTION> junction( new SCH_JUNCTION );
|
||||
std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>();
|
||||
|
||||
auto ejunction = EJUNCTION( aJunction );
|
||||
wxPoint pos( ejunction.x.ToSchUnits(), -ejunction.y.ToSchUnits() );
|
||||
@ -1011,9 +1011,9 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN
|
||||
std::unique_ptr<SCH_TEXT> label;
|
||||
|
||||
if( global )
|
||||
label.reset( new SCH_GLOBALLABEL );
|
||||
label = std::make_unique<SCH_GLOBALLABEL>();
|
||||
else
|
||||
label.reset( new SCH_LABEL );
|
||||
label = std::make_unique<SCH_LABEL>();
|
||||
|
||||
label->SetPosition( elabelpos );
|
||||
label->SetText( escapeName( elabel.netname ) );
|
||||
@ -1131,7 +1131,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||
}
|
||||
|
||||
LIB_ID libId( getLibName(), kisymbolname );
|
||||
std::unique_ptr<SCH_COMPONENT> component( new SCH_COMPONENT() );
|
||||
std::unique_ptr<SCH_COMPONENT> component = std::make_unique<SCH_COMPONENT>();
|
||||
component->SetLibId( libId );
|
||||
component->SetUnit( unit );
|
||||
component->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
|
||||
@ -1596,7 +1596,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||
// if the wire is an arc
|
||||
if( ewire.curve )
|
||||
{
|
||||
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( aPart.get() ) );
|
||||
std::unique_ptr<LIB_ARC> arc = std::make_unique<LIB_ARC>( aPart.get() );
|
||||
wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 );
|
||||
|
||||
double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
|
||||
@ -1651,7 +1651,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart.get() ) );
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aPart.get() );
|
||||
|
||||
polyLine->AddPoint( begin );
|
||||
polyLine->AddPoint( end );
|
||||
@ -1666,7 +1666,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPolygonNode, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart.get() ) );
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aPart.get() );
|
||||
|
||||
EPOLYGON epoly( aPolygonNode );
|
||||
wxXmlNode* vertex = aPolygonNode->GetChildren();
|
||||
@ -1696,7 +1696,7 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
||||
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPin, EPIN* aEPin, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_PIN> pin( new LIB_PIN( aPart.get() ) );
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aPart.get() );
|
||||
pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
|
||||
pin->SetName( aEPin->name );
|
||||
pin->SetUnit( aGateNumber );
|
||||
@ -1799,7 +1799,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText(
|
||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aLibText, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_TEXT> libtext( new LIB_TEXT( aPart.get() ) );
|
||||
std::unique_ptr<LIB_TEXT> libtext = std::make_unique<LIB_TEXT>( aPart.get() );
|
||||
ETEXT etext( aLibText );
|
||||
|
||||
libtext->SetUnit( aGateNumber );
|
||||
@ -1823,8 +1823,8 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText(
|
||||
|
||||
SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText )
|
||||
{
|
||||
std::unique_ptr<SCH_TEXT> schtext( new SCH_TEXT() );
|
||||
ETEXT etext = ETEXT( aSchText );
|
||||
std::unique_ptr<SCH_TEXT> schtext = std::make_unique<SCH_TEXT>();
|
||||
ETEXT etext = ETEXT( aSchText );
|
||||
|
||||
const wxString& thetext = aSchText->GetNodeContent();
|
||||
schtext->SetText( thetext.IsEmpty() ? "\" \"" : escapeName( thetext ) );
|
||||
|
@ -129,7 +129,7 @@ LIB_PART* SCH_SEXPR_PARSER::ParseSymbol( LIB_PART_MAP& aSymbolLibMap, int aFileV
|
||||
wxString name;
|
||||
wxString error;
|
||||
LIB_ITEM* item;
|
||||
std::unique_ptr<LIB_PART> symbol( new LIB_PART( wxEmptyString ) );
|
||||
std::unique_ptr<LIB_PART> symbol = std::make_unique<LIB_PART>( wxEmptyString );
|
||||
|
||||
m_requiredVersion = aFileVersion;
|
||||
symbol->SetUnitCount( 1 );
|
||||
@ -722,7 +722,7 @@ void SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_PART>& aSymbol )
|
||||
wxString error;
|
||||
wxString name;
|
||||
wxString value;
|
||||
std::unique_ptr<LIB_FIELD> field( new LIB_FIELD( aSymbol.get(), MANDATORY_FIELDS ) );
|
||||
std::unique_ptr<LIB_FIELD> field = std::make_unique<LIB_FIELD>( aSymbol.get(), MANDATORY_FIELDS );
|
||||
|
||||
T token = NextTok();
|
||||
|
||||
@ -849,7 +849,7 @@ LIB_ARC* SCH_SEXPR_PARSER::parseArc()
|
||||
wxPoint pos;
|
||||
FILL_PARAMS fill;
|
||||
bool hasMidPoint = false;
|
||||
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( nullptr ) );
|
||||
std::unique_ptr<LIB_ARC> arc = std::make_unique<LIB_ARC>( nullptr );
|
||||
|
||||
arc->SetUnit( m_unit );
|
||||
arc->SetConvert( m_convert );
|
||||
@ -967,7 +967,7 @@ LIB_BEZIER* SCH_SEXPR_PARSER::parseBezier()
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<LIB_BEZIER> bezier( new LIB_BEZIER( nullptr ) );
|
||||
std::unique_ptr<LIB_BEZIER> bezier = std::make_unique<LIB_BEZIER>( nullptr );
|
||||
|
||||
bezier->SetUnit( m_unit );
|
||||
bezier->SetConvert( m_convert );
|
||||
@ -1032,7 +1032,7 @@ LIB_CIRCLE* SCH_SEXPR_PARSER::parseCircle()
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<LIB_CIRCLE> circle( new LIB_CIRCLE( nullptr ) );
|
||||
std::unique_ptr<LIB_CIRCLE> circle = std::make_unique<LIB_CIRCLE>( nullptr );
|
||||
|
||||
circle->SetUnit( m_unit );
|
||||
circle->SetConvert( m_convert );
|
||||
@ -1135,7 +1135,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
|
||||
T token;
|
||||
wxString tmp;
|
||||
wxString error;
|
||||
std::unique_ptr<LIB_PIN> pin( new LIB_PIN( nullptr ) );
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( nullptr );
|
||||
|
||||
pin->SetUnit( m_unit );
|
||||
pin->SetConvert( m_convert );
|
||||
@ -1309,7 +1309,7 @@ LIB_POLYLINE* SCH_SEXPR_PARSER::parsePolyLine()
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( nullptr ) );
|
||||
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( nullptr );
|
||||
|
||||
polyLine->SetUnit( m_unit );
|
||||
polyLine->SetConvert( m_convert );
|
||||
@ -1374,7 +1374,7 @@ LIB_RECTANGLE* SCH_SEXPR_PARSER::parseRectangle()
|
||||
|
||||
T token;
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<LIB_RECTANGLE> rectangle( new LIB_RECTANGLE( nullptr ) );
|
||||
std::unique_ptr<LIB_RECTANGLE> rectangle = std::make_unique<LIB_RECTANGLE>( nullptr );
|
||||
|
||||
rectangle->SetUnit( m_unit );
|
||||
rectangle->SetConvert( m_convert );
|
||||
@ -1432,7 +1432,7 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
|
||||
T token;
|
||||
wxString tmp;
|
||||
wxString error;
|
||||
std::unique_ptr<LIB_TEXT> text( new LIB_TEXT( nullptr ) );
|
||||
std::unique_ptr<LIB_TEXT> text = std::make_unique<LIB_TEXT>( nullptr );
|
||||
|
||||
text->SetUnit( m_unit );
|
||||
text->SetConvert( m_convert );
|
||||
@ -1674,7 +1674,7 @@ SCH_FIELD* SCH_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
|
||||
// Empty property values are valid.
|
||||
value = FromUTF8();
|
||||
|
||||
std::unique_ptr<SCH_FIELD> field( new SCH_FIELD( wxDefaultPosition, -1, aParent, name ) );
|
||||
std::unique_ptr<SCH_FIELD> field = std::make_unique<SCH_FIELD>( wxDefaultPosition, -1, aParent, name );
|
||||
|
||||
field->SetText( value );
|
||||
field->SetVisible( true );
|
||||
@ -1741,7 +1741,7 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
|
||||
THROW_IO_ERROR( error );
|
||||
}
|
||||
|
||||
std::unique_ptr<SCH_SHEET_PIN> sheetPin( new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), name ) );
|
||||
std::unique_ptr<SCH_SHEET_PIN> sheetPin = std::make_unique<SCH_SHEET_PIN>( aSheet, wxPoint( 0, 0 ), name );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
@ -2119,7 +2119,7 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
||||
wxString error;
|
||||
wxString libName;
|
||||
SCH_FIELD* field;
|
||||
std::unique_ptr<SCH_COMPONENT> symbol( new SCH_COMPONENT() );
|
||||
std::unique_ptr<SCH_COMPONENT> symbol = std::make_unique<SCH_COMPONENT>();
|
||||
TRANSFORM transform;
|
||||
std::set<int> fieldIDsRead;
|
||||
|
||||
@ -2331,7 +2331,7 @@ SCH_BITMAP* SCH_SEXPR_PARSER::parseImage()
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an image." ) );
|
||||
|
||||
T token;
|
||||
std::unique_ptr<SCH_BITMAP> bitmap( new SCH_BITMAP() );
|
||||
std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>();
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
@ -2404,7 +2404,7 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
|
||||
FILL_PARAMS fill;
|
||||
SCH_FIELD* field;
|
||||
std::vector<SCH_FIELD> fields;
|
||||
std::unique_ptr<SCH_SHEET> sheet( new SCH_SHEET() );
|
||||
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>();
|
||||
std::set<int> fieldIDsRead;
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
@ -2499,7 +2499,7 @@ SCH_JUNCTION* SCH_SEXPR_PARSER::parseJunction()
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a junction." ) );
|
||||
|
||||
T token;
|
||||
std::unique_ptr<SCH_JUNCTION> junction( new SCH_JUNCTION() );
|
||||
std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>();
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
@ -2549,7 +2549,7 @@ SCH_NO_CONNECT* SCH_SEXPR_PARSER::parseNoConnect()
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a no connect." ) );
|
||||
|
||||
T token;
|
||||
std::unique_ptr<SCH_NO_CONNECT> no_connect( new SCH_NO_CONNECT() );
|
||||
std::unique_ptr<SCH_NO_CONNECT> no_connect = std::make_unique<SCH_NO_CONNECT>();
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
@ -2581,7 +2581,7 @@ SCH_BUS_WIRE_ENTRY* SCH_SEXPR_PARSER::parseBusEntry()
|
||||
|
||||
T token;
|
||||
STROKE_PARAMS stroke;
|
||||
std::unique_ptr<SCH_BUS_WIRE_ENTRY> busEntry( new SCH_BUS_WIRE_ENTRY() );
|
||||
std::unique_ptr<SCH_BUS_WIRE_ENTRY> busEntry = std::make_unique<SCH_BUS_WIRE_ENTRY>();
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
@ -2626,7 +2626,7 @@ SCH_LINE* SCH_SEXPR_PARSER::parseLine()
|
||||
{
|
||||
T token;
|
||||
STROKE_PARAMS stroke;
|
||||
std::unique_ptr<SCH_LINE> line( new SCH_LINE() );
|
||||
std::unique_ptr<SCH_LINE> line = std::make_unique<SCH_LINE>();
|
||||
|
||||
switch( CurTok() )
|
||||
{
|
||||
@ -2688,10 +2688,10 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
||||
|
||||
switch( CurTok() )
|
||||
{
|
||||
case T_text: text.reset( new SCH_TEXT ); break;
|
||||
case T_label: text.reset( new SCH_LABEL ); break;
|
||||
case T_global_label: text.reset( new SCH_GLOBALLABEL ); break;
|
||||
case T_hierarchical_label: text.reset( new SCH_HIERLABEL ); break;
|
||||
case T_text: text = std::make_unique<SCH_TEXT>(); break;
|
||||
case T_label: text = std::make_unique<SCH_LABEL>(); break;
|
||||
case T_global_label: text = std::make_unique<SCH_GLOBALLABEL>(); break;
|
||||
case T_hierarchical_label: text = std::make_unique<SCH_HIERLABEL>(); break;
|
||||
default:
|
||||
wxCHECK_MSG( false, nullptr,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as text." ) );
|
||||
@ -2783,7 +2783,7 @@ void SCH_SEXPR_PARSER::parseBusAlias( SCH_SCREEN* aScreen )
|
||||
wxCHECK( aScreen, /* void */ );
|
||||
|
||||
T token;
|
||||
auto busAlias = std::make_shared< BUS_ALIAS >( aScreen );
|
||||
auto busAlias = std::make_shared<BUS_ALIAS>( aScreen );
|
||||
|
||||
NeedSYMBOL();
|
||||
busAlias->SetName( FromUTF8() );
|
||||
|
@ -431,7 +431,7 @@ SCH_SHEET* SCH_SEXPR_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema
|
||||
if( aAppendToMe == NULL )
|
||||
{
|
||||
// Clean up any allocated memory if an exception occurs loading the schematic.
|
||||
std::unique_ptr< SCH_SHEET > newSheet( new SCH_SHEET( aSchematic ) );
|
||||
std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( aSchematic );
|
||||
newSheet->SetFileName( aFileName );
|
||||
m_rootSheet = newSheet.get();
|
||||
loadHierarchy( newSheet.get() );
|
||||
@ -1481,7 +1481,7 @@ void SCH_SEXPR_PLUGIN_CACHE::Save()
|
||||
// Write through symlinks, don't replace them.
|
||||
wxFileName fn = GetRealFile();
|
||||
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER > formatter( new FILE_OUTPUTFORMATTER( fn.GetFullPath() ) );
|
||||
auto formatter = std::make_unique<FILE_OUTPUTFORMATTER>( fn.GetFullPath() );
|
||||
|
||||
formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator kicad_symbol_editor)\n",
|
||||
SEXPR_SYMBOL_LIB_FILE_VERSION );
|
||||
|
@ -632,7 +632,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
|
||||
if( aAppendToMe == NULL )
|
||||
{
|
||||
// Clean up any allocated memory if an exception occurs loading the schematic.
|
||||
std::unique_ptr< SCH_SHEET > newSheet( new SCH_SHEET( aSchematic ) );
|
||||
std::unique_ptr<SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( aSchematic );
|
||||
newSheet->SetFileName( aFileName );
|
||||
m_rootSheet = newSheet.get();
|
||||
loadHierarchy( newSheet.get() );
|
||||
@ -970,7 +970,7 @@ void SCH_LEGACY_PLUGIN::loadPageSettings( LINE_READER& aReader, SCH_SCREEN* aScr
|
||||
|
||||
SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||
{
|
||||
std::unique_ptr< SCH_SHEET > sheet( new SCH_SHEET() );
|
||||
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>();
|
||||
|
||||
const char* line = aReader.ReadLine();
|
||||
|
||||
@ -1018,7 +1018,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||
else // Sheet pin.
|
||||
{
|
||||
// Use a unique_ptr so that we clean up in the case of a throw
|
||||
std::unique_ptr< SCH_SHEET_PIN > sheetPin( new SCH_SHEET_PIN( sheet.get() ) );
|
||||
std::unique_ptr<SCH_SHEET_PIN> sheetPin = std::make_unique<SCH_SHEET_PIN>( sheet.get() );
|
||||
|
||||
sheetPin->SetNumber( fieldId );
|
||||
|
||||
@ -1080,7 +1080,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||
|
||||
SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
|
||||
{
|
||||
std::unique_ptr< SCH_BITMAP > bitmap( new SCH_BITMAP );
|
||||
std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>();
|
||||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
@ -1165,7 +1165,7 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
|
||||
|
||||
SCH_JUNCTION* SCH_LEGACY_PLUGIN::loadJunction( LINE_READER& aReader )
|
||||
{
|
||||
std::unique_ptr< SCH_JUNCTION > junction( new SCH_JUNCTION );
|
||||
std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>();
|
||||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
@ -1187,7 +1187,7 @@ SCH_JUNCTION* SCH_LEGACY_PLUGIN::loadJunction( LINE_READER& aReader )
|
||||
|
||||
SCH_NO_CONNECT* SCH_LEGACY_PLUGIN::loadNoConnect( LINE_READER& aReader )
|
||||
{
|
||||
std::unique_ptr< SCH_NO_CONNECT > no_connect( new SCH_NO_CONNECT );
|
||||
std::unique_ptr<SCH_NO_CONNECT> no_connect = std::make_unique<SCH_NO_CONNECT>();
|
||||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
@ -1209,7 +1209,7 @@ SCH_NO_CONNECT* SCH_LEGACY_PLUGIN::loadNoConnect( LINE_READER& aReader )
|
||||
|
||||
SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
|
||||
{
|
||||
std::unique_ptr< SCH_LINE > wire( new SCH_LINE );
|
||||
std::unique_ptr<SCH_LINE> wire = std::make_unique<SCH_LINE>();
|
||||
|
||||
const char* line = aReader.Line();
|
||||
|
||||
@ -1311,18 +1311,18 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
|
||||
|
||||
wxCHECK( strCompare( "Entry", line, &line ), NULL );
|
||||
|
||||
std::unique_ptr< SCH_BUS_ENTRY_BASE > busEntry;
|
||||
std::unique_ptr<SCH_BUS_ENTRY_BASE> busEntry;
|
||||
|
||||
if( strCompare( "Wire", line, &line ) )
|
||||
{
|
||||
busEntry.reset( new SCH_BUS_WIRE_ENTRY );
|
||||
busEntry = std::make_unique<SCH_BUS_WIRE_ENTRY>();
|
||||
|
||||
if( !strCompare( "Line", line, &line ) )
|
||||
SCH_PARSE_ERROR( "invalid bus entry definition expected 'Line'", aReader, line );
|
||||
}
|
||||
else if( strCompare( "Bus", line, &line ) )
|
||||
{
|
||||
busEntry.reset( new SCH_BUS_BUS_ENTRY );
|
||||
busEntry = std::make_unique<SCH_BUS_BUS_ENTRY>();
|
||||
|
||||
if( !strCompare( "Bus", line, &line ) )
|
||||
SCH_PARSE_ERROR( "invalid bus entry definition expected 'Bus'", aReader, line );
|
||||
@ -1367,7 +1367,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
|
||||
|
||||
wxCHECK( strCompare( "Text", line, &line ), NULL );
|
||||
|
||||
std::unique_ptr< SCH_TEXT> text;
|
||||
std::unique_ptr<SCH_TEXT> text;
|
||||
|
||||
if( strCompare( "Notes", line, &line ) )
|
||||
text.reset( new SCH_TEXT );
|
||||
@ -1379,9 +1379,9 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
|
||||
{
|
||||
// Prior to version 2, the SCH_GLOBALLABEL object did not exist.
|
||||
if( m_version == 1 )
|
||||
text.reset( new SCH_HIERLABEL );
|
||||
text = std::make_unique<SCH_HIERLABEL>();
|
||||
else
|
||||
text.reset( new SCH_GLOBALLABEL );
|
||||
text = std::make_unique<SCH_GLOBALLABEL>();
|
||||
}
|
||||
else
|
||||
SCH_PARSE_ERROR( "unknown Text type", aReader, line );
|
||||
@ -1484,7 +1484,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
|
||||
|
||||
wxCHECK( strCompare( "$Comp", line, &line ), NULL );
|
||||
|
||||
std::unique_ptr< SCH_COMPONENT > component( new SCH_COMPONENT() );
|
||||
std::unique_ptr<SCH_COMPONENT> component = std::make_unique<SCH_COMPONENT>();
|
||||
|
||||
line = aReader.ReadLine();
|
||||
|
||||
@ -1796,7 +1796,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( LINE_READER& aReader )
|
||||
std::shared_ptr<BUS_ALIAS> SCH_LEGACY_PLUGIN::loadBusAlias( LINE_READER& aReader,
|
||||
SCH_SCREEN* aScreen )
|
||||
{
|
||||
auto busAlias = std::make_shared< BUS_ALIAS >( aScreen );
|
||||
auto busAlias = std::make_shared<BUS_ALIAS>( aScreen );
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK( strCompare( "BusAlias", line, &line ), NULL );
|
||||
@ -2789,7 +2789,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||
SCH_PARSE_ERROR( "invalid symbol definition", aReader, line );
|
||||
|
||||
// Read DEF line:
|
||||
std::unique_ptr< LIB_PART > part( new LIB_PART( wxEmptyString ) );
|
||||
std::unique_ptr<LIB_PART> part = std::make_unique<LIB_PART>( wxEmptyString );
|
||||
|
||||
wxString name, prefix, tmp;
|
||||
|
||||
@ -3727,7 +3727,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Save( bool aSaveDocFile )
|
||||
// Write through symlinks, don't replace them
|
||||
wxFileName fn = GetRealFile();
|
||||
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER > formatter( new FILE_OUTPUTFORMATTER( fn.GetFullPath() ) );
|
||||
auto formatter = std::make_unique<FILE_OUTPUTFORMATTER>( fn.GetFullPath() );
|
||||
formatter->Print( 0, "%s %d.%d\n", LIBFILE_IDENT, LIB_VERSION_MAJOR, LIB_VERSION_MINOR );
|
||||
formatter->Print( 0, "#encoding utf-8\n");
|
||||
|
||||
|
@ -112,7 +112,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
||||
SCH_SCREEN* currentScreen = aHierarchy->LastScreen();
|
||||
SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromSchPath( aFileName );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( schFileType ) );
|
||||
std::unique_ptr< SCH_SHEET> newSheet( new SCH_SHEET( &Schematic() ) );
|
||||
std::unique_ptr< SCH_SHEET> newSheet = std::make_unique<SCH_SHEET>( &Schematic() );
|
||||
|
||||
// This will cause the sheet UUID to be set to the loaded schematic UUID. This is required
|
||||
// to ensure all of the sheet paths in any subsheets are correctly generated.
|
||||
|
@ -33,7 +33,7 @@ std::shared_ptr<SPICE_SIMULATOR> SPICE_SIMULATOR::CreateInstance( const std::str
|
||||
static std::shared_ptr<SPICE_SIMULATOR> ngspiceInstance;
|
||||
|
||||
if( !ngspiceInstance )
|
||||
ngspiceInstance.reset( new NGSPICE );
|
||||
ngspiceInstance = std::make_shared<NGSPICE>();
|
||||
|
||||
return ngspiceInstance;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||
|
||||
while( ( tok = in->NextTok() ) != T_RIGHT )
|
||||
{
|
||||
std::unique_ptr< SYMBOL_LIB_TABLE_ROW > row( new SYMBOL_LIB_TABLE_ROW );
|
||||
std::unique_ptr< SYMBOL_LIB_TABLE_ROW > row = std::make_unique<SYMBOL_LIB_TABLE_ROW>();
|
||||
|
||||
if( tok == T_EOF )
|
||||
in->Expecting( T_RIGHT );
|
||||
|
@ -105,5 +105,5 @@ EDA_RECT GERBVIEW_PRINTOUT::getBoundingBox()
|
||||
|
||||
std::unique_ptr<KIGFX::PAINTER> GERBVIEW_PRINTOUT::getPainter( KIGFX::GAL* aGal )
|
||||
{
|
||||
return std::unique_ptr<KIGFX::PAINTER>( new KIGFX::GERBVIEW_PAINTER( aGal ) );
|
||||
return std::make_unique<KIGFX::GERBVIEW_PAINTER>( aGal );
|
||||
}
|
||||
|
@ -86,8 +86,7 @@ bool PCB_CALCULATOR_FRAME::WriteDataFile()
|
||||
// Switch the locale to standard C (needed to read/write floating point numbers)
|
||||
LOCALE_IO toggle;
|
||||
|
||||
std::unique_ptr<PCB_CALCULATOR_DATAFILE>
|
||||
datafile( new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ) );
|
||||
auto datafile = std::make_unique<PCB_CALCULATOR_DATAFILE>( &m_RegulatorList );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -387,7 +387,7 @@ std::vector<SHAPE*> DIMENSION::MakeEffectiveShapes() const
|
||||
|
||||
std::shared_ptr<SHAPE> DIMENSION::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
|
||||
{
|
||||
return std::shared_ptr<SHAPE>( new SHAPE_COMPOUND( MakeEffectiveShapes() ) );
|
||||
return std::make_shared<SHAPE_COMPOUND>( MakeEffectiveShapes() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ std::shared_ptr<SHAPE> ZONE_CONTAINER::GetEffectiveShape( PCB_LAYER_ID aLayer )
|
||||
|
||||
if( m_FilledPolysList.find( aLayer ) == m_FilledPolysList.end() )
|
||||
{
|
||||
shape.reset( new SHAPE_NULL );
|
||||
shape = std::make_shared<SHAPE_NULL>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ std::vector<LIB_TREE_ITEM*> FP_TREE_MODEL_ADAPTER::getFootprints( const wxString
|
||||
|
||||
auto fullListStart = GFootprintList.GetList().begin();
|
||||
auto fullListEnd = GFootprintList.GetList().end();
|
||||
std::unique_ptr<FOOTPRINT_INFO> dummy( new FOOTPRINT_INFO_IMPL( aLibName, wxEmptyString ) );
|
||||
std::unique_ptr<FOOTPRINT_INFO> dummy = std::make_unique<FOOTPRINT_INFO_IMPL>( aLibName, wxEmptyString );
|
||||
|
||||
// List is sorted, so use a binary search to find the range of footnotes for our library
|
||||
auto libBounds = std::equal_range( fullListStart, fullListEnd, dummy,
|
||||
|
@ -145,7 +145,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
|
||||
|
||||
if( isNullSegment( segment ) )
|
||||
{
|
||||
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_NULL_GRAPHIC ) );
|
||||
std::shared_ptr<CLEANUP_ITEM> item = std::make_shared<CLEANUP_ITEM>( CLEANUP_NULL_GRAPHIC );
|
||||
item->SetItems( segment );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
@ -164,7 +164,7 @@ void GRAPHICS_CLEANER::cleanupSegments()
|
||||
|
||||
if( areEquivalent( segment, segment2 ) )
|
||||
{
|
||||
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_DUPLICATE_GRAPHIC ) );
|
||||
std::shared_ptr<CLEANUP_ITEM> item = std::make_shared<CLEANUP_ITEM>( CLEANUP_DUPLICATE_GRAPHIC );
|
||||
item->SetItems( segment2 );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
@ -292,7 +292,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
||||
right->shape->SetFlags( IS_DELETED );
|
||||
bottom->shape->SetFlags( IS_DELETED );
|
||||
|
||||
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_LINES_TO_RECT ) );
|
||||
std::shared_ptr<CLEANUP_ITEM> item = std::make_shared<CLEANUP_ITEM>( CLEANUP_LINES_TO_RECT );
|
||||
item->SetItems( left->shape, top->shape, right->shape, bottom->shape );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
|
@ -30,7 +30,7 @@ using namespace std;
|
||||
template <typename T, typename... Args>
|
||||
static std::unique_ptr<T> make_shape( const Args&... aArguments )
|
||||
{
|
||||
return std::unique_ptr<T>( new T( aArguments... ) );
|
||||
return std::make_unique<T>( aArguments... );
|
||||
}
|
||||
|
||||
void GRAPHICS_IMPORTER_BUFFER::AddLine( const VECTOR2D& aStart, const VECTOR2D& aEnd, double aWidth )
|
||||
|
@ -189,7 +189,7 @@ std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> GRAPHICS_IMPORTER_BOARD::creat
|
||||
|
||||
std::unique_ptr<PCB_SHAPE> GRAPHICS_IMPORTER_MODULE::createDrawing()
|
||||
{
|
||||
return std::unique_ptr<PCB_SHAPE>( new FP_SHAPE( m_module ) );
|
||||
return std::make_unique<FP_SHAPE>( m_module );
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ NETLIST_READER* NETLIST_READER::GetNetlistReader( NETLIST* aNetlist,
|
||||
{
|
||||
wxASSERT( aNetlist != NULL );
|
||||
|
||||
std::unique_ptr< FILE_LINE_READER > file_rdr(new FILE_LINE_READER( aNetlistFileName ) );
|
||||
std::unique_ptr<FILE_LINE_READER> file_rdr = std::make_unique<FILE_LINE_READER>( aNetlistFileName );
|
||||
|
||||
NETLIST_FILE_T type = GuessNetlistFileType( file_rdr.get() );
|
||||
file_rdr->Rewind();
|
||||
|
@ -585,21 +585,13 @@ std::unique_ptr<LIBEVAL::VAR_REF> PCB_EXPR_UCODE::CreateVarRef( const wxString&
|
||||
std::unique_ptr<PCB_EXPR_VAR_REF> vref;
|
||||
|
||||
if( aVar == "A" )
|
||||
{
|
||||
vref.reset( new PCB_EXPR_VAR_REF( 0 ) );
|
||||
}
|
||||
vref = std::make_unique<PCB_EXPR_VAR_REF>( 0 );
|
||||
else if( aVar == "B" )
|
||||
{
|
||||
vref.reset( new PCB_EXPR_VAR_REF( 1 ) );
|
||||
}
|
||||
vref = std::make_unique<PCB_EXPR_VAR_REF>( 1 );
|
||||
else if( aVar == "L" )
|
||||
{
|
||||
vref.reset( new PCB_EXPR_VAR_REF( 2 ) );
|
||||
}
|
||||
vref = std::make_unique<PCB_EXPR_VAR_REF>( 2 );
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( aField.length() == 0 ) // return reference to base object
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user