Replaced std::auto_ptr by std::unique_ptr because the latter is deprecated

This commit is contained in:
Matthias Koefferlein
2021-01-23 21:55:51 +01:00
parent a1ace443f7
commit d1e6845ae4
131 changed files with 626 additions and 624 deletions
+1 -1
View File
@@ -281,7 +281,7 @@ LayoutHandle::update_save_options (db::SaveLayoutOptions &options)
continue;
}
std::auto_ptr<db::FormatSpecificWriterOptions> specific_options;
std::unique_ptr<db::FormatSpecificWriterOptions> specific_options;
if (options.get_options (decl->format_name ())) {
specific_options.reset (options.get_options (decl->format_name ())->clone ());
} else {
@@ -48,7 +48,7 @@ private slots:
void cursor_position_changed ();
private:
std::auto_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
std::unique_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
};
}
+1 -1
View File
@@ -445,7 +445,7 @@ private:
bool m_editable;
db::PropertiesRepository *mp_prep;
Ui::UserPropertiesForm *mp_ui;
std::auto_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
std::unique_ptr<lay::GenericSyntaxHighlighterAttributes> mp_hl_attributes, mp_hl_basic_attributes;
};
/**
+1 -1
View File
@@ -200,7 +200,7 @@ Dispatcher::write_config (const std::string &config_file)
bool
Dispatcher::read_config (const std::string &config_file)
{
std::auto_ptr<tl::XMLFileSource> file;
std::unique_ptr<tl::XMLFileSource> file;
try {
file.reset (new tl::XMLFileSource (config_file));
+3 -3
View File
@@ -90,7 +90,7 @@ Editables::~Editables ()
void
Editables::del (db::Transaction *transaction)
{
std::auto_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Delete"))));
std::unique_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Delete"))));
if (has_selection ()) {
@@ -168,7 +168,7 @@ Editables::selection_catch_bbox ()
void
Editables::transform (const db::DCplxTrans &tr, db::Transaction *transaction)
{
std::auto_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Transform"))));
std::unique_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Transform"))));
if (has_selection ()) {
@@ -594,7 +594,7 @@ Editables::move_transform (const db::DPoint &p, db::DFTrans t, lay::angle_constr
void
Editables::end_move (const db::DPoint &p, lay::angle_constraint_type ac, db::Transaction *transaction)
{
std::auto_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Move"))));
std::unique_ptr<db::Transaction> trans_holder (transaction ? transaction : new db::Transaction (manager (), tl::to_string (QObject::tr ("Move"))));
if (m_any_move_operation) {
@@ -1633,7 +1633,7 @@ GenericSyntaxHighlighter::highlightBlock(const QString &text)
int end_index = 0, last_index= -1;
int attribute_id = 0, def_attribute_id = 0;
std::auto_ptr<SyntaxHighlighterUserData> user_data (new SyntaxHighlighterUserData ());
std::unique_ptr<SyntaxHighlighterUserData> user_data (new SyntaxHighlighterUserData ());
while (std::max (0, index) < text.length ()) {
@@ -306,7 +306,7 @@ private:
QColor m_text_color;
tl::DeferredMethod<HierarchyControlPanel> m_do_update_content_dm;
tl::DeferredMethod<HierarchyControlPanel> m_do_full_update_content_dm;
std::auto_ptr<QStyle> mp_tree_style;
std::unique_ptr<QStyle> mp_tree_style;
// locate the CellTreeItem in the tree corresponding to a partial path starting from p.
CellTreeItem *find_child_item (cell_path_type::const_iterator start, cell_path_type::const_iterator end, CellTreeItem *p);
+1 -1
View File
@@ -336,7 +336,7 @@ public slots:
private:
QTabBar *mp_tab_bar;
LCPTreeWidget *mp_layer_list;
std::auto_ptr<QStyle> mp_ll_style;
std::unique_ptr<QStyle> mp_ll_style;
LayerTreeModel *mp_model;
lay::LayoutView *mp_view;
bool m_needs_update;
+1 -1
View File
@@ -5288,7 +5288,7 @@ LayoutView::paste_interactive ()
{
clear_selection ();
std::auto_ptr<db::Transaction> trans (new db::Transaction (manager (), tl::to_string (QObject::tr ("Paste and move"))));
std::unique_ptr<db::Transaction> trans (new db::Transaction (manager (), tl::to_string (QObject::tr ("Paste and move"))));
{
// let the receivers sort out who is pasting what ..
+1 -1
View File
@@ -250,7 +250,7 @@ private:
QColor m_text_color;
tl::DeferredMethod<LibrariesView> m_do_update_content_dm;
tl::DeferredMethod<LibrariesView> m_do_full_update_content_dm;
std::auto_ptr<QStyle> mp_tree_style;
std::unique_ptr<QStyle> mp_tree_style;
std::vector<tl::weak_ptr<db::Library> > m_libraries;
// event listener for changes in the cellview and layout
+2 -2
View File
@@ -247,7 +247,7 @@ MoveService::begin_move (db::Transaction *transaction, bool selected_after_move)
return false;
}
std::auto_ptr<db::Transaction> trans_holder (transaction);
std::unique_ptr<db::Transaction> trans_holder (transaction);
bool drag_transient = ! selected_after_move;
if (! mp_editables->has_selection ()) {
@@ -286,7 +286,7 @@ MoveService::begin_move (db::Transaction *transaction, bool selected_after_move)
bool
MoveService::handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction)
{
std::auto_ptr<db::Transaction> trans_holder (transaction);
std::unique_ptr<db::Transaction> trans_holder (transaction);
if (! m_dragging) {
+1 -1
View File
@@ -71,7 +71,7 @@ private:
double m_global_grid;
db::DPoint m_shift;
db::DPoint m_mouse_pos;
std::auto_ptr<db::Transaction> mp_transaction;
std::unique_ptr<db::Transaction> mp_transaction;
};
}
@@ -377,14 +377,14 @@ private:
db::LayoutToNetlist *mp_l2ndb;
db::LayoutVsSchematic *mp_lvsdb;
NetColorizer *mp_colorizer;
std::auto_ptr<IndexedNetlistModel> mp_indexer;
std::unique_ptr<IndexedNetlistModel> mp_indexer;
mutable std::map<lay::color_t, QIcon> m_net_icon_per_color;
mutable std::map<lay::color_t, QIcon> m_connection_icon_per_color;
int m_object_column;
int m_status_column;
int m_first_column;
int m_second_column;
std::auto_ptr<NetlistModelItemData> mp_root;
std::unique_ptr<NetlistModelItemData> mp_root;
RootItemData *root () const;
};
@@ -1381,7 +1381,7 @@ NetlistBrowserPage::export_nets (const std::vector<const db::Net *> *nets)
const db::Cell &source_top = source_layout.cell (*source_layout.begin_top_down ());
std::auto_ptr<lay::NetExportDialog> dialog (new lay::NetExportDialog (this));
std::unique_ptr<lay::NetExportDialog> dialog (new lay::NetExportDialog (this));
if (dialog->exec_dialog (mp_plugin_root)) {
// NOTE: mp_view and database might get reset to 0 in create_layout
@@ -93,7 +93,7 @@ private:
db::LayoutToNetlist *mp_l2ndb;
db::LayoutVsSchematic *mp_lvsdb;
std::auto_ptr<IndexedNetlistModel> mp_indexer;
std::unique_ptr<IndexedNetlistModel> mp_indexer;
mutable std::map<std::pair<const db::Circuit *, const db::Circuit *>, QModelIndex> m_circuits_to_index;
int m_object_column;
int m_status_column;
+1 -1
View File
@@ -123,7 +123,7 @@ private:
QMutex m_initial_wait_lock;
QWaitCondition m_initial_wait_cond;
std::auto_ptr<tl::SelfTimer> m_main_timer;
std::unique_ptr<tl::SelfTimer> m_main_timer;
};
}
@@ -1265,7 +1265,7 @@ RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type c
return;
}
std::auto_ptr<lay::Bitmap> opt_bitmap;
std::unique_ptr<lay::Bitmap> opt_bitmap;
lay::Bitmap *vertex_bitmap = dynamic_cast<lay::Bitmap *> (vertex);
if (m_text_lazy_rendering && vertex_bitmap) {
opt_bitmap.reset (new lay::Bitmap (vertex_bitmap->width (), vertex_bitmap->height (), vertex_bitmap->resolution ()));
@@ -244,7 +244,7 @@ private:
std::vector<std::pair<unsigned int, lay::CanvasPlane *> > m_buffers;
unsigned int m_test_count;
tl::Clock m_clock;
std::auto_ptr<lay::Renderer> mp_renderer;
std::unique_ptr<lay::Renderer> mp_renderer;
};
}
@@ -220,7 +220,7 @@ SaveLayoutOptionsDialog::update ()
db::FormatSpecificWriterOptions *specific_options = m_opt_array [m_technology_index].get_options (page->second);
if (! specific_options) {
// Create a container for the options unless there is one already
std::auto_ptr<db::FormatSpecificWriterOptions> new_options (StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options ());
std::unique_ptr<db::FormatSpecificWriterOptions> new_options (StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options ());
page->first->setup (new_options.get (), m_tech_array [m_technology_index]);
} else {
page->first->setup (specific_options, m_tech_array [m_technology_index]);
@@ -385,7 +385,7 @@ SaveLayoutAsOptionsDialog::ok_button_pressed ()
for (std::vector< std::pair<StreamWriterOptionsPage *, std::string> >::iterator page = m_pages.begin (); page != m_pages.end (); ++page) {
if (page->second == fmt_name) {
if (page->first) {
std::auto_ptr<db::FormatSpecificWriterOptions> options (decl->create_specific_options ());
std::unique_ptr<db::FormatSpecificWriterOptions> options (decl->create_specific_options ());
if (options.get ()) {
page->first->commit (options.get (), mp_tech, tl::OutputStream::output_mode_from_filename (m_filename, index_to_om (compression->currentIndex ())) != tl::OutputStream::OM_Plain);
}
@@ -442,7 +442,7 @@ SaveLayoutAsOptionsDialog::get_options (lay::LayoutView *view, unsigned int cv_i
const StreamWriterPluginDeclaration *decl = plugin_for_format (page->second);
if (decl) {
std::auto_ptr<db::FormatSpecificWriterOptions> specific_options;
std::unique_ptr<db::FormatSpecificWriterOptions> specific_options;
if (options.get_options (page->second)) {
specific_options.reset (options.get_options (page->second)->clone ());
} else {
@@ -522,7 +522,7 @@ SaveLayoutAsOptionsDialog::get_options (lay::LayoutView *view, unsigned int cv_i
for (std::vector< std::pair<StreamWriterOptionsPage *, std::string> >::iterator page = m_pages.begin (); page != m_pages.end (); ++page) {
if (page->second == options.format ()) {
std::auto_ptr<db::FormatSpecificWriterOptions> specific_options;
std::unique_ptr<db::FormatSpecificWriterOptions> specific_options;
specific_options.reset (decl->create_specific_options ());
if (specific_options.get ()) {
+1 -1
View File
@@ -443,7 +443,7 @@ DragDropDataBase *get_drag_drop_data (const QMimeData *data)
QByteArray ba = data->data (QString::fromUtf8 (drag_drop_mime_type ()));
// TODO: provide some global mechanism to register drag & drop classes
std::auto_ptr<DragDropDataBase> cd (new CellDragDropData ());
std::unique_ptr<DragDropDataBase> cd (new CellDragDropData ());
if (cd->deserialize (ba)) {
return cd.release ();
}
@@ -421,7 +421,7 @@ BEGIN_PROTECTED
lay::FileDialog open_dialog (this, tl::to_string (QObject::tr ("Load Marker Database File")), fmts);
if (open_dialog.get_open (m_open_filename)) {
std::auto_ptr <rdb::Database> db (new rdb::Database ());
std::unique_ptr <rdb::Database> db (new rdb::Database ());
db->load (m_open_filename);
int rdb_index = view ()->add_rdb (db.release ());
@@ -743,7 +743,7 @@ MarkerBrowserDialog::scan_layer ()
const lay::CellView &cv = view ()->cellview (cv_index);
const db::Layout &layout = cv->layout ();
std::auto_ptr<rdb::Database> rdb (new rdb::Database ());
std::unique_ptr<rdb::Database> rdb (new rdb::Database ());
rdb->set_name ("Shapes");
rdb->set_top_cell_name (layout.cell_name (cv.cell_index ()));
rdb::Cell *rdb_top_cell = rdb->create_cell (rdb->top_cell_name ());
@@ -787,7 +787,7 @@ MarkerBrowserDialog::scan_layer ()
for (db::ShapeIterator shape = cell.shapes ((*l)->layer_index ()).begin (db::ShapeIterator::All); ! shape.at_end (); ++shape) {
std::auto_ptr<rdb::ValueBase> value (rdb::ValueBase::create_from_shape (*shape, db::CplxTrans (layout.dbu ())));
std::unique_ptr<rdb::ValueBase> value (rdb::ValueBase::create_from_shape (*shape, db::CplxTrans (layout.dbu ())));
if (value.get ()) {
rdb::Item *item = rdb->create_item (rdb_cell->id (), cat->id ());
item->values ().add (value.release ());
@@ -841,7 +841,7 @@ MarkerBrowserDialog::scan_layer_flat ()
const lay::CellView &cv = view ()->cellview (cv_index);
const db::Layout &layout = cv->layout ();
std::auto_ptr<rdb::Database> rdb (new rdb::Database ());
std::unique_ptr<rdb::Database> rdb (new rdb::Database ());
rdb->set_name ("Shapes");
rdb->set_top_cell_name (layout.cell_name (cv.cell_index ()));
rdb::Cell *rdb_top_cell = rdb->create_cell (rdb->top_cell_name ());
@@ -866,7 +866,7 @@ MarkerBrowserDialog::scan_layer_flat ()
db::RecursiveShapeIterator shape (layout, *cv.cell (), (*l)->layer_index ());
while (! shape.at_end ()) {
std::auto_ptr<rdb::ValueBase> value (rdb::ValueBase::create_from_shape (*shape, db::CplxTrans (layout.dbu ()) * shape.trans ()));
std::unique_ptr<rdb::ValueBase> value (rdb::ValueBase::create_from_shape (*shape, db::CplxTrans (layout.dbu ()) * shape.trans ()));
if (value.get ()) {
rdb::Item *item = rdb->create_item (rdb_top_cell->id (), cat->id ());
item->values ().add (value.release ());
@@ -29,7 +29,7 @@ TEST (1)
l2n.load (tl::testsrc () + "/testdata/lay/l2n_browser.l2n");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
// two circuits
@@ -246,7 +246,7 @@ TEST (2)
lvs.load (tl::testsrc () + "/testdata/lay/lvsdb_browser.lvsdb");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
// two circuits
@@ -412,7 +412,7 @@ TEST (3)
l2n.load (tl::testsrc () + "/testdata/lay/l2n_browser.l2n");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
db::Circuit *root = l2n.netlist ()->circuit_by_name ("RINGO");
EXPECT_EQ (root != 0, true);
@@ -439,7 +439,7 @@ TEST (4)
l2n.load (tl::testsrc () + "/testdata/lay/l2n_browser.l2n");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &l2n, &colorizer));
db::Circuit *root = l2n.netlist ()->circuit_by_name ("RINGO");
EXPECT_EQ (root != 0, true);
@@ -469,7 +469,7 @@ TEST (5)
lvs.load (tl::testsrc () + "/testdata/lay/lvsdb_browser.lvsdb");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
QModelIndex idx;
db::Circuit *root = lvs.netlist ()->circuit_by_name ("INV2PAIR");
@@ -527,7 +527,7 @@ TEST (6)
lvs.load (tl::testsrc () + "/testdata/lay/lvsdb_browser.lvsdb");
lay::NetColorizer colorizer;
std::auto_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
std::unique_ptr<lay::NetlistBrowserModel> model (new lay::NetlistBrowserModel (0, &lvs, &colorizer));
QModelIndex idx;
db::Circuit *root = lvs.reference_netlist ()->circuit_by_name ("INV2PAIR");
@@ -28,7 +28,7 @@ TEST (1)
db::LayoutToNetlist l2n;
l2n.load (tl::testsrc () + "/testdata/lay/l2n_browser.l2n");
std::auto_ptr<lay::NetlistBrowserTreeModel> model (new lay::NetlistBrowserTreeModel (0, &l2n));
std::unique_ptr<lay::NetlistBrowserTreeModel> model (new lay::NetlistBrowserTreeModel (0, &l2n));
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
// two circuits
@@ -60,7 +60,7 @@ TEST (2)
db::LayoutVsSchematic lvs;
lvs.load (tl::testsrc () + "/testdata/lay/lvsdb_browser.lvsdb");
std::auto_ptr<lay::NetlistBrowserTreeModel> model (new lay::NetlistBrowserTreeModel (0, &lvs));
std::unique_ptr<lay::NetlistBrowserTreeModel> model (new lay::NetlistBrowserTreeModel (0, &lvs));
EXPECT_EQ (model->hasChildren (QModelIndex ()), true);
// two top circuits