[glom] C++11: Replace push_back() with emplace_back().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] C++11: Replace push_back() with emplace_back().
- Date: Sat, 6 Feb 2016 16:36:04 +0000 (UTC)
commit b52e5cfb7d817349d83f60e7b091de7cde744603
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Feb 5 23:04:20 2016 +0100
C++11: Replace push_back() with emplace_back().
glom/appwindow.cc | 70 ++++++++--------
glom/bakery/appwindow_withdoc.cc | 2 +-
glom/base_db.cc | 22 +++---
glom/base_db_table_data.cc | 4 +-
glom/frame_glom.cc | 12 ++--
glom/import_csv/csv_parser.cc | 6 +-
glom/import_csv/file_encodings.cc | 2 +-
glom/libglom/data_structure/field.cc | 14 ++--
glom/libglom/data_structure/layout/layoutgroup.cc | 14 ++--
glom/libglom/db_utils.cc | 30 +++---
glom/libglom/document/bakery/view/view_composite.h | 2 +-
glom/libglom/document/document.cc | 92 ++++++++++----------
glom/libglom/privs.cc | 20 ++--
glom/libglom/report_builder.cc | 12 ++--
glom/libglom/utils.cc | 22 +++---
glom/mode_data/box_data_calendar_related.cc | 4 +-
glom/mode_data/box_data_details.cc | 2 +-
glom/mode_data/box_data_list.cc | 4 +-
glom/mode_data/box_data_list_related.cc | 8 +-
glom/mode_data/box_data_portal.cc | 6 +-
.../datawidget/combochoiceswithtreemodel.cc | 6 +-
glom/mode_data/datawidget/treemodel_db.cc | 2 +-
glom/mode_data/db_adddel/db_adddel.cc | 14 ++--
glom/mode_data/flowtablewithfields.cc | 18 ++--
glom/mode_design/box_db_table_relationships.cc | 2 +-
glom/mode_design/fields/box_db_table_definition.cc | 14 ++--
glom/mode_design/iso_codes.cc | 8 +-
glom/mode_design/layout/dialog_choose_field.cc | 2 +-
.../layout/dialog_layout_calendar_related.cc | 2 +-
glom/mode_design/layout/dialog_layout_details.cc | 4 +-
glom/mode_design/layout/dialog_layout_export.cc | 2 +-
.../layout/dialog_layout_list_related.cc | 2 +-
.../layout/layout_item_dialogs/box_formatting.cc | 2 +-
.../layout_item_dialogs/dialog_sortfields.cc | 2 +-
.../print_layouts/print_layout_toolbar_button.cc | 2 +-
.../print_layouts/window_print_layout_edit.cc | 10 +-
.../window_relationships_overview.cc | 2 +-
glom/navigation/box_tables.cc | 2 +-
glom/print_layout/canvas_print_layout.cc | 10 +-
glom/python_embed/glom_python.cc | 4 +-
glom/test_pyembed.cc | 4 +-
glom/utility_widgets/adddel/adddel.cc | 4 +-
glom/utility_widgets/canvas/canvas_group_grid.cc | 8 +-
glom/utility_widgets/flowtable.cc | 8 +-
glom/utility_widgets/imageglom.cc | 4 +-
glom/utility_widgets/layouttoolbarbutton.cc | 2 +-
glom/utility_widgets/test_flowtable.cc | 12 ++--
tests/import/test_parsing.cc | 2 +-
tests/test_fake_connection.cc | 4 +-
tests/test_selfhosting_new_empty_then_users.cc | 6 +-
tests/test_selfhosting_new_from_example_float.cc | 2 +-
tests/test_selfhosting_new_then_image.cc | 2 +-
tests/test_selfhosting_sqlinjection.cc | 16 ++--
tests/test_selfhosting_utils.cc | 12 ++--
54 files changed, 272 insertions(+), 272 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 6c8651d..4ed8e34 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -273,27 +273,27 @@ void AppWindow::init_menus_file()
action = m_refActionGroup_File->add_action("export",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_export));
- m_listTableSensitiveActions.push_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_File->add_action("import",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_import));
- m_listTableSensitiveActions.push_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
m_toggleaction_network_shared = m_refActionGroup_File->add_action_bool("share",
sigc::mem_fun(*this, &AppWindow::on_menu_file_toggle_share) );
- m_listTableSensitiveActions.push_back(m_toggleaction_network_shared);
+ m_listTableSensitiveActions.emplace_back(m_toggleaction_network_shared);
#endif //!GLOM_ENABLE_CLIENT_ONLY
action = m_refActionGroup_File->add_action("print",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print) );
- m_listTableSensitiveActions.push_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
#ifndef GLOM_ENABLE_CLIENT_ONLY
auto action_print_edit =
m_refActionGroup_File->add_action("edit-print-layouts",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print_edit_layouts));
- m_listDeveloperActions.push_back(action_print_edit);
+ m_listDeveloperActions.emplace_back(action_print_edit);
#endif // !GLOM_ENABLE_CLIENT_ONLY
//Add to the window's regular "win" ActionMap:
@@ -317,12 +317,12 @@ void AppWindow::init_menus()
#ifndef GLOM_ENABLE_CLIENT_ONLY
action = m_refActionGroup_Tables->add_action("edit-tables",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_EditTables) );
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
/* Commented out because it is useful but confusing to new users:
action = m_refActionGroup_Tables->add_action("GlomAction_Menu_AddRelatedTable", //_("Add _Related Table"));
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Tables_AddRelatedTable) );
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
*/
#endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -335,8 +335,8 @@ void AppWindow::init_menus()
#ifndef GLOM_ENABLE_CLIENT_ONLY
m_refActionGroup_Reports->add_action("edit-reports",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_Reports_EditReports) );
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
#endif
insert_action_group("reports", m_refActionGroup_Developer);
@@ -352,67 +352,67 @@ void AppWindow::init_menus()
action = m_refActionGroup_Developer->add_action("database-preferences",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_database_preferences) );
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("fields",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_fields) );
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("relationships-overview",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_relationships_overview) );
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("relationships",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_relationships) );
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
m_action_developer_users = m_refActionGroup_Developer->add_action("users",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_users));
- m_listDeveloperActions.push_back(m_action_developer_users);
+ m_listDeveloperActions.emplace_back(m_action_developer_users);
action = m_refActionGroup_Developer->add_action("print-layouts",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_print_layouts));
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("reports",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_reports));
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("script-library",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_script_library));
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("layout",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_layout));
- m_listDeveloperActions.push_back(action);
- m_listTableSensitiveActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
+ m_listTableSensitiveActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("change-language",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_changelanguage));
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("translations",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_translations));
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
//"Active Platform" menu:
m_action_menu_developer_active_platform =
m_refActionGroup_Developer->add_action_radio_string("active-platform",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_active_platform),
"");
- m_listDeveloperActions.push_back(m_action_menu_developer_active_platform);
+ m_listDeveloperActions.emplace_back(m_action_menu_developer_active_platform);
action = m_refActionGroup_Developer->add_action("export-backup",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_export_backup));
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
action = m_refActionGroup_Developer->add_action("restore-backup",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_restore_backup));
- m_listDeveloperActions.push_back(action);
+ m_listDeveloperActions.emplace_back(action);
//TODO: Think of a better name for this menu item,
//though it mostly only exists because it is not quite ready to be on by default:
@@ -420,7 +420,7 @@ void AppWindow::init_menus()
m_action_enable_layout_drag_and_drop =
m_refActionGroup_Developer->add_action_bool("drag-and-drop-layout",
sigc::mem_fun(*this, &AppWindow::on_menu_developer_enable_layout_drag_and_drop));
- m_listDeveloperActions.push_back(m_action_enable_layout_drag_and_drop);
+ m_listDeveloperActions.emplace_back(m_action_enable_layout_drag_and_drop);
#endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -1760,7 +1760,7 @@ void AppWindow::add_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refA
//Prevent it from being added twice:
remove_developer_action(refAction);
- m_listDeveloperActions.push_back(refAction);
+ m_listDeveloperActions.emplace_back(refAction);
}
void AppWindow::remove_developer_action(const Glib::RefPtr<Gio::SimpleAction>& refAction)
@@ -1824,7 +1824,7 @@ void AppWindow::fill_menu_tables()
auto action = m_refNavTablesActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_box_tables_selected), table_info->get_name()) );
- m_listNavTableActions.push_back(action);
+ m_listNavTableActions.emplace_back(action);
}
}
@@ -1882,7 +1882,7 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
auto action = m_refNavReportsActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_report_selected), report->get_name()) );
- m_listNavReportActions.push_back(action);
+ m_listNavReportActions.emplace_back(action);
}
}
}
@@ -1966,7 +1966,7 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
auto action = m_refNavPrintLayoutsActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_print_layout_selected), name) );
- m_listNavPrintLayoutActions.push_back(action);
+ m_listNavPrintLayoutActions.emplace_back(action);
}
}
}
@@ -2732,7 +2732,7 @@ void AppWindow::init_menus_edit()
m_action_mode_find = m_refActionGroup_Edit->add_action_bool("find",
sigc::mem_fun((AppWindow&)*this, &AppWindow::on_menu_edit_find),
false);
- m_listTableSensitiveActions.push_back(m_action_mode_find);
+ m_listTableSensitiveActions.emplace_back(m_action_mode_find);
insert_action_group("edit", m_refActionGroup_Edit);
}
diff --git a/glom/bakery/appwindow_withdoc.cc b/glom/bakery/appwindow_withdoc.cc
index 0702c90..13b4b32 100644
--- a/glom/bakery/appwindow_withdoc.cc
+++ b/glom/bakery/appwindow_withdoc.cc
@@ -46,7 +46,7 @@ AppWindow_WithDoc::~AppWindow_WithDoc()
void AppWindow_WithDoc::add_mime_type(const Glib::ustring& mime_type)
{
if( !Glom::Utils::find_exists(m_mime_types, mime_type) )
- m_mime_types.push_back(mime_type);
+ m_mime_types.emplace_back(mime_type);
}
void AppWindow_WithDoc::on_menu_file_close()
diff --git a/glom/base_db.cc b/glom/base_db.cc
index c8a5a77..427b4f9 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -204,7 +204,7 @@ Base_DB::type_vec_strings Base_DB::util_vecStrings_from_Fields(const type_vec_fi
type_vec_strings vecNames;
for(type_vec_fields::size_type i = 0; i < fields.size(); ++i)
{
- vecNames.push_back(fields[i]->get_name());
+ vecNames.emplace_back(fields[i]->get_name());
}
return vecNames;
@@ -604,7 +604,7 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
layout_item->m_priv_view = privs_related.m_view;
layout_item->m_priv_edit = privs_related.m_edit;
- vecFields.push_back(layout_item);
+ vecFields.emplace_back(layout_item);
}
else
{
@@ -627,7 +627,7 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
layout_item->m_priv_view = table_privs.m_view;
layout_item->m_priv_edit = table_privs.m_edit;
- vecFields.push_back(layout_item);
+ vecFields.emplace_back(layout_item);
}
}
}
@@ -687,7 +687,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
layout_item->m_priv_view = table_privs.m_view;
layout_item->m_priv_edit = table_privs.m_edit;
- result.push_back(layout_item);
+ result.emplace_back(layout_item);
}
//Add the rest:
@@ -704,7 +704,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
layout_item->m_priv_view = table_privs.m_view;
layout_item->m_priv_edit = table_privs.m_edit;
- result.push_back(layout_item);
+ result.emplace_back(layout_item);
}
}
}
@@ -1027,7 +1027,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
type_vecConstLayoutFields list_fields;
auto layout_item = field_in_record.m_field;
- list_fields.push_back(layout_item);
+ list_fields.emplace_back(layout_item);
auto sql_query = Utils::build_sql_select_with_key(field_in_record.m_table_name,
list_fields, field_in_record.m_key, field_in_record.m_key_value, type_sort_clause(), 1);
@@ -1067,7 +1067,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const std::shared_ptr<Fie
type_vecConstLayoutFields list_fields;
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
- list_fields.push_back(layout_item);
+ list_fields.emplace_back(layout_item);
auto sql_query = Utils::build_sql_select_with_where_clause(found_set.m_table_name,
list_fields,
found_set.m_where_clause,
@@ -1152,7 +1152,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::
//Tell the caller that this field is triggered by the specified field:
//TODO: Test related fields too?
- result.push_back(layoutitem_field_to_examine);
+ result.emplace_back(layoutitem_field_to_examine);
}
}
}
@@ -1202,7 +1202,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_found);
- result.push_back(layout_item);
+ result.emplace_back(layout_item);
}
index = pos_find_end + 1;
@@ -1226,7 +1226,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_from);
- result.push_back(layout_item);
+ result.emplace_back(layout_item);
}
}
}
@@ -1368,7 +1368,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(primary_key);
- fieldsToGet.push_back(layout_item);
+ fieldsToGet.emplace_back(layout_item);
auto builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_target(found_set.m_table_name);
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index 73f0a95..8b6d567 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -77,7 +77,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(item);
- fieldsToAdd.push_back(layout_item);
+ fieldsToAdd.emplace_back(layout_item);
}
}
@@ -468,7 +468,7 @@ Base_DB_Table_Data::type_vecConstLayoutFields Base_DB_Table_Data::get_related_fi
if(relationship->get_from_field() == field_name)
{
//Add it:
- result.push_back(layout_field);
+ result.emplace_back(layout_field);
}
}
}
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 00b253e..ab7be0f 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -386,7 +386,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
auto layout_item_temp = std::make_shared<LayoutItem_Field>();
layout_item_temp->set_full_field_details(field_primary_key);
type_vecLayoutFields layout_fields;
- layout_fields.push_back(layout_item_temp);
+ layout_fields.emplace_back(layout_item_temp);
auto sql_query_without_sort = Utils::build_sql_select_with_where_clause(found_set.m_table_name,
layout_fields, found_set.m_where_clause, found_set.m_extra_join, type_sort_clause());
const Privileges table_privs = Privs::get_current_privs(found_set.m_table_name);
@@ -395,7 +395,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
count = DbUtils::count_rows_returned_by(sql_query_without_sort);
if(count < 10000) //Arbitrary large number.
- found_set.m_sort_clause.push_back( type_pair_sort_field(layout_item_sort, true /* ascending */)
);
+ found_set.m_sort_clause.emplace_back( type_pair_sort_field(layout_item_sort, true /* ascending
*/) );
}
}
@@ -621,7 +621,7 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
//{
//Output data in canonical SQL format, ignoring the user's locale, and ignoring the layout
formatting:
- row_data.push_back(value); //TODO_Performance: reserve the size.
+ row_data.emplace_back(value); //TODO_Performance: reserve the size.
//if(layout_item->m_field.get_glom_type() == Field::glom_field_type::IMAGE) //This is too much
data.
//{
@@ -630,7 +630,7 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
}
//std::cout << " row_string=" << row_string << std::endl;
- the_vector.push_back(row_data); //TODO_Performance: Reserve the size.
+ the_vector.emplace_back(row_data); //TODO_Performance: Reserve the size.
}
}
}
@@ -1450,7 +1450,7 @@ void Frame_Glom::update_table_in_document_from_database()
if(iterFindDoc == fieldsDocument.end()) //If it was not found:
{
//Add it
- fieldsDocument.push_back(field_database);
+ fieldsDocument.emplace_back(field_database);
document_must_be_updated = true;
}
else //if it was found.
@@ -1493,7 +1493,7 @@ void Frame_Glom::update_table_in_document_from_database()
//Check whether it's in the database:
if(find_if_same_name_exists(fieldsDatabase, field->get_name())) //If it was found
{
- fieldsActual.push_back(field);
+ fieldsActual.emplace_back(field);
}
else
{
diff --git a/glom/import_csv/csv_parser.cc b/glom/import_csv/csv_parser.cc
index 77c12e5..1aaff7a 100644
--- a/glom/import_csv/csv_parser.cc
+++ b/glom/import_csv/csv_parser.cc
@@ -464,7 +464,7 @@ void CsvParser::do_line_scanned(const Glib::ustring& line, guint line_number)
if(line.empty())
return;
- m_rows.push_back(CsvParser::type_row_strings());
+ m_rows.emplace_back(CsvParser::type_row_strings());
auto& row = m_rows.back();
Glib::ustring field;
@@ -472,7 +472,7 @@ void CsvParser::do_line_scanned(const Glib::ustring& line, guint line_number)
// Parse first field:
auto line_iter = CsvParser::advance_field(line.begin(), line.end(), field);
- row.push_back(field);
+ row.emplace_back(field);
// Parse more fields:
while(line_iter != line.end())
@@ -484,7 +484,7 @@ void CsvParser::do_line_scanned(const Glib::ustring& line, guint line_number)
line_iter = advance_field(line_iter, line.end(), field);
// Add field to current row:
- row.push_back(field);
+ row.emplace_back(field);
}
signal_line_scanned().emit(row, line_number);
diff --git a/glom/import_csv/file_encodings.cc b/glom/import_csv/file_encodings.cc
index db9bfa5..2286d03 100644
--- a/glom/import_csv/file_encodings.cc
+++ b/glom/import_csv/file_encodings.cc
@@ -55,7 +55,7 @@ static type_list_encodings list_encodings;
static void add_encoding(const gchar* name, const gchar* encoding)
{
- list_encodings.push_back(Encoding(name, encoding));
+ list_encodings.emplace_back(Encoding(name, encoding));
}
type_list_encodings get_list_of_encodings()
diff --git a/glom/libglom/data_structure/field.cc b/glom/libglom/data_structure/field.cc
index 2e584ff..9ec996a 100644
--- a/glom/libglom/data_structure/field.cc
+++ b/glom/libglom/data_structure/field.cc
@@ -689,8 +689,8 @@ void Field::init_map()
type_list_conversion_targets list_conversions( {
Field::glom_field_type::BOOLEAN,
Field::glom_field_type::TEXT} );
- //to_date(numeric) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::DATE);
- //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::TIME);
+ //to_date(numeric) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::DATE);
+ //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::TIME);
m_map_conversions[Field::glom_field_type::NUMERIC] = list_conversions;
//Text:
@@ -705,15 +705,15 @@ void Field::init_map()
list_conversions = {
Field::glom_field_type::TEXT,
Field::glom_field_type::NUMERIC};
- //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::DATE);
- //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::TIME);
+ //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::DATE);
+ //to_timestamp(numeric) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::TIME);
m_map_conversions[Field::glom_field_type::BOOLEAN] = list_conversions;
//Date:
list_conversions = {
Field::glom_field_type::TEXT};
- //to_number(textcat()) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::NUMERIC);
- //to_number(textcat()) was supported in 8.2 but not in 8.3:
list_conversions.push_back(Field::glom_field_type::BOOLEAN);
+ //to_number(textcat()) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::NUMERIC);
+ //to_number(textcat()) was supported in 8.2 but not in 8.3:
list_conversions.emplace_back(Field::glom_field_type::BOOLEAN);
m_map_conversions[Field::glom_field_type::DATE] = list_conversions;
//Time:
@@ -838,7 +838,7 @@ Field::type_list_strings Field::get_calculation_relationships() const
{
Glib::ustring::size_type pos_start = pos_find + prefix_size;
const auto field_name = m_calculation.substr(pos_start, pos_find_end - pos_start);
- result.push_back(field_name);
+ result.emplace_back(field_name);
index = pos_find_end + 1;
}
}
diff --git a/glom/libglom/data_structure/layout/layoutgroup.cc
b/glom/libglom/data_structure/layout/layoutgroup.cc
index 63e83c9..61170b5 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.cc
+++ b/glom/libglom/data_structure/layout/layoutgroup.cc
@@ -43,7 +43,7 @@ LayoutGroup::LayoutGroup(const LayoutGroup& src)
for(const auto& item : src.m_list_items)
{
if(item)
- m_list_items.push_back( glom_sharedptr_clone(item) );
+ m_list_items.emplace_back( glom_sharedptr_clone(item) );
}
}
@@ -80,7 +80,7 @@ LayoutGroup& LayoutGroup::operator=(const LayoutGroup& src)
for(const auto& item : src.m_list_items)
{
if(item)
- m_list_items.push_back( glom_sharedptr_clone(item) );
+ m_list_items.emplace_back( glom_sharedptr_clone(item) );
}
}
@@ -141,7 +141,7 @@ bool LayoutGroup::has_any_fields() const
void LayoutGroup::add_item(const std::shared_ptr<LayoutItem>& item)
{
- m_list_items.push_back(item);
+ m_list_items.emplace_back(item);
}
void LayoutGroup::add_item(const std::shared_ptr<LayoutItem>& item, const std::shared_ptr<const LayoutItem>&
position)
@@ -177,7 +177,7 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items() const
for(const auto& item : m_list_items)
{
- result.push_back(item);
+ result.emplace_back(item);
}
return result;
@@ -196,7 +196,7 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive() const
result.insert(result.end(), sub_result.begin(), sub_result.end());
}
else
- result.push_back(item);
+ result.emplace_back(item);
}
return result;
@@ -215,7 +215,7 @@ LayoutGroup::type_list_items LayoutGroup::get_items_recursive()
result.insert(result.end(), sub_result.begin(), sub_result.end());
}
else
- result.push_back(item);
+ result.emplace_back(item);
}
return result;
@@ -228,7 +228,7 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive_with_groups(
for(const auto& item : m_list_items)
{
//Add the item itself:
- result.push_back(item);
+ result.emplace_back(item);
auto group = std::dynamic_pointer_cast<const LayoutGroup>(item);
if(group)
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 5c91186..6a1f113 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -529,22 +529,22 @@ bool add_standard_tables(const std::shared_ptr<const Document>& document)
auto primary_key = std::make_shared<Field>(); //It's not used, because there's only one record, but we
must have one.
primary_key->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_ID);
primary_key->set_glom_type(Field::glom_field_type::NUMERIC);
- fields.push_back(primary_key);
+ fields.emplace_back(primary_key);
auto field_table_name = std::make_shared<Field>();
field_table_name->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_TABLE_NAME);
field_table_name->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_table_name);
+ fields.emplace_back(field_table_name);
auto field_field_name = std::make_shared<Field>();
field_field_name->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_FIELD_NAME);
field_field_name->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_field_name);
+ fields.emplace_back(field_field_name);
auto field_next_value = std::make_shared<Field>();
field_next_value->set_name(GLOM_STANDARD_TABLE_AUTOINCREMENTS_FIELD_NEXT_VALUE);
field_next_value->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_next_value);
+ fields.emplace_back(field_next_value);
const auto test = create_table(document->get_hosting_mode(), table_info, fields);
if(!test)
@@ -844,7 +844,7 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
holder_table_name->set_value(quoted_table_name);
std::vector< Glib::RefPtr<Gnome::Gda::Holder> > holder_list;
- holder_list.push_back(holder_table_name);
+ holder_list.emplace_back(holder_table_name);
Glib::RefPtr<Gnome::Gda::DataModel> data_model_fields;
try
@@ -947,7 +947,7 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
field->set_primary_key(
meta_table_column_is_primary_key(meta_table, field_info->get_name()) );
- result.push_back(field);
+ result.emplace_back(field);
++row;
}
@@ -1013,7 +1013,7 @@ type_vec_fields get_fields_for_table(const std::shared_ptr<const Document>& docu
field->set_field_info(field_info);
- result.push_back(*iter);
+ result.emplace_back(*iter);
}
}
@@ -1025,7 +1025,7 @@ type_vec_fields get_fields_for_table(const std::shared_ptr<const Document>& docu
//Look in the result so far:
//Add it if it is not there:
if(!find_if_same_name_exists(result, field_name))
- result.push_back(*iter);
+ result.emplace_back(*iter);
}
*/
@@ -1125,7 +1125,7 @@ type_vec_strings get_table_names_from_database(bool ignore_system_tables)
//if(table_name.substr(0, 23) == "information_schema.sql_")
// continue;
- result.push_back(table_name);
+ result.emplace_back(table_name);
}
}
}
@@ -1171,14 +1171,14 @@ bool create_table_with_default_fields(const std::shared_ptr<Document>& document,
//std::cout << "debug: " << G_STRFUNC << ":" << field_primary_key->get_auto_increment() << std::endl;
type_vec_fields fields;
- fields.push_back(field_primary_key);
+ fields.emplace_back(field_primary_key);
//Description:
auto field_description = std::make_shared<Field>();
field_description->set_name("description");
field_description->set_title_original(_("Description")); //Use a translation, because the original locale
will be marked as non-English if the current locale is non-English.
field_description->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_description);
+ fields.emplace_back(field_description);
//Comments:
auto field_comments = std::make_shared<Field>();
@@ -1186,7 +1186,7 @@ bool create_table_with_default_fields(const std::shared_ptr<Document>& document,
field_comments->set_title_original(_("Comments"));
field_comments->set_glom_type(Field::glom_field_type::TEXT);
field_comments->m_default_formatting.set_text_format_multiline();
- fields.push_back(field_comments);
+ fields.emplace_back(field_comments);
auto table_info = std::make_shared<TableInfo>();
table_info->set_name(table_name);
@@ -1224,7 +1224,7 @@ bool create_table(Document::HostingMode hosting_mode, const std::shared_ptr<cons
auto field = std::make_shared<Field>();
field->set_name(GLOM_STANDARD_FIELD_LOCK);
field->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field);
+ fields.emplace_back(field);
}
//Create SQL to describe all fields in this table:
@@ -1504,7 +1504,7 @@ static void recalculate_next_auto_increment_value(const Glib::ustring& table_nam
//Get the max key value in the database:
auto builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
std::vector<guint> args;
- args.push_back(builder->add_field_id(field_name, table_name));
+ args.emplace_back(builder->add_field_id(field_name, table_name));
builder->add_field_value_id(builder->add_function("MAX", args));
builder->select_add_target(table_name);
@@ -2302,7 +2302,7 @@ type_map_fields get_record_field_values(const std::shared_ptr<const Document>& d
const auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
- fieldsToGet.push_back(layout_item);
+ fieldsToGet.emplace_back(layout_item);
}
if(!Conversions::value_is_empty(primary_key_value))
diff --git a/glom/libglom/document/bakery/view/view_composite.h
b/glom/libglom/document/bakery/view/view_composite.h
index 2726126..eef45fd 100644
--- a/glom/libglom/document/bakery/view/view_composite.h
+++ b/glom/libglom/document/bakery/view/view_composite.h
@@ -49,7 +49,7 @@ public:
pView->set_document(View<T_Document>::get_document());
//Add it to the list of child views:
- m_vecViews.push_back(pView);
+ m_vecViews.emplace_back(pView);
}
}
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index d799d7b..1c2020c 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -496,7 +496,7 @@ void Document::set_relationship(const Glib::ustring& table_name, const std::shar
if(!existing)
{
//Add a new one if it's not there.
- info->m_relationships.push_back(relationship);
+ info->m_relationships.emplace_back(relationship);
}
}
@@ -531,61 +531,61 @@ std::shared_ptr<TableInfo> Document::create_table_system_preferences(type_vec_fi
auto primary_key = std::make_shared<Field>(); //It's not used, because there's only one record, but we
must have one.
primary_key->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ID);
primary_key->set_glom_type(Field::glom_field_type::NUMERIC);
- fields.push_back(primary_key);
+ fields.emplace_back(primary_key);
auto field_name = std::make_shared<Field>();
field_name->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_NAME);
field_name->set_title_original(_("System Name"));
field_name->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_name);
+ fields.emplace_back(field_name);
auto field_org_name = std::make_shared<Field>();
field_org_name->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_NAME);
field_org_name->set_title_original(_("Organisation Name"));
field_org_name->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_name);
+ fields.emplace_back(field_org_name);
auto field_org_logo = std::make_shared<Field>();
field_org_logo->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_LOGO);
field_org_logo->set_title_original(_("Organisation Logo"));
field_org_logo->set_glom_type(Field::glom_field_type::IMAGE);
- fields.push_back(field_org_logo);
+ fields.emplace_back(field_org_logo);
auto field_org_address_street = std::make_shared<Field>();
field_org_address_street->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_STREET);
field_org_address_street->set_title_original(_("Street"));
field_org_address_street->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_street);
+ fields.emplace_back(field_org_address_street);
auto field_org_address_street2 = std::make_shared<Field>();
field_org_address_street2->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_STREET2);
field_org_address_street2->set_title_original(_("Street (line 2)"));
field_org_address_street2->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_street2);
+ fields.emplace_back(field_org_address_street2);
auto field_org_address_town = std::make_shared<Field>();
field_org_address_town->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_TOWN);
field_org_address_town->set_title_original(_("City"));
field_org_address_town->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_town);
+ fields.emplace_back(field_org_address_town);
auto field_org_address_county = std::make_shared<Field>();
field_org_address_county->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_COUNTY);
field_org_address_county->set_title_original(_("State"));
field_org_address_county->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_county);
+ fields.emplace_back(field_org_address_county);
auto field_org_address_country = std::make_shared<Field>();
field_org_address_country->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_COUNTRY);
field_org_address_country->set_title_original(_("Country"));
field_org_address_country->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_country);
+ fields.emplace_back(field_org_address_country);
auto field_org_address_postcode = std::make_shared<Field>();
field_org_address_postcode->set_name(GLOM_STANDARD_TABLE_PREFS_FIELD_ORG_ADDRESS_POSTCODE);
field_org_address_postcode->set_title_original(_("Zip Code"));
field_org_address_postcode->set_glom_type(Field::glom_field_type::TEXT);
- fields.push_back(field_org_address_postcode);
+ fields.emplace_back(field_org_address_postcode);
return prefs_table_info;
}
@@ -633,7 +633,7 @@ Document::type_vec_relationships Document::get_relationships(const Glib::ustring
{
if(find_if_same_name_exists(result, GLOM_RELATIONSHIP_NAME_SYSTEM_PROPERTIES))
{
- result.push_back(create_relationship_system_preferences(table_name));
+ result.emplace_back(create_relationship_system_preferences(table_name));
}
}
@@ -1150,7 +1150,7 @@ Document::type_listConstTableInfo Document::get_tables(bool plus_system_prefs) c
{
const auto doctableinfo = table_pair.second;
if(doctableinfo)
- result.push_back(doctableinfo->m_info);
+ result.emplace_back(doctableinfo->m_info);
//std::cout << "debug: " << G_STRFUNC << ": title=" << iter->second->m_info->get_title() << std::endl;
}
@@ -1159,7 +1159,7 @@ Document::type_listConstTableInfo Document::get_tables(bool plus_system_prefs) c
if(plus_system_prefs)
{
if(find_if_same_name_exists(result, GLOM_STANDARD_TABLE_PREFS_TABLE_NAME))
- result.push_back(create_table_system_preferences());
+ result.emplace_back(create_table_system_preferences());
}
return result;
@@ -1173,7 +1173,7 @@ Document::type_listTableInfo Document::get_tables(bool plus_system_prefs)
{
const auto doctableinfo = table_pair.second;
if(doctableinfo)
- result.push_back(doctableinfo->m_info);
+ result.emplace_back(doctableinfo->m_info);
//std::cout << "debug: " << G_STRFUNC << ": title=" << iter->second->m_info->get_title() << std::endl;
}
@@ -1182,7 +1182,7 @@ Document::type_listTableInfo Document::get_tables(bool plus_system_prefs)
if(plus_system_prefs)
{
if(find_if_same_name_exists(result, GLOM_STANDARD_TABLE_PREFS_TABLE_NAME))
- result.push_back(create_table_system_preferences());
+ result.emplace_back(create_table_system_preferences());
}
return result;
@@ -1195,7 +1195,7 @@ std::vector<Glib::ustring> Document::get_table_names(bool plus_system_prefs) con
for (const auto& info : list_full)
{
if(info)
- result.push_back(info->get_name());
+ result.emplace_back(info->get_name());
}
return result;
@@ -1397,13 +1397,13 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
overview->set_name("overview");
overview->set_title_original(_("Overview"));
overview->set_columns_count(2);
- result.push_back(overview);
+ result.emplace_back(overview);
details = std::make_shared<LayoutGroup>();
details->set_name("details");
details->set_title_original(_("Details"));
details->set_columns_count(2);
- result.push_back(details);
+ result.emplace_back(details);
}
//If, for some reason, we didn't create the-subgroups, add everything to a top level group:
@@ -1412,7 +1412,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
overview = std::make_shared<LayoutGroup>();
overview->set_name("main");
overview->set_columns_count(1);
- result.push_back(overview);
+ result.emplace_back(overview);
details = overview; //Adding anything to details adds it to the overview, which is the only group.
}
@@ -1560,7 +1560,7 @@ void Document::set_data_layout_groups(const Glib::ustring& layout_name, const Gl
DocumentTableInfo::type_layouts& layouts = info->m_layouts;
auto iter = find_if_layout(layouts, layout_name, layout_platform);
if(iter == layouts.end())
- layouts.push_back(layout_info);
+ layouts.emplace_back(layout_info);
else
*iter = layout_info;
@@ -1975,7 +1975,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
auto value = std::make_shared<ChoiceValue>();
load_after_choicevalue(element_custom_choices, value, field_type);
- list_values.push_back(value);
+ list_values.emplace_back(value);
}
}
@@ -2137,7 +2137,7 @@ void Document::load_after_sort_by(const xmlpp::Element* node, const Glib::ustrin
const auto ascending = XmlUtils::get_node_attribute_value_as_bool(element,
GLOM_ATTRIBUTE_SORT_ASCENDING);
- list_fields.push_back( LayoutItem_GroupBy::type_pair_sort_field(item, ascending) );
+ list_fields.emplace_back( LayoutItem_GroupBy::type_pair_sort_field(item, ascending) );
}
}
}
@@ -2476,7 +2476,7 @@ void Document::load_after_translations(const xmlpp::Element* element, const std:
//TODO: Use a set instead?
if(!Utils::find_exists(m_translation_available_locales, locale))
{
- m_translation_available_locales.push_back(locale);
+ m_translation_available_locales.emplace_back(locale);
}
}
}
@@ -2573,7 +2573,7 @@ bool Document::load_after(int& failure_code)
m_startup_script = XmlUtils::get_child_text_node(nodeRoot, GLOM_NODE_STARTUP_SCRIPT);
m_translation_original_locale = XmlUtils::get_node_attribute_value(nodeRoot,
GLOM_ATTRIBUTE_TRANSLATION_ORIGINAL_LOCALE);
- m_translation_available_locales.push_back(m_translation_original_locale); //Just a cache.
+ m_translation_available_locales.emplace_back(m_translation_original_locale); //Just a cache.
const auto nodeConnection = XmlUtils::get_node_child_named(nodeRoot, GLOM_NODE_CONNECTION);
if(nodeConnection)
@@ -2680,7 +2680,7 @@ bool Document::load_after(int& failure_code)
//Translations:
load_after_translations(node_rel, relationship);
- doctableinfo->m_relationships.push_back(relationship);
+ doctableinfo->m_relationships.emplace_back(relationship);
}
}
}
@@ -2749,7 +2749,7 @@ bool Document::load_after(int& failure_code)
//Translations:
load_after_translations(node_field, field);
- doctableinfo->m_fields.push_back(field);
+ doctableinfo->m_fields.emplace_back(field);
}
}
} //Fields
@@ -2797,7 +2797,7 @@ bool Document::load_after(int& failure_code)
}
// Append line to doctableinfo->m_example_rows
- doctableinfo->m_example_rows.push_back(field_values);
+ doctableinfo->m_example_rows.emplace_back(field_values);
}
}
} // Example Rows
@@ -2847,7 +2847,7 @@ bool Document::load_after(int& failure_code)
auto group = std::make_shared<LayoutGroup>();
load_after_layout_group(node_layout_group, table_name, group);
- layout_groups.push_back(group);
+ layout_groups.emplace_back(group);
}
}
}
@@ -2857,7 +2857,7 @@ bool Document::load_after(int& failure_code)
layout_info.m_layout_name = layout_name;
layout_info.m_layout_platform = layout_platform;
layout_info.m_layout_groups = layout_groups;
- doctableinfo->m_layouts.push_back(layout_info);
+ doctableinfo->m_layouts.emplace_back(layout_info);
}
}
} //if(nodeDataLayouts)
@@ -2940,7 +2940,7 @@ bool Document::load_after(int& failure_code)
continue;
const auto pos = XmlUtils::get_node_attribute_value_as_decimal(node_rule,
GLOM_ATTRIBUTE_RULE_POSITION);
- vec_rules_h.push_back(pos);
+ vec_rules_h.emplace_back(pos);
}
print_layout->set_horizontal_rules(vec_rules_h);
@@ -2952,7 +2952,7 @@ bool Document::load_after(int& failure_code)
continue;
const auto pos = XmlUtils::get_node_attribute_value_as_decimal(node_rule,
GLOM_ATTRIBUTE_RULE_POSITION);
- vec_rules_v.push_back(pos);
+ vec_rules_v.emplace_back(pos);
}
print_layout->set_vertical_rules(vec_rules_v);
@@ -3966,7 +3966,7 @@ Document::type_list_groups Document::get_groups() const
type_list_groups result;
for(const auto& group_pair : m_groups)
{
- result.push_back(group_pair.second);
+ result.emplace_back(group_pair.second);
}
return result;
@@ -4012,7 +4012,7 @@ std::vector<Glib::ustring> Document::get_report_names(const Glib::ustring& table
std::vector<Glib::ustring> result;
for(const auto& report_pair : info->m_reports)
{
- result.push_back(report_pair.second->get_name());
+ result.emplace_back(report_pair.second->get_name());
}
return result;
@@ -4070,7 +4070,7 @@ std::vector<Glib::ustring> Document::get_print_layout_names(const Glib::ustring&
std::vector<Glib::ustring> result;
for(const auto& print_layout_pair : info->m_print_layouts)
{
- result.push_back(print_layout_pair.second->get_name());
+ result.emplace_back(print_layout_pair.second->get_name());
}
return result;
@@ -4335,7 +4335,7 @@ static void add_to_translatable_list(Document::type_list_translatables& list, co
const Document::pair_translatable_item_and_hint item_and_hint(item, hint);
if(find_if_item_and_hint_equal(list, item_and_hint) == list.end())
{
- list.push_back( item_and_hint );
+ list.emplace_back( item_and_hint );
}
}
@@ -4346,7 +4346,7 @@ static void add_to_translatable_list(Document::type_list_translatables& list, co
{
if(find_if_item_and_hint_equal(list, item_and_hint) == list.end())
{
- list.push_back( item_and_hint );
+ list.emplace_back( item_and_hint );
}
}
}
@@ -4490,7 +4490,7 @@ void Document::fill_translatable_custom_choices(Formatting& formatting, type_lis
for(const auto& value : formatting.get_choices_custom())
{
- the_list.push_back( pair_translatable_item_and_hint(value, hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(value, hint) );
}
}
@@ -4501,7 +4501,7 @@ void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutItem_F
auto custom_title = layout_field->get_title_custom();
if(custom_title)
{
- the_list.push_back( pair_translatable_item_and_hint(custom_title, hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(custom_title, hint) );
}
//The field will be added separately.
@@ -4522,7 +4522,7 @@ void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutGroup>
auto portal = std::dynamic_pointer_cast<LayoutItem_Portal>(group);
if(!portal)
{
- the_list.push_back( pair_translatable_item_and_hint(group, hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(group, hint) );
}
const auto group_name = group->get_name();
@@ -4553,22 +4553,22 @@ void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutGroup>
//Buttons too:
auto button = std::dynamic_pointer_cast<LayoutItem_Button>(item);
if(button)
- the_list.push_back( pair_translatable_item_and_hint(button, this_hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(button, this_hint) );
else
{
auto text = std::dynamic_pointer_cast<LayoutItem_Text>(item);
if(text)
{
- the_list.push_back( pair_translatable_item_and_hint(text, this_hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(text, this_hint) );
if(text->m_text)
- the_list.push_back( pair_translatable_item_and_hint(text->m_text, this_hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(text->m_text, this_hint) );
}
else
{
//Images have titles:
auto image = std::dynamic_pointer_cast<LayoutItem_Image>(item);
if(image)
- the_list.push_back( pair_translatable_item_and_hint(image, this_hint) );
+ the_list.emplace_back( pair_translatable_item_and_hint(image, this_hint) );
else
{
auto layout_field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
@@ -4634,7 +4634,7 @@ std::vector<Glib::ustring> Document::get_library_module_names() const
std::vector<Glib::ustring> result;
for(const auto& script_pair : m_map_library_scripts)
{
- result.push_back(script_pair.first);
+ result.emplace_back(script_pair.first);
}
return result;
@@ -5082,7 +5082,7 @@ Document::type_list_lookups Document::get_lookup_fields(const Glib::ustring& tab
//Add it:
auto item = std::make_shared<LayoutItem_Field>();
item->set_full_field_details(field);
- result.push_back( type_pairFieldTrigger(item, relationship) );
+ result.emplace_back( type_pairFieldTrigger(item, relationship) );
}
}
}
diff --git a/glom/libglom/privs.cc b/glom/libglom/privs.cc
index e3e16fd..cf9a2d5 100644
--- a/glom/libglom/privs.cc
+++ b/glom/libglom/privs.cc
@@ -52,7 +52,7 @@ Privs::type_vec_strings Privs::get_database_groups()
{
const auto value = data_model->get_value_at(0, row);
const auto name = value.get_string();
- result.push_back(name);
+ result.emplace_back(name);
}
}
@@ -128,7 +128,7 @@ Privs::type_vec_strings Privs::get_database_users(const Glib::ustring& group_nam
{
const auto value = data_model->get_value_at(0, row);
const auto name = value.get_string();
- result.push_back(name);
+ result.emplace_back(name);
}
}
}
@@ -174,7 +174,7 @@ Privs::type_vec_strings Privs::get_database_users(const Glib::ustring& group_nam
{
const auto value_user = data_model_user->get_value_at(0, 0);
//std::cout << G_STRFUNC << "DEBUG: username=" << value.get_string() << std::endl;
- result.push_back(value_user.get_string());
+ result.emplace_back(value_user.get_string());
}
else
{
@@ -328,25 +328,25 @@ Privileges Privs::get_table_privileges(const Glib::ustring& group_name, const Gl
//However, note that libgda does seem to escape characters here (for instance, changing ' to '').
//const Glib::ustring group_name_for_arg = connection->quote_sql_identifier(group_name);
const Glib::ustring group_name_for_arg = group_name;
- args_base.push_back(builder->add_expr(group_name_for_arg));
+ args_base.emplace_back(builder->add_expr(group_name_for_arg));
//The table name must be quoted if it needs to be quoted,
//but not quoted if it is does not need to be quoted,
//because it must match how it was created, and libgda probably did not quote it unless necessary.
const auto table_name_for_arg = connection->quote_sql_identifier(table_name);
- args_base.push_back(builder->add_expr(table_name_for_arg));
+ args_base.emplace_back(builder->add_expr(table_name_for_arg));
std::vector<Gnome::Gda::SqlBuilder::Id> args = args_base;
- args.push_back(builder->add_expr("SELECT"));
+ args.emplace_back(builder->add_expr("SELECT"));
builder->add_field_value_id(builder->add_function(function_name, args));
args = args_base;
- args.push_back(builder->add_expr("UPDATE"));
+ args.emplace_back(builder->add_expr("UPDATE"));
builder->add_field_value_id(builder->add_function(function_name, args));
args = args_base;
- args.push_back(builder->add_expr("INSERT"));
+ args.emplace_back(builder->add_expr("INSERT"));
builder->add_field_value_id(builder->add_function(function_name, args));
args = args_base;
- args.push_back(builder->add_expr("DELETE"));
+ args.emplace_back(builder->add_expr("DELETE"));
builder->add_field_value_id(builder->add_function(function_name, args));
//const Glib::ustring sql_debug = Utils::sqlbuilder_get_full_query(builder);
@@ -405,7 +405,7 @@ Privs::type_vec_strings Privs::get_groups_of_user(const Glib::ustring& user)
if(get_user_is_in_group(user, group))
{
//Add the group to the result:
- result.push_back(group);
+ result.emplace_back(group);
}
}
diff --git a/glom/libglom/report_builder.cc b/glom/libglom/report_builder.cc
index a137ab2..bc352f6 100644
--- a/glom/libglom/report_builder.cc
+++ b/glom/libglom/report_builder.cc
@@ -133,7 +133,7 @@ bool ReportBuilder::report_build_summary(const FoundSet& found_set, xmlpp::Eleme
}
else
{
- itemsToGet.push_back( glom_sharedptr_clone(item) );
+ itemsToGet.emplace_back( glom_sharedptr_clone(item) );
}
}
}
@@ -189,7 +189,7 @@ bool ReportBuilder::report_build_groupby_children(const FoundSet& found_set, xml
}
else
{
- itemsToGet.push_back( glom_sharedptr_clone(item) );
+ itemsToGet.emplace_back( glom_sharedptr_clone(item) );
}
}
}
@@ -275,7 +275,7 @@ bool ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
type_vecLayoutItems itemsToGet;
for(const auto& item : group_by->get_secondary_fields()->m_list_items)
{
- itemsToGet.push_back( glom_sharedptr_clone(item) );
+ itemsToGet.emplace_back( glom_sharedptr_clone(item) );
}
if(!itemsToGet.empty())
@@ -326,7 +326,7 @@ bool ReportBuilder::report_build_records_get_fields(const FoundSet& found_set, c
{
auto pField = std::dynamic_pointer_cast<LayoutItem_Field>(item);
if(pField)
- items.push_back(pField);
+ items.emplace_back(pField);
}
}
@@ -357,7 +357,7 @@ bool ReportBuilder::report_build_records(const FoundSet& found_set, xmlpp::Eleme
{
auto layoutitem_field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
if(layoutitem_field)
- fieldsToGet.push_back(layoutitem_field);
+ fieldsToGet.emplace_back(layoutitem_field);
else
{
auto vertical_group = std::dynamic_pointer_cast<LayoutItem_VerticalGroup>(layout_item);
@@ -700,7 +700,7 @@ Glib::ustring ReportBuilder::report_build(const FoundSet& found_set, const std::
}
}
else
- itemsToGet_TopLevel.push_back( glom_sharedptr_clone(pPart) );
+ itemsToGet_TopLevel.emplace_back( glom_sharedptr_clone(pPart) );
}
}
}
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 7442d2d..833343f 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -194,7 +194,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(c
type_vecConstLayoutFields constFieldsToGet;
for(const auto& field : fieldsToGet)
{
- constFieldsToGet.push_back(field);
+ constFieldsToGet.emplace_back(field);
}
return build_sql_select_with_where_clause(table_name, constFieldsToGet, where_clause, extra_join,
sort_clause, limit);
@@ -256,7 +256,7 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
auto uses_rel = std::make_shared<UsesRelationship>();
uses_rel->set_relationship(layout_item->get_relationship());
uses_rel->set_related_relationship(layout_item->get_related_relationship());
- list_relationships.push_back(uses_rel);
+ list_relationships.emplace_back(uses_rel);
}
}
@@ -452,7 +452,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_key(const Glib
type_vecConstLayoutFields constFieldsToGet;
for(const auto& field : fieldsToGet)
{
- constFieldsToGet.push_back(field);
+ constFieldsToGet.emplace_back(field);
}
return build_sql_select_with_key(table_name, constFieldsToGet, key_field, key_value, sort_clause, limit);
@@ -541,7 +541,7 @@ Utils::type_list_values_with_second Utils::get_choice_values(const std::shared_p
}
Utils::type_vecConstLayoutFields fields;
- fields.push_back(layout_choice_first);
+ fields.emplace_back(layout_choice_first);
if(layout_choice_extra)
{
@@ -549,7 +549,7 @@ Utils::type_list_values_with_second Utils::get_choice_values(const std::shared_p
{
const auto& item_field = std::dynamic_pointer_cast<const LayoutItem_Field>(item);
if(item_field)
- fields.push_back(item_field); //TODO: Don't ignore other usable items such as static text.
+ fields.emplace_back(item_field); //TODO: Don't ignore other usable items such as static text.
}
}
@@ -564,7 +564,7 @@ Utils::type_list_values_with_second Utils::get_choice_values(const std::shared_p
//Default to some sort order rather than none:
if(choice_sort_fields.empty())
{
- choice_sort_fields.push_back( type_pair_sort_field(layout_choice_first, true /* ascending */));
+ choice_sort_fields.emplace_back( type_pair_sort_field(layout_choice_first, true /* ascending */));
}
//TODO: Support related relationships (in the UI too):
@@ -612,13 +612,13 @@ Utils::type_list_values_with_second Utils::get_choice_values(const std::shared_p
type_list_values list_values;
for(guint i = 1; i < cols_count; ++i)
{
- list_values.push_back(datamodel->get_value_at(i, row));
+ list_values.emplace_back(datamodel->get_value_at(i, row));
}
itempair.second = list_values;
}
- result.push_back(itempair);
+ result.emplace_back(itempair);
}
}
else
@@ -919,7 +919,7 @@ Utils::type_vec_strings Utils::string_separate(const Glib::ustring& str, const G
}
item = string_trim(item, " ");
- result.push_back(item);
+ result.emplace_back(item);
} //while
return result;
@@ -1490,7 +1490,7 @@ LayoutGroup::type_list_const_items Utils::get_layout_items_plus_primary_key(cons
return items; //It is already in the list:
LayoutGroup::type_list_const_items items_plus_pk = items;
- items_plus_pk.push_back(pk_layout_item);
+ items_plus_pk.emplace_back(pk_layout_item);
return items_plus_pk;
}
@@ -1518,7 +1518,7 @@ LayoutGroup::type_list_items Utils::get_layout_items_plus_primary_key(const Layo
return items; //It is already in the list:
LayoutGroup::type_list_items items_plus_pk = items;
- items_plus_pk.push_back(pk_layout_item);
+ items_plus_pk.emplace_back(pk_layout_item);
return items_plus_pk;
}
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 218961e..5ddb5a4 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -238,7 +238,7 @@ bool Box_Data_Calendar_Related::fill_from_database()
(*pVector)[column_index] = datamodel->get_value_at(column_index, row_index);
}
- m_map_values[date].push_back(pVector);
+ m_map_values[date].emplace_back(pVector);
}
}
@@ -343,7 +343,7 @@ Box_Data_Calendar_Related::type_vecConstLayoutFields Box_Data_Calendar_Related::
//Add it to the list to ensure that we request the date (though it will not really be shown in the
calendar):
auto layout_item_date_field = std::make_shared<LayoutItem_Field>();
layout_item_date_field->set_full_field_details(date_field);
- layout_fields.push_back(layout_item_date_field);
+ layout_fields.emplace_back(layout_item_date_field);
m_query_column_date_field = layout_fields.size() - 1;
return layout_fields;
}
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index fdfc4ed..97dd640 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -308,7 +308,7 @@ bool Box_Data_Details::fill_from_database()
//g_warning("primary_key name = %s", m_field_primary_key->get_name().c_str());
if(!find_if_layout_item_field_is_same_field_exists(fieldsToGet, layout_item_pk))
{
- fieldsToGet.push_back(layout_item_pk);
+ fieldsToGet.emplace_back(layout_item_pk);
index_primary_key = fieldsToGet.size() - 1;
index_primary_key_found = true;
}
diff --git a/glom/mode_data/box_data_list.cc b/glom/mode_data/box_data_list.cc
index a085cb1..0eb5d91 100644
--- a/glom/mode_data/box_data_list.cc
+++ b/glom/mode_data/box_data_list.cc
@@ -432,7 +432,7 @@ void Box_Data_List::create_layout()
}
*/
- items_to_use.push_back(child_item);
+ items_to_use.emplace_back(child_item);
}
}
@@ -446,7 +446,7 @@ void Box_Data_List::create_layout()
layout_item->set_hidden();
layout_item->set_full_field_details(m_AddDel.get_key_field());
- m_FieldsShown.push_back(layout_item); //TODO: Do this only if it is not already present.
+ m_FieldsShown.emplace_back(layout_item); //TODO: Do this only if it is not already present.
}
const auto table_privs = Privs::get_current_privs(m_found_set.m_table_name);
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index fa3a2e8..8eaffca 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -386,7 +386,7 @@ Document::type_list_layout_groups Box_Data_List_Related::create_layout_get_layou
//Do not use get_data_layout_groups(m_layout_name).
//instead do this:
if(m_portal)
- result.push_back(m_portal);
+ result.emplace_back(m_portal);
return result;
}
@@ -462,7 +462,7 @@ void Box_Data_List_Related::create_layout()
}
*/
- items_to_use.push_back(child_item);
+ items_to_use.emplace_back(child_item);
}
}
@@ -474,9 +474,9 @@ void Box_Data_List_Related::create_layout()
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_hidden();
layout_item->set_full_field_details(m_AddDel.get_key_field());
- m_FieldsShown.push_back(layout_item);
+ m_FieldsShown.emplace_back(layout_item);
- items_to_use.push_back(layout_item);
+ items_to_use.emplace_back(layout_item);
}
const auto table_privs = Privs::get_current_privs(m_found_set.m_table_name);
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 464a8e5..0f4ae2e 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -185,7 +185,7 @@ Box_Data_Portal::type_vecConstLayoutFields Box_Data_Portal::get_fields_to_show()
if(document && m_portal)
{
Document::type_list_layout_groups mapGroups;
- mapGroups.push_back(m_portal);
+ mapGroups.emplace_back(m_portal);
auto relationship = m_portal->get_relationship();
if(relationship)
@@ -279,7 +279,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
//Get the value of the navigation related primary key:
type_vecLayoutFields fieldsToGet;
- fieldsToGet.push_back(layout_item);
+ fieldsToGet.emplace_back(layout_item);
//For instance "invoice_line_id" if this is a portal to an "invoice_lines" table:
const auto related_table = m_portal->get_table_used(Glib::ustring() /* not relevant */);
@@ -336,7 +336,7 @@ Document::type_list_layout_groups Box_Data_Portal::create_layout_get_layout()
Document::type_list_layout_groups result;
if(m_portal)
- result.push_back(m_portal);
+ result.emplace_back(m_portal);
return result;
}
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index 1f5a03b..e20af7f 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -87,7 +87,7 @@ void ComboChoicesWithTreeModel::create_model_non_db(guint columns_count)
record.add(*model_column);
//Store it so we can use it and delete it later:
- m_vec_model_columns_string_fixed.push_back(std::move(model_column));
+ m_vec_model_columns_string_fixed.emplace_back(std::move(model_column));
}
//Create the model:
@@ -257,7 +257,7 @@ void ComboChoicesWithTreeModel::set_choices_related(const std::shared_ptr<const
extra_fields = layout_choice_extra_full->get_items_recursive();
LayoutGroup::type_list_const_items layout_items;
- layout_items.push_back(layout_choice_first);
+ layout_items.emplace_back(layout_choice_first);
layout_items.insert(layout_items.end(), extra_fields.begin(), extra_fields.end());
//Make sure that the primary key is also in the list, but hidden,
@@ -281,7 +281,7 @@ void ComboChoicesWithTreeModel::set_choices_related(const std::shared_ptr<const
if(found_set.m_sort_clause.empty())
{
//Sort by the first field, because that is better than so sort at all.
- found_set.m_sort_clause.push_back( FoundSet::type_pair_sort_field(layout_choice_first, true /* ascending
*/) );
+ found_set.m_sort_clause.emplace_back( FoundSet::type_pair_sort_field(layout_choice_first, true /*
ascending */) );
}
m_db_layout_items.clear();
diff --git a/glom/mode_data/datawidget/treemodel_db.cc b/glom/mode_data/datawidget/treemodel_db.cc
index 3e1c392..1a9428b 100644
--- a/glom/mode_data/datawidget/treemodel_db.cc
+++ b/glom/mode_data/datawidget/treemodel_db.cc
@@ -215,7 +215,7 @@ DbTreeModel::DbTreeModel(const FoundSet& found_set, const type_vec_const_layout_
if(item_field->get_glom_type() == Field::glom_field_type::INVALID)
std::cerr << G_STRFUNC << ": field has invalid type. field name: " << item_field->get_name() <<
std::endl;
- m_column_fields.push_back(item_field);
+ m_column_fields.emplace_back(item_field);
}
}
}
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 6b266e6..7953d14 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -923,7 +923,7 @@ void DbAddDel::set_columns(const LayoutGroup::type_list_items& layout_items)
}
*/
- m_column_items.push_back(layout_item);
+ m_column_items.emplace_back(layout_item);
}
//Generate appropriate model columns:
@@ -958,7 +958,7 @@ DbAddDel::type_list_indexes DbAddDel::get_data_model_column_index(const std::sha
if(field->is_same_field(layout_item_field)
&& (including_specified_field_layout || field != layout_item_field))
{
- list_indexes.push_back(data_model_column_index);
+ list_indexes.emplace_back(data_model_column_index);
}
++data_model_column_index;
@@ -988,11 +988,11 @@ DbAddDel::type_list_indexes DbAddDel::get_column_index(const std::shared_ptr<con
const auto field = std::dynamic_pointer_cast<const LayoutItem_Field>(item); //TODO_Performance: This
would be unnecessary if !layout_item_field
if(field && layout_item_field && field->is_same_field(layout_item_field))
{
- list_indexes.push_back(i);
+ list_indexes.emplace_back(i);
}
else if(*(item) == *(layout_item))
{
- list_indexes.push_back(i);
+ list_indexes.emplace_back(i);
}
++i;
@@ -1025,7 +1025,7 @@ DbAddDel::type_list_indexes DbAddDel::get_choice_index(const std::shared_ptr<con
if(choice_relationship && !choice_show_all) //"Show All" choices don't use the ID field values.
{
if(choice_relationship->get_from_field() == from_key_name)
- result.push_back(index);
+ result.emplace_back(index);
}
index++;
@@ -1594,7 +1594,7 @@ void DbAddDel::on_treeview_column_clicked(int model_column_index)
//Set the sort clause to be used by refresh_from_database():
m_found_set.m_sort_clause.clear();
- m_found_set.m_sort_clause.push_back( type_pair_sort_field(layout_item, ascending) );
+ m_found_set.m_sort_clause.emplace_back( type_pair_sort_field(layout_item, ascending) );
}
refresh_from_database();
@@ -1618,7 +1618,7 @@ void DbAddDel::on_treeview_columns_changed()
if(pViewColumn)
{
const auto column_id = pViewColumn->get_column_id();
- m_vecColumnIDs.push_back(column_id);
+ m_vecColumnIDs.emplace_back(column_id);
}
}
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 964a30a..3cf67e3 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -234,7 +234,7 @@ void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& g
add_widgets(*frame, true /* expand */);
- m_sub_flow_tables.push_back(flow_table);
+ m_sub_flow_tables.emplace_back(flow_table);
flow_table->set_layout_item(group, m_table_name);
add_layoutwidgetbase(flow_table);
@@ -277,7 +277,7 @@ Box_Data_List_Related* FlowTableWithFields::create_related(const std::shared_ptr
portal_box->set_layout_item(portal, to_table);
portal_box->show();
- m_portals.push_back(portal_box);
+ m_portals.emplace_back(portal_box);
//Connect signals:
//Just reemit this object's signal when receiving the same signal from the portal:
@@ -317,7 +317,7 @@ Box_Data_Calendar_Related* FlowTableWithFields::create_related_calendar(const st
portal_box->set_layout_item(portal, to_table);
portal_box->show();
- m_portals.push_back(portal_box);
+ m_portals.emplace_back(portal_box);
//Connect signals:
//Just reemit this object's signal when receiving the same signal from the portal:
@@ -428,7 +428,7 @@ void FlowTableWithFields::add_layout_notebook(const std::shared_ptr<LayoutItem_N
}
}
- m_sub_flow_tables.push_back(flow_table);
+ m_sub_flow_tables.emplace_back(flow_table);
flow_table->set_layout_item(group, m_table_name);
add_layoutwidgetbase(flow_table);
@@ -521,7 +521,7 @@ void FlowTableWithFields::add_field(const std::shared_ptr<LayoutItem_Field>& lay
info.m_second->signal_open_details_requested().connect( sigc::bind(sigc::mem_fun(*this,
&FlowTableWithFields::on_entry_open_details_requested), layoutitem_field) );
- m_listFields.push_back(info); //This would be the wrong position, but you should only use this method
directly when you expect it to be followed by a complete re-layout.
+ m_listFields.emplace_back(info); //This would be the wrong position, but you should only use this method
directly when you expect it to be followed by a complete re-layout.
}
@@ -635,7 +635,7 @@ void FlowTableWithFields::get_layout_groups(Document::type_list_layout_groups& g
std::shared_ptr<LayoutGroup> group(get_layout_group());
if(group)
{
- groups.push_back(group);
+ groups.emplace_back(group);
}
}
@@ -789,7 +789,7 @@ FlowTableWithFields::type_portals FlowTableWithFields::get_portals(const std::sh
{
auto relationship = portal->get_relationship(); //In this case, we only care about the first
relationship (not any child relationships), because that's what would trigger a change.
if(relationship && (relationship->get_from_field() == from_key_name))
- result.push_back(pPortalUI);
+ result.emplace_back(pPortalUI);
}
else
{
@@ -851,7 +851,7 @@ FlowTableWithFields::type_choice_widgets FlowTableWithFields::get_choice_widgets
continue; //"Show All" choices don't use the ID field values.
if(choice_relationship->get_from_field() == from_key_name)
- result.push_back(combochoices);
+ result.emplace_back(combochoices);
}
//Check the sub-flowtables:
@@ -1050,7 +1050,7 @@ void FlowTableWithFields::set_design_mode(bool value)
void FlowTableWithFields::add_layoutwidgetbase(LayoutWidgetBase* layout_widget)
{
- m_list_layoutwidgets.push_back(layout_widget);
+ m_list_layoutwidgets.emplace_back(layout_widget);
//Handle layout_changed signal:
#ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_design/box_db_table_relationships.cc b/glom/mode_design/box_db_table_relationships.cc
index 419ebe0..e9f1b74 100644
--- a/glom/mode_design/box_db_table_relationships.cc
+++ b/glom/mode_design/box_db_table_relationships.cc
@@ -163,7 +163,7 @@ void Box_DB_Table_Relationships::save_to_document()
relationship->set_allow_edit(m_AddDel.get_value_as_bool(item, m_colAllowEdit));
relationship->set_auto_create(m_AddDel.get_value_as_bool(item, m_colAutoCreate));
- vecRelationships.push_back(relationship);
+ vecRelationships.emplace_back(relationship);
}
}
}
diff --git a/glom/mode_design/fields/box_db_table_definition.cc
b/glom/mode_design/fields/box_db_table_definition.cc
index 0cacf23..a5b805f 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -79,7 +79,7 @@ void Box_DB_Table_Definition::init()
for(auto iter = mapFieldTypes.begin(); iter != mapFieldTypes.end();++iter)
{
const Glib::ustring& name = (*iter).second;
- vecTypes.push_back(name);
+ vecTypes.emplace_back(name);
}
m_AddDel.set_column_choices(m_colType, vecTypes);
@@ -217,7 +217,7 @@ void Box_DB_Table_Definition::on_adddel_add(const Gtk::TreeModel::iterator& row)
{
std::cout << Utils::to_utype(field->get_glom_type()) << std::endl;
Document::type_vec_fields vecFields = pDoc->get_table_fields(m_table_name);
- vecFields.push_back(field);
+ vecFields.emplace_back(field);
pDoc->set_table_fields(m_table_name, vecFields);
}
@@ -563,8 +563,8 @@ std::shared_ptr<Field> Box_DB_Table_Definition::change_definition(const std::sha
{
auto existing_primary_key_unset = glom_sharedptr_clone(existing_primary_key);
existing_primary_key_unset->set_primary_key(false);
- old_fields.push_back(existing_primary_key);
- new_fields.push_back(existing_primary_key_unset);
+ old_fields.emplace_back(existing_primary_key);
+ new_fields.emplace_back(existing_primary_key_unset);
}
}
@@ -574,8 +574,8 @@ std::shared_ptr<Field> Box_DB_Table_Definition::change_definition(const std::sha
document->forget_layout_record_viewed(m_table_name);
}
- old_fields.push_back(fieldOld);
- new_fields.push_back(glom_sharedptr_clone(field));
+ old_fields.emplace_back(fieldOld);
+ new_fields.emplace_back(glom_sharedptr_clone(field));
//TODO: Warn about a delay, and possible loss of precision, before actually
//changing types or when the backend needs to recreate the whole column or
@@ -617,7 +617,7 @@ std::shared_ptr<Field> Box_DB_Table_Definition::change_definition(const std::sha
else
{
//Add it, because it's not there already:
- vecFields.push_back( glom_sharedptr_clone(new_fields[i]) );
+ vecFields.emplace_back( glom_sharedptr_clone(new_fields[i]) );
}
// TODO_Performance: Can we do this at the end, after the loop? Or do
diff --git a/glom/mode_design/iso_codes.cc b/glom/mode_design/iso_codes.cc
index f5f49be..5079aeb 100644
--- a/glom/mode_design/iso_codes.cc
+++ b/glom/mode_design/iso_codes.cc
@@ -81,7 +81,7 @@ type_list_currencies get_list_of_currency_symbols()
currency.m_name = name;
}
- list_currencies.push_back(currency);
+ list_currencies.emplace_back(currency);
}
}
}
@@ -133,14 +133,14 @@ Glib::ustring get_locale_name(const Glib::ustring& locale_id)
{
Glib::ustring id_language, id_country;
split_locale_id(id, id_language, id_country);
- list_ids_simple.push_back(id_language);
+ list_ids_simple.emplace_back(id_language);
}
//Add the non-specific locales:
for(const auto& id : list_ids_simple)
{
if(!Utils::find_exists(list_ids, id))
- list_ids.push_back(id);
+ list_ids.emplace_back(id);
}
//Get the (translated) language names:
@@ -301,7 +301,7 @@ type_list_locales get_list_of_locales()
//Put the map into a list:
for(const auto& the_pair : map_locales)
{
- list_locales.push_back(the_pair.second);
+ list_locales.emplace_back(the_pair.second);
}
}
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index 8d9e90c..5ba0588 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -269,7 +269,7 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
field->set_full_field_details(field_details);
field->set_name(row[m_ColumnsFields.m_col_name]);
- list_fields.push_back(field);
+ list_fields.emplace_back(field);
}
return list_fields;
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc
b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index e9a8b51..c047d32 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -169,7 +169,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
Document::type_list_layout_groups mapGroups;
if(m_portal)
{
- mapGroups.push_back(m_portal);
+ mapGroups.emplace_back(m_portal);
document->fill_layout_field_details(related_table_name, mapGroups); //Update with full field
information.
}
diff --git a/glom/mode_design/layout/dialog_layout_details.cc
b/glom/mode_design/layout/dialog_layout_details.cc
index 1a251f1..3bea9e4 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -345,7 +345,7 @@ void Dialog_Layout_Details::init(const Glib::ustring& layout_name, const Glib::u
group->set_name("main");
group->set_columns_count(1);
- list_groups.push_back(group);
+ list_groups.emplace_back(group);
}
//Show the field layout
@@ -1072,7 +1072,7 @@ void Dialog_Layout_Details::save_to_document()
fill_group(row, group);
- list_groups.push_back(group);
+ list_groups.emplace_back(group);
}
if(document)
diff --git a/glom/mode_design/layout/dialog_layout_export.cc b/glom/mode_design/layout/dialog_layout_export.cc
index f46a790..14d2457 100644
--- a/glom/mode_design/layout/dialog_layout_export.cc
+++ b/glom/mode_design/layout/dialog_layout_export.cc
@@ -238,7 +238,7 @@ void Dialog_Layout_Export::get_layout_groups(Document::type_list_layout_groups&
}
}
- groups.push_back(others);
+ groups.emplace_back(others);
layout_groups.swap(groups);
}
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc
b/glom/mode_design/layout/dialog_layout_list_related.cc
index 9303e6f..fc56869 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -225,7 +225,7 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
{
m_combo_relationship->set_selected_relationship(m_portal->get_relationship(),
m_portal->get_related_relationship());
- mapGroups.push_back(m_portal);
+ mapGroups.emplace_back(m_portal);
document->fill_layout_field_details(related_table_name, mapGroups); //Update with full field
information.
//Show the field layout
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
index 1a49c38..6b7face 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -422,7 +422,7 @@ bool Box_Formatting::get_formatting(Formatting& format) const
{
auto choicevalue = std::make_shared<ChoiceValue>();
choicevalue->set_value(value);
- list_choice_values.push_back(choicevalue);
+ list_choice_values.emplace_back(choicevalue);
}
}
}
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
index 05bef79..60a9298 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
@@ -193,7 +193,7 @@ LayoutItem_GroupBy::type_list_sort_fields Dialog_SortFields::get_fields() const
auto field_copy = glom_sharedptr_clone(item);
const bool ascending = row[m_ColumnsFields.m_col_ascending];
- result.push_back( LayoutItem_GroupBy::type_pair_sort_field(field_copy, ascending) );
+ result.emplace_back( LayoutItem_GroupBy::type_pair_sort_field(field_copy, ascending) );
++field_sequence;
}
diff --git a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
index 314b46c..7dbb043 100644
--- a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
+++ b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
@@ -47,7 +47,7 @@ PrintLayoutToolbarButton::PrintLayoutToolbarButton(const std::string& icon_name,
g_object_set_data(G_OBJECT(gobj()), "glom-type", GINT_TO_POINTER(type));
std::vector<Gtk::TargetEntry> targetentries;
- targetentries.push_back(Gtk::TargetEntry(get_target()));
+ targetentries.emplace_back(Gtk::TargetEntry(get_target()));
drag_source_set(targetentries, Gdk::MODIFIER_MASK,
Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 50927f0..684778b 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -97,7 +97,7 @@ Window_PrintLayout_Edit::Window_PrintLayout_Edit(BaseObjectType* cobject, const
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_spinbutton_height));
const Gtk::TargetEntry target_rule(DRAG_TARGET_NAME_RULE, Gtk::TARGET_SAME_APP, 0);
- m_drag_targets_rule.push_back(target_rule);
+ m_drag_targets_rule.emplace_back(target_rule);
//The rulers are not in the glade file because they use an unusual widget
//that Glade wouldn't usually know about:
@@ -150,7 +150,7 @@ Window_PrintLayout_Edit::Window_PrintLayout_Edit(BaseObjectType* cobject, const
//TODO: Does this need to be a member variable?
m_drag_targets_all = m_drag_targets_rule;
const auto toolbar_target = Gtk::ToolPalette::get_drag_target_item();
- m_drag_targets_all.push_back(toolbar_target);
+ m_drag_targets_all.emplace_back(toolbar_target);
//Note that we don't use Gtk::DEST_DEFAULT_DEFAULTS because that would prevent our signal handlers from
being used:
m_canvas.drag_dest_set(m_drag_targets_all, Gtk::DEST_DEFAULT_HIGHLIGHT, Gdk::ACTION_COPY);
@@ -1059,7 +1059,7 @@ void Window_PrintLayout_Edit::on_menu_edit_copy()
auto cloned =
glom_sharedptr_clone(item->get_layout_item());
- m_layout_items_to_paste.push_back(cloned);
+ m_layout_items_to_paste.emplace_back(cloned);
}
m_action_edit_paste->set_enabled();
@@ -1412,8 +1412,8 @@ void Window_PrintLayout_Edit::on_canvas_selection_changed()
continue;
//Cache the selected items and handle their signal_moved signals:
- m_layout_items_selected.push_back(item);
- m_connections_items_selected_moved.push_back(
+ m_layout_items_selected.emplace_back(item);
+ m_connections_items_selected_moved.emplace_back(
item->signal_moved().connect(
sigc::mem_fun(*this, &Window_PrintLayout_Edit::on_selected_item_moved)));
}
diff --git a/glom/mode_design/relationships_overview/window_relationships_overview.cc
b/glom/mode_design/relationships_overview/window_relationships_overview.cc
index 1962500..af558ac 100644
--- a/glom/mode_design/relationships_overview/window_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/window_relationships_overview.cc
@@ -189,7 +189,7 @@ void Window_RelationshipsOverview::draw_tables()
sigc::connection the_connection = table_group->signal_show_context().connect( sigc::bind(
sigc::mem_fun(*this, &Window_RelationshipsOverview::on_table_show_context),
table_group) );
- m_list_table_connections.push_back(the_connection);
+ m_list_table_connections.emplace_back(the_connection);
//tv->x2 = tv->x1 + table_width;
//tv->y2 = tv->y1 + table_height;
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 8a821e9..4991040 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -474,7 +474,7 @@ void Box_Tables::save_to_document()
//std::cout << "debug: " << G_STRFUNC << ": title=" << item_get_title(table_info) << std::endl;
table_info->set_default( m_AddDel.get_value_as_bool(row, m_colDefault) );
- listTables.push_back(table_info);
+ listTables.emplace_back(table_info);
}
}
}
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 88e4e68..212abb0 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -622,13 +622,13 @@ void Canvas_PrintLayout::update_page_bounds()
auto margin_top =
create_margin_line(
bounds.get_x1(), top_y, bounds.get_x2(), top_y);
- m_vec_margin_tops.push_back(margin_top);
+ m_vec_margin_tops.emplace_back(margin_top);
const double bottom_y = paper_size.get_height(units) * (page + 1) -
m_page_setup->get_bottom_margin(units);
auto margin_bottom =
create_margin_line(
bounds.get_x1(), bottom_y, bounds.get_x2(), bottom_y);
- m_vec_margin_bottoms.push_back(margin_bottom);
+ m_vec_margin_bottoms.emplace_back(margin_bottom);
}
m_bounds_group->lower();
@@ -761,7 +761,7 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
auto layoutitem_field = std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
if(layoutitem_field && !(layoutitem_field->get_name().empty()))
{
- fieldsToGet.push_back(layoutitem_field);
+ fieldsToGet.emplace_back(layoutitem_field);
//Remember the index so we can use it later,
//to get the data for this column from the query results:
@@ -1064,7 +1064,7 @@ Base_DB::type_vecConstLayoutFields Canvas_PrintLayout::get_portal_fields_to_show
if(document && portal)
{
Document::type_list_layout_groups mapGroups;
- mapGroups.push_back(portal);
+ mapGroups.emplace_back(portal);
auto relationship = portal->get_relationship();
if(relationship)
@@ -1110,7 +1110,7 @@ Canvas_PrintLayout::type_vec_items Canvas_PrintLayout::get_selected_items()
continue;
if(derived->get_selected())
- result.push_back(derived);
+ result.emplace_back(derived);
}
return result;
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index 732bab9..0274d23 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -57,10 +57,10 @@ static std::list<Glib::ustring> ustring_tokenize(const Glib::ustring& msg, const
unsigned int pos = str.find(separators);
Glib::ustring tmp = str.substr(0, pos);
str = str.erase(0, pos + separators.size());
- result.push_back(tmp);
+ result.emplace_back(tmp);
count++;
}
- result.push_back(str);
+ result.emplace_back(str);
return result;
}
diff --git a/glom/test_pyembed.cc b/glom/test_pyembed.cc
index 23a4eab..0a2b90b 100644
--- a/glom/test_pyembed.cc
+++ b/glom/test_pyembed.cc
@@ -19,10 +19,10 @@ std::list<Glib::ustring> ustring_tokenize(const Glib::ustring& msg, const Glib::
unsigned int pos = str.find(separators);
Glib::ustring tmp = str.substr(0,pos);
str=str.erase(0, pos+separators.size());
- result.push_back(tmp);
+ result.emplace_back(tmp);
count++;
}
- result.push_back(str);
+ result.emplace_back(str);
return result;
}
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index 78fc149..d024b6b 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -849,7 +849,7 @@ void AddDel::remove_all_columns()
guint AddDel::add_column(const AddDelColumnInfo& column_info)
{
- m_ColumnTypes.push_back(column_info);
+ m_ColumnTypes.emplace_back(column_info);
//Generate appropriate model columns:
construct_specified_columns();
@@ -1333,7 +1333,7 @@ void AddDel::on_treeview_columns_changed()
if(pViewColumn)
{
const auto column_id = pViewColumn->get_column_id();
- m_vecColumnIDs.push_back(column_id);
+ m_vecColumnIDs.emplace_back(column_id);
}
}
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.cc
b/glom/utility_widgets/canvas/canvas_group_grid.cc
index 69a0706..66a36eb 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.cc
+++ b/glom/utility_widgets/canvas/canvas_group_grid.cc
@@ -210,14 +210,14 @@ Glib::RefPtr<CanvasLineMovable> CanvasGroupGrid::create_rule_line(double pos, bo
void CanvasGroupGrid::add_vertical_rule(double x)
{
auto line = create_rule_line(x, false);
- m_rules_x.push_back(line);
+ m_rules_x.emplace_back(line);
m_grid_rules_group->add_child(line);
}
void CanvasGroupGrid::add_horizontal_rule(double y)
{
auto line = create_rule_line(y, true);
- m_rules_y.push_back(line);
+ m_rules_y.emplace_back(line);
m_grid_rules_group->add_child(line);
}
@@ -241,7 +241,7 @@ CanvasGroupGrid::type_vec_doubles CanvasGroupGrid::get_horizontal_rules() const
double x = 0;
double y = 0;
line->get_xy(x, y);
- result.push_back(y);
+ result.emplace_back(y);
}
return result;
@@ -258,7 +258,7 @@ CanvasGroupGrid::type_vec_doubles CanvasGroupGrid::get_vertical_rules() const
double x = 0;
double y = 0;
line->get_xy(x, y);
- result.push_back(x);
+ result.emplace_back(x);
}
return result;
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 784971d..dd4139f 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -136,7 +136,7 @@ void FlowTable::insert(Gtk::Widget* first, Gtk::Widget* second, int index, bool
if(first && second)
{
auto hbox = new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, get_horizontal_spacing());
- m_list_hboxes.push_back(hbox); //So we can delete it whenever necessary.
+ m_list_hboxes.emplace_back(hbox); //So we can delete it whenever necessary.
hbox->pack_start(*first, Gtk::PACK_SHRINK);
hbox->pack_start(*second, expand ? Gtk::PACK_EXPAND_WIDGET : Gtk::PACK_SHRINK);
@@ -146,14 +146,14 @@ void FlowTable::insert(Gtk::Widget* first, Gtk::Widget* second, int index, bool
Egg::SpreadTableDnd::insert_child(*hbox, index);
//std::cout << "DEBUG: inserted hbox=" << hbox << " for first=" << first << std::endl;
- m_list_first_widgets.push_back(first);
+ m_list_first_widgets.emplace_back(first);
}
else if(first)
{
first->set_halign(expand ? Gtk::ALIGN_FILL : Gtk::ALIGN_START);
Egg::SpreadTableDnd::append_child(*first);
//std::cout << "DEBUG: inserted first=" << first << std::endl;
- m_list_first_widgets.push_back(first);
+ m_list_first_widgets.emplace_back(first);
}
else
{
@@ -251,7 +251,7 @@ bool FlowTable::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
cr->set_line_cap(Cairo::LINE_CAP_SQUARE);
cr->set_line_join(Cairo::LINE_JOIN_MITER);
std::vector<double> dashes;
- dashes.push_back(10);
+ dashes.emplace_back(10);
cr->set_dash(dashes, 0);
//Draw lines based on the allocations of the "first" widgets:
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 3149d1b..5b460b1 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -295,7 +295,7 @@ void ImageGlom::fill_evince_supported_mime_types()
while((mime_type = info->mime_types[i++]))
{
if(mime_type)
- m_evince_supported_mime_types.push_back(mime_type);
+ m_evince_supported_mime_types.emplace_back(mime_type);
//std::cout << "evince supported mime_type=" << mime_type << std::endl;
}
}
@@ -860,7 +860,7 @@ void ImageGlom::on_menupopup_activate_copy()
}
std::vector<Gtk::TargetEntry> listTargets;
- listTargets.push_back( Gtk::TargetEntry(mime_type) );
+ listTargets.emplace_back( Gtk::TargetEntry(mime_type) );
refClipboard->set( listTargets, sigc::mem_fun(*this, &ImageGlom::on_clipboard_get), sigc::mem_fun(*this,
&ImageGlom::on_clipboard_clear) );
}
diff --git a/glom/utility_widgets/layouttoolbarbutton.cc b/glom/utility_widgets/layouttoolbarbutton.cc
index e9002ba..8dc56db 100644
--- a/glom/utility_widgets/layouttoolbarbutton.cc
+++ b/glom/utility_widgets/layouttoolbarbutton.cc
@@ -45,7 +45,7 @@ LayoutToolbarButton::LayoutToolbarButton(const std::string& icon_name, LayoutWid
g_object_set_data(G_OBJECT(gobj()), "glom-type", GINT_TO_POINTER(type));
std::vector<Gtk::TargetEntry> targetentries;
- targetentries.push_back(Gtk::TargetEntry(get_target()));
+ targetentries.emplace_back(Gtk::TargetEntry(get_target()));
drag_source_set(targetentries, Gdk::MODIFIER_MASK,
Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
diff --git a/glom/utility_widgets/test_flowtable.cc b/glom/utility_widgets/test_flowtable.cc
index e4c5573..cbd952e 100644
--- a/glom/utility_widgets/test_flowtable.cc
+++ b/glom/utility_widgets/test_flowtable.cc
@@ -50,26 +50,26 @@ static void fill_flowtable(Glom::FlowTable& flowtable)
button1->set_text("one");
button1->show();
//button1->set_size_request(100, 100);
- vec_child_widgets.push_back(button1);
+ vec_child_widgets.emplace_back(button1);
auto button2 = Gtk::manage(new Gtk::Entry());
button2->set_text("two");
flowtable.add_widgets(*button1, *button2);
button2->show();
//button2->set_size_request(100, 100);
- vec_child_widgets.push_back(button2);
+ vec_child_widgets.emplace_back(button2);
auto button3 = Gtk::manage(new Gtk::Label());
button3->set_text("three"); //TODO: valgrind says that something here is leaked.
button3->show();
//button1->set_size_request(100, 100);
- vec_child_widgets.push_back(button3);
+ vec_child_widgets.emplace_back(button3);
auto button4 = Gtk::manage(new Gtk::Entry());
button4->set_text("four");
flowtable.add_widgets(*button3, *button4);
button4->show();
- vec_child_widgets.push_back(button4);
+ vec_child_widgets.emplace_back(button4);
auto button5 = Gtk::manage(new Gtk::Entry());
button5->set_text("five");
@@ -78,8 +78,8 @@ static void fill_flowtable(Glom::FlowTable& flowtable)
flowtable.add_widgets(*button5, *button6);
button5->show();
button6->show();
- vec_child_widgets.push_back(button5);
- vec_child_widgets.push_back(button6);
+ vec_child_widgets.emplace_back(button5);
+ vec_child_widgets.emplace_back(button6);
}
static void clear_flowtable(Glom::FlowTable& flowtable)
diff --git a/tests/import/test_parsing.cc b/tests/import/test_parsing.cc
index f359cb6..b03e45b 100644
--- a/tests/import/test_parsing.cc
+++ b/tests/import/test_parsing.cc
@@ -29,7 +29,7 @@ void on_line_scanned(const std::vector<Glib::ustring>& row, guint /*line_number*
{
//std::cout << "debug: " << G_STRFUNC << ": item=" << *iter << std::endl;
- get_tokens_instance().push_back(*iter);
+ get_tokens_instance().emplace_back(*iter);
}
}
diff --git a/tests/test_fake_connection.cc b/tests/test_fake_connection.cc
index 4a88c7f..a210db7 100644
--- a/tests/test_fake_connection.cc
+++ b/tests/test_fake_connection.cc
@@ -74,11 +74,11 @@ int main()
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
diff --git a/tests/test_selfhosting_new_empty_then_users.cc b/tests/test_selfhosting_new_empty_then_users.cc
index 1b4e58a..35489d2 100644
--- a/tests/test_selfhosting_new_empty_then_users.cc
+++ b/tests/test_selfhosting_new_empty_then_users.cc
@@ -141,7 +141,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
//MySQL has a 64-character limit on SQL identifiers:
if(hosting_mode != Glom::Document::HostingMode::MYSQL_SELF)
{
-
table_names.push_back("sometablewithaverylongnameyaddayaddayaddayaddayaddyaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayadda");
+
table_names.emplace_back("sometablewithaverylongnameyaddayaddayaddayaddayaddyaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayadda");
}
//Add some tables, for the groups to have rights for:
@@ -186,7 +186,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
"somegroup with a ' quote character",
"somegroupwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayad"} ); //Almost too big.
//We expect this to fail because of an apparently-undocumented max pg_user size of 63 characters in
PostgreSQL:
- //group_names.push_back("somegroupwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
+ //group_names.emplace_back("somegroupwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
//Add groups:
for(const auto& group_name : group_names)
@@ -206,7 +206,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
"someuser with a ' quote character",
"someuserwithaverylongnameyaddayaddayaddayaddayaddyaddayadda"} ); //Almost too big, with space for the
numeric suffix below.
//We expect this to fail because of an apparently-undocumented max pg_user size of 63 characters in
PostgreSQL:
- //user_names.push_back("someuserwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
+ //user_names.emplace_back("someuserwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
guint i = 0;
for(const auto& user_name : user_names)
diff --git a/tests/test_selfhosting_new_from_example_float.cc
b/tests/test_selfhosting_new_from_example_float.cc
index eb07b6f..ec51396 100644
--- a/tests/test_selfhosting_new_from_example_float.cc
+++ b/tests/test_selfhosting_new_from_example_float.cc
@@ -58,7 +58,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
auto field = document->get_field(table_name, "price");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause(table_name,
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
index be6880e..bd36421 100644
--- a/tests/test_selfhosting_new_then_image.cc
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -78,7 +78,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
Glom::Utils::type_vecLayoutFields fieldsToGet;
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder_get =
Glom::Utils::build_sql_select_with_where_clause(table_name,
diff --git a/tests/test_selfhosting_sqlinjection.cc b/tests/test_selfhosting_sqlinjection.cc
index a07c223..4dcae89 100644
--- a/tests/test_selfhosting_sqlinjection.cc
+++ b/tests/test_selfhosting_sqlinjection.cc
@@ -41,11 +41,11 @@ static bool check_get_extra_rows(const Glib::ustring& quote_char)
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
@@ -74,11 +74,11 @@ static bool check_drop_table(const Glib::ustring& quote_char)
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
@@ -114,11 +114,11 @@ static bool check_avoid_quotes_and_drop_table_with_false_value_type()
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
@@ -174,11 +174,11 @@ static bool check_avoid_quotes_and_drop_table_with_false_field_type()
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 7cbe874..f5c4a3a 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -428,7 +428,7 @@ bool test_table_exists(const Glib::ustring& table_name, const std::shared_ptr<Gl
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause(table_name,
@@ -458,7 +458,7 @@ static bool test_example_musiccollection_data_related(const std::shared_ptr<cons
auto field_album_id = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field_album_id);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
auto field = document->get_field("albums", "name");
if(!field)
{
@@ -467,7 +467,7 @@ static bool test_example_musiccollection_data_related(const std::shared_ptr<cons
}
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
//Related field:
const auto relationship = document->get_relationship("albums", "artist");
@@ -485,7 +485,7 @@ static bool test_example_musiccollection_data_related(const std::shared_ptr<cons
return false;
}
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_key("albums", fieldsToGet, field_album_id, album_id);
@@ -518,7 +518,7 @@ bool test_example_musiccollection_data(const std::shared_ptr<const Glom::Documen
auto field = document->get_field("albums", "album_id");
auto layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
field = document->get_field("albums", "name");
if(!field)
@@ -528,7 +528,7 @@ bool test_example_musiccollection_data(const std::shared_ptr<const Glom::Documen
}
layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
- fieldsToGet.push_back(layoutitem);
+ fieldsToGet.emplace_back(layoutitem);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
Glom::Utils::build_sql_select_with_where_clause("albums",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]