Commit b52e5cfb authored by Murray Cumming's avatar Murray Cumming
Browse files

C++11: Replace push_back() with emplace_back().

parent 6105cd88
......@@ -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);
}
......
......@@ -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()
......
......@@ -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);
......
......@@ -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);
}
}
}
......
......@@ -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
{
......
......@@ -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);
......
......@@ -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()
......
......@@ -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;
}
}
......
......@@ -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)
......
......@@ -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);