Commit 37a00864 authored by Murray Cumming's avatar Murray Cumming
Browse files

C++11: Use auto for shared_ptr<>.

parent 695eef66
......@@ -1118,7 +1118,7 @@ bool AppWindow::on_document_load()
{
Glib::ustring error_message; //TODO: Check this and tell the user.
auto connection_pool = ConnectionPool::get_instance();
std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
auto sharedconnection = connection_pool->connect();
AppPythonUICallbacks callbacks;
glom_execute_python_function_implementation(script,
type_map_fields(), //only used when there is a current table and record.
......@@ -1262,7 +1262,7 @@ void AppWindow::update_userlevel_ui()
{
if(ConnectionPool::get_instance_is_ready())
{
std::shared_ptr<SharedConnection> connection = ConnectionPool::get_and_connect();
auto connection = ConnectionPool::get_and_connect();
if(connection && !connection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
m_action_developer_users->set_enabled(false);
}
......@@ -1514,7 +1514,7 @@ bool AppWindow::recreate_database_from_example(bool& user_cancelled)
try
{
connection_pool->set_ready_to_connect(); //This has succeeded already.
std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
auto sharedconnection = connection_pool->connect();
std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
return false; //Connection to the database succeeded, because no exception was thrown. so the database exists already.
......@@ -1658,7 +1658,7 @@ bool AppWindow::recreate_database_from_backup(const std::string& backup_data_fil
try
{
connection_pool->set_ready_to_connect(); //This has succeeded already.
std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
auto sharedconnection = connection_pool->connect();
std::cerr << G_STRFUNC << ": Failed because database exists already." << std::endl;
return false; //Connection to the database succeeded, because no exception was thrown. so the database exists already.
......
......@@ -219,7 +219,7 @@ namespace
// Check primary key and uniqueness constraints when changing a column
std::shared_ptr<Field> check_field_change_constraints(const std::shared_ptr<const Field>& field_old, const std::shared_ptr<const Field>& field)
{
std::shared_ptr<Field> result = glom_sharedptr_clone(field);
auto result = glom_sharedptr_clone(field);
bool primary_key_was_unset = false;
if(field_old->get_primary_key() != field->get_primary_key())
{
......@@ -256,7 +256,7 @@ namespace
std::shared_ptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field_old, const std::shared_ptr<const Field>& field, Gtk::Window* parent_window) const
{
auto connection_pool = ConnectionPool::get_instance();
std::shared_ptr<Field> result = check_field_change_constraints(field_old, field);
auto result = check_field_change_constraints(field_old, field);
//TODO: change_column() doesn't throw any exception.
try
......@@ -453,7 +453,7 @@ std::shared_ptr<LayoutItem_Field> Base_DB::offer_field_formatting(const std::sha
std::shared_ptr<LayoutItem_Text> Base_DB::offer_textobject(const std::shared_ptr<LayoutItem_Text>& start_textobject, Gtk::Window* transient_for, bool show_title)
{
std::shared_ptr<LayoutItem_Text> result = start_textobject;
auto result = start_textobject;
Dialog_TextObject* dialog = nullptr;
Utils::get_glade_widget_derived_with_warning(dialog);
......@@ -479,7 +479,7 @@ std::shared_ptr<LayoutItem_Text> Base_DB::offer_textobject(const std::shared_ptr
std::shared_ptr<LayoutItem_Image> Base_DB::offer_imageobject(const std::shared_ptr<LayoutItem_Image>& start_imageobject, Gtk::Window* transient_for, bool show_title)
{
std::shared_ptr<LayoutItem_Image> result = start_imageobject;
auto result = start_imageobject;
Dialog_ImageObject* dialog = nullptr;
Utils::get_glade_widget_derived_with_warning(dialog);
......@@ -585,7 +585,7 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
for(const auto& item : group->get_items())
{
std::shared_ptr<LayoutItem_Field> item_field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
auto item_field = std::dynamic_pointer_cast<LayoutItem_Field>(item);
if(item_field)
{
//Get the field info:
......@@ -594,10 +594,10 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
if(item_field->get_has_relationship_name()) //If it's a field in a related table.
{
//TODO_Performance: get_fields_for_table_one_field() is probably very inefficient
std::shared_ptr<Field> field = DbUtils::get_fields_for_table_one_field(document, item_field->get_table_used(table_name), item->get_name());
auto field = DbUtils::get_fields_for_table_one_field(document, item_field->get_table_used(table_name), item->get_name());
if(field)
{
std::shared_ptr<LayoutItem_Field> layout_item = item_field;
auto layout_item = item_field;
layout_item->set_full_field_details(field); //Fill in the full field information for later.
......@@ -620,7 +620,7 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
//If the field does not exist anymore then we won't try to show it:
if(iterFind != all_db_fields.end() )
{
std::shared_ptr<LayoutItem_Field> layout_item = item_field;
auto layout_item = item_field;
layout_item->set_full_field_details(*iterFind); //Fill the LayoutItem with the full field information.
//std::cout << "debug: " << G_STRFUNC << ": name=" << layout_item->get_name() << std::endl;
......@@ -635,10 +635,10 @@ void Base_DB::get_table_fields_to_show_for_sequence_add_group(const Glib::ustrin
}
else
{
std::shared_ptr<LayoutGroup> item_group = std::dynamic_pointer_cast<LayoutGroup>(item);
auto item_group = std::dynamic_pointer_cast<LayoutGroup>(item);
if(item_group)
{
std::shared_ptr<LayoutItem_Portal> item_portal = std::dynamic_pointer_cast<LayoutItem_Portal>(item);
auto item_portal = std::dynamic_pointer_cast<LayoutItem_Portal>(item);
if(!item_portal) //Do not recurse into portals. They are filled by means of a separate SQL query.
{
//Recurse:
......@@ -677,7 +677,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
Glib::ustring primary_key_field_name;
if(bPrimaryKeyFound)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(all_fields[iPrimaryKey]);
//Don't use thousands separators with ID numbers:
......@@ -697,7 +697,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
{
if(field_info->get_name() != primary_key_field_name) //We already added the primary key.
{
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_info);
layout_item->set_editable(true); //A sensible default.
......@@ -734,7 +734,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, const std::shared_ptr<const Field>& field)
{
std::shared_ptr<const Field> primary_key = get_field_primary_key_for_table(table_name);
auto primary_key = get_field_primary_key_for_table(table_name);
calculate_field_in_all_records(table_name, field, primary_key);
}
......@@ -756,7 +756,7 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
LayoutFieldInRecord field_in_record;
field_in_record.m_table_name = table_name;
std::shared_ptr<LayoutItem_Field> layoutitem_field = std::make_shared<LayoutItem_Field>();
auto layoutitem_field = std::make_shared<LayoutItem_Field>();
layoutitem_field->set_full_field_details(field);
field_in_record.m_field = layoutitem_field;
field_in_record.m_key = primary_key;
......@@ -824,7 +824,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
}
else
{
std::shared_ptr<const Field> field_needed = field_item_needed->get_full_field_details();
auto field_needed = field_item_needed->get_full_field_details();
if(field_needed)
{
if(field_needed->get_has_calculation())
......@@ -860,11 +860,11 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
const auto field_values = get_record_field_values_for_calculation(field_in_record.m_table_name, field_in_record.m_key, field_in_record.m_key_value);
if(!field_values.empty())
{
std::shared_ptr<const Field> field = calc_progress_refreshed.m_field;
auto field = calc_progress_refreshed.m_field;
if(field)
{
//We need the connection when we run the script, so that the script may use it.
std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
auto sharedconnection = connect_to_server(0 /* parent window */);
g_assert(sharedconnection);
......@@ -882,7 +882,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
calc_progress_refreshed.m_calc_finished = true;
calc_progress_refreshed.m_calc_in_progress = false;
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
//show it:
......@@ -1028,7 +1028,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
type_vecConstLayoutFields list_fields;
std::shared_ptr<const LayoutItem_Field> layout_item = field_in_record.m_field;
auto layout_item = field_in_record.m_field;
list_fields.push_back(layout_item);
Glib::RefPtr<Gnome::Gda::SqlBuilder> 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;
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
list_fields.push_back(layout_item);
Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_where_clause(found_set.m_table_name,
......@@ -1139,7 +1139,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::
//TODO: How do we trigger relcalculation of related fields if necessary?
for(const auto& field_to_examine : document->get_table_fields(table_name)) //TODO_Performance: Cache this?
{
std::shared_ptr<LayoutItem_Field> layoutitem_field_to_examine = std::make_shared<LayoutItem_Field>();
auto layoutitem_field_to_examine = std::make_shared<LayoutItem_Field>();
layoutitem_field_to_examine->set_full_field_details(field_to_examine);
//std::cout << " debug: examining field=" << field_to_examine->get_name() << std::endl;
......@@ -1170,7 +1170,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
type_list_const_field_items result;
std::shared_ptr<const Field> field = layoutitem_field->get_full_field_details();
auto field = layoutitem_field->get_full_field_details();
if(!field)
return result;
......@@ -1198,10 +1198,10 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
Glib::ustring::size_type pos_start = pos_find + prefix_size;
const auto field_name = calculation.substr(pos_start, pos_find_end - pos_start);
std::shared_ptr<Field> field_found = document->get_field(table_name, field_name);
auto field_found = document->get_field(table_name, field_name);
if(field)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_found);
result.push_back(layout_item);
......@@ -1253,11 +1253,11 @@ void Base_DB::do_lookups(const LayoutFieldInRecord& field_in_record, const Gtk::
//std::cout << "debug: " << G_STRFUNC << ": item=" << layout_item->get_name() << std::endl;
std::shared_ptr<const Relationship> relationship = the_pair.second;
const std::shared_ptr<const Field> field_lookup = layout_item->get_full_field_details();
auto relationship = the_pair.second;
const auto field_lookup = layout_item->get_full_field_details();
if(field_lookup)
{
std::shared_ptr<const Field> field_source = DbUtils::get_fields_for_table_one_field(document, relationship->get_to_table(), field_lookup->get_lookup_field());
auto field_source = DbUtils::get_fields_for_table_one_field(document, relationship->get_to_table(), field_lookup->get_lookup_field());
if(field_source)
{
const auto value = DbUtils::get_lookup_value(document, field_in_record.m_table_name, the_pair.second /* relationship */, field_source /* the field to look in to get the value */, field_value /* Value of to and from fields */);
......@@ -1348,7 +1348,7 @@ bool Base_DB::get_relationship_exists(const Glib::ustring& table_name, const Gli
auto document = get_document();
if(document)
{
std::shared_ptr<Relationship> relationship = document->get_relationship(table_name, relationship_name);
auto relationship = document->get_relationship(table_name, relationship_name);
if(relationship)
return true;
}
......@@ -1359,7 +1359,7 @@ bool Base_DB::get_relationship_exists(const Glib::ustring& table_name, const Gli
bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value)
{
//TODO_Performance: This is probably called too often, when we should know that the key is in the found set.
std::shared_ptr<const Field> primary_key = get_field_primary_key_for_table(found_set.m_table_name);
auto primary_key = get_field_primary_key_for_table(found_set.m_table_name);
if(!primary_key)
{
std::cerr << G_STRFUNC << ": No primary key found for table: " << found_set.m_table_name << std::endl;
......@@ -1368,7 +1368,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
type_vecLayoutFields fieldsToGet;
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(primary_key);
fieldsToGet.push_back(layout_item);
......@@ -1420,7 +1420,7 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
}
std::shared_ptr<const Relationship> relationship = portal->get_relationship();
auto relationship = portal->get_relationship();
// Notice that, in the case that this is a portal to doubly-related records,
// The WHERE clause mentions the first-related table (though by the alias defined in extra_join)
......@@ -1429,15 +1429,15 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
auto document = get_document();
Glib::ustring where_clause_to_table_name = relationship->get_to_table();
std::shared_ptr<Field> where_clause_to_key_field = DbUtils::get_fields_for_table_one_field(document, relationship->get_to_table(), relationship->get_to_field());
auto where_clause_to_key_field = DbUtils::get_fields_for_table_one_field(document, relationship->get_to_table(), relationship->get_to_field());
found_set.m_table_name = portal->get_table_used(Glib::ustring() /* parent table - not relevant */);
std::shared_ptr<const Relationship> relationship_related = portal->get_related_relationship();
auto relationship_related = portal->get_related_relationship();
if(relationship_related)
{
//Add the extra JOIN:
std::shared_ptr<UsesRelationship> uses_rel_temp = std::make_shared<UsesRelationship>();
auto uses_rel_temp = std::make_shared<UsesRelationship>();
uses_rel_temp->set_relationship(relationship);
found_set.m_extra_join = relationship;
......
......@@ -58,7 +58,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
auto document = get_document();
std::shared_ptr<const Field> fieldPrimaryKey = get_field_primary_key();
auto fieldPrimaryKey = get_field_primary_key();
const Glib::ustring primary_key_name = fieldPrimaryKey->get_name();
......@@ -74,7 +74,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
const auto iterFind = find_if_same_name(fieldsToAdd, item->get_name());
if(iterFind == fieldsToAdd.end())
{
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(item);
fieldsToAdd.push_back(layout_item);
......@@ -125,7 +125,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
//We need the connection when we run the script, so that the script may use it.
// TODO: Is this function supposed to throw an exception?
std::shared_ptr<SharedConnection> sharedconnection = connect_to_server(AppWindow::get_appwindow());
auto sharedconnection = connect_to_server(AppWindow::get_appwindow());
Glib::ustring error_message; //TODO: Check this.
value =
......@@ -295,7 +295,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<cons
if(key_is_auto_increment)
{
//Set the key in the parent table
std::shared_ptr<LayoutItem_Field> item_from_key = std::make_shared<LayoutItem_Field>();
auto item_from_key = std::make_shared<LayoutItem_Field>();
item_from_key->set_name(relationship->get_from_field());
//Show the new from key in the parent table's layout:
......@@ -303,7 +303,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<cons
//Set it in the database too:
auto document = get_document();
std::shared_ptr<Field> field_from_key = DbUtils::get_fields_for_table_one_field(document,
auto field_from_key = DbUtils::get_fields_for_table_one_field(document,
relationship->get_from_table(), relationship->get_from_field()); //TODO_Performance.
if(!field_from_key)
{
......@@ -311,7 +311,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<cons
return false;
}
std::shared_ptr<Field> parent_primary_key_field = get_field_primary_key();
auto parent_primary_key_field = get_field_primary_key();
if(!parent_primary_key_field)
{
std::cerr << G_STRFUNC << ": get_field_primary_key() failed. table = " << get_table_name() << std::endl;
......@@ -382,7 +382,7 @@ bool Base_DB_Table_Data::confirm_delete_record()
bool Base_DB_Table_Data::record_delete(const Gnome::Gda::Value& primary_key_value)
{
std::shared_ptr<Field> field_primary_key = get_field_primary_key();
auto field_primary_key = get_field_primary_key();
if(field_primary_key && !Conversions::value_is_empty(primary_key_value))
{
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
......@@ -461,7 +461,7 @@ Base_DB_Table_Data::type_vecConstLayoutFields Base_DB_Table_Data::get_related_fi
if(layout_field->get_has_relationship_name())
{
//Get the relationship information:
std::shared_ptr<const Relationship> relationship = document->get_relationship(m_table_name, layout_field->get_relationship_name());
auto relationship = document->get_relationship(m_table_name, layout_field->get_relationship_name());
if(relationship)
{
//If the relationship uses the specified field:
......@@ -517,7 +517,7 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
for(guint uiCol = 0; uiCol < cols_count; ++uiCol)
{
const auto value = result->get_value_at(uiCol, 0 /* row */);
std::shared_ptr<const LayoutItem_Field> layout_item = *iterFields;
auto layout_item = *iterFields;
if(!layout_item)
std::cerr << G_STRFUNC << ": The layout_item was null." << std::endl;
else
......
......@@ -132,7 +132,7 @@ bool Box_Reports::fill_from_database()
void Box_Reports::on_adddel_Add(const Gtk::TreeModel::iterator& row)
{
std::shared_ptr<Report> report = std::make_shared<Report>();
auto report = std::make_shared<Report>();
const auto report_name = m_AddDel.get_value(row, m_colReportName);
if(!report_name.empty())
......@@ -216,7 +216,7 @@ void Box_Reports::on_adddel_changed(const Gtk::TreeModel::iterator& row, guint c
const auto report_name = m_AddDel.get_value_key(row);
auto document = get_document();
std::shared_ptr<Report> report = document->get_report(m_table_name, report_name);
auto report = document->get_report(m_table_name, report_name);
if(report)
{
if(column == m_colTitle)
......
......@@ -372,10 +372,10 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
//then sort by the ID, just so we sort by something, so that the order is predictable:
if(found_set.m_sort_clause.empty())
{
std::shared_ptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
auto field_primary_key = get_field_primary_key_for_table(m_table_name);
if(field_primary_key)
{
std::shared_ptr<LayoutItem_Field> layout_item_sort = std::make_shared<LayoutItem_Field>();
auto layout_item_sort = std::make_shared<LayoutItem_Field>();
layout_item_sort->set_full_field_details(field_primary_key);
found_set.m_sort_clause.clear();
......@@ -384,7 +384,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
//because that would be too slow.
//The user can explicitly request a sort later, by clicking on a column header.
//TODO_Performance: This causes an almost-duplicate COUNT query (we do it in the treemodel too), but it's not that slow.
std::shared_ptr<LayoutItem_Field> layout_item_temp = std::make_shared<LayoutItem_Field>();
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);
......@@ -461,7 +461,7 @@ bool Frame_Glom::attempt_change_usermode_to_developer()
//Check whether the current user has developer privileges:
auto connection_pool = ConnectionPool::get_instance();
std::shared_ptr<SharedConnection> sharedconnection = connection_pool->connect();
auto sharedconnection = connection_pool->connect();
// Default to true; if we don't support users, we always have
// priviliges to change things in developer mode.
......@@ -617,7 +617,7 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
{
const auto value = result->get_value_at(col_index, row_index);
std::shared_ptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
auto layout_item = fieldsSequence[col_index];
//if(layout_item->m_field.get_glom_type() != Field::glom_field_type::IMAGE) //This is too much data.
//{
......@@ -667,14 +667,14 @@ void Frame_Glom::export_data_to_stream(std::ostream& the_stream, const FoundSet&
{
const auto value = result->get_value_at(col_index, row_index);
std::shared_ptr<const LayoutItem_Field> layout_item = fieldsSequence[col_index];
auto layout_item = fieldsSequence[col_index];
//if(layout_item->m_field.get_glom_type() != Field::glom_field_type::IMAGE) //This is too much data.
//{
if(!row_string.empty())
row_string += ",";
//Output data in canonical SQL format, ignoring the user's locale, and ignoring the layout formatting:
std::shared_ptr<const Field> field = layout_item->get_full_field_details();
auto field = layout_item->get_full_field_details();
if(!field)
{
std::cerr << G_STRFUNC << ": A field was null." << std::endl;
......@@ -970,7 +970,7 @@ bool Frame_Glom::attempt_toggle_shared(bool shared)
if(change)
{
auto connectionpool = ConnectionPool::get_instance();
std::shared_ptr<SharedConnection> sharedconnection = connectionpool->connect();
auto sharedconnection = connectionpool->connect();
if(sharedconnection)
{
sharedconnection->close();
......@@ -1175,7 +1175,7 @@ void Frame_Glom::on_dialog_add_related_table_response(int response)
}
//Create the new relationship:
std::shared_ptr<Relationship> relationship = std::make_shared<Relationship>();
auto relationship = std::make_shared<Relationship>();
relationship->set_name(relationship_name);
relationship->set_title(Utils::title_from_string(relationship_name), AppWindow::get_current_locale());
......@@ -1183,7 +1183,7 @@ void Frame_Glom::on_dialog_add_related_table_response(int response)
relationship->set_from_field(from_key_name);
relationship->set_to_table(table_name);
std::shared_ptr<Field> related_primary_key = get_field_primary_key_for_table(table_name); //This field was created by create_table_with_default_fields().
auto related_primary_key = get_field_primary_key_for_table(table_name); //This field was created by create_table_with_default_fields().
if(!related_primary_key)
{
std::cerr << G_STRFUNC << ": get_field_primary_key_for_table() failed." << std::endl;
......@@ -1458,7 +1458,7 @@ void Frame_Glom::update_table_in_document_from_database()
{
//Compare the information:
Glib::RefPtr<Gnome::Gda::Column> field_info_db = field_database->get_field_info();
std::shared_ptr<Field> field_document = *iterFindDoc;
auto field_document = *iterFindDoc;
if(field_document)
{
if(!field_document->field_info_from_database_is_equal( field_info_db )) //ignores auto_increment because libgda does not report it from the database properly.
......@@ -1781,7 +1781,7 @@ void Frame_Glom::on_box_reports_selected(const Glib::ustring& report_name)
{
m_pDialog_Reports->hide();
std::shared_ptr<Report> report = get_document()->get_report(m_table_name, report_name);
auto report = get_document()->get_report(m_table_name, report_name);
if(report)
{
m_pDialogLayoutReport->set_transient_for(*get_app_window());
......@@ -1842,7 +1842,7 @@ void Frame_Glom::on_box_print_layouts_selected(const Glib::ustring& print_layout
m_pDialog_PrintLayouts->hide();
std::shared_ptr<PrintLayout> print_layout = get_document()->get_print_layout(m_table_name, print_layout_name);
auto print_layout = get_document()->get_print_layout(m_table_name, print_layout_name);
if(print_layout)
{
m_pDialogLayoutPrint->set_transient_for(*app_window);
......@@ -2384,7 +2384,7 @@ void Frame_Glom::on_menu_report_selected(const Glib::ustring& report_name)
}
auto document = get_document();
std::shared_ptr<Report> report = document->get_report(m_table_name, report_name);
auto report = document->get_report(m_table_name, report_name);
if(!report)
return;
......@@ -2408,7 +2408,7 @@ void Frame_Glom::on_menu_print_layout_selected(const Glib::ustring& print_layout
void Frame_Glom::do_print_layout(const Glib::ustring& print_layout_name, bool preview, Gtk::Window* transient_for)
{
const auto document = get_document();
std::shared_ptr<const PrintLayout> print_layout = document->get_print_layout(m_table_name, print_layout_name);
auto print_layout = document->get_print_layout(m_table_name, print_layout_name);
const auto table_privs = Privs::get_current_privs(m_table_name);
......@@ -2439,7 +2439,7 @@ void Frame_Glom::on_dialog_layout_report_hide()
if(document && true) //m_pDialogLayoutReport->get_modified())
{
const auto original_name = m_pDialogLayoutReport->get_original_report_name();
std::shared_ptr<Report> report = m_pDialogLayoutReport->get_report();
auto report = m_pDialogLayoutReport->get_report();
if(report && (original_name != report->get_name()))
document->remove_report(m_table_name, original_name);
......@@ -2459,7 +2459,7 @@ void Frame_Glom::on_dialog_layout_print_hide()
if(document && true) //m_pDialogLayoutReport->get_modified())
{
const auto original_name = m_pDialogLayoutPrint->get_original_name();
std::shared_ptr<PrintLayout> print_layout = m_pDialogLayoutPrint->get_print_layout();
auto print_layout = m_pDialogLayoutPrint->get_print_layout();
if(print_layout && (original_name != print_layout->get_name()))
document->remove_report(m_table_name, original_name);
......
......@@ -182,7 +182,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
guint col_index = 0;
for(const auto& str : row)
{
std::shared_ptr<const Field> field = m_data_source->get_field_for_column(col_index++);
auto field = m_data_source->get_field_for_column(col_index++);
if(field)
{
// We always assume exported data is in standard CSV format, since
......
......@@ -568,7 +568,7 @@ void ConnectionPool::on_sharedconnection_finished()
//static
bool ConnectionPool::handle_error_cerr_only()
{
std::shared_ptr<SharedConnection> sharedconnection = get_and_connect();
auto sharedconnection = get_and_connect();
if(sharedconnection)
{
......@@ -787,8 +787,8 @@ bool ConnectionPool::change_columns(const Glib::ustring& table_name, const type_
auto iter_new = new_fields.begin();
while( (iter_old != old_fields.end()) && (iter_new != new_fields.end()) )
{
const std::shared_ptr<const Field> field_old = *iter_old;
const std::shared_ptr<const Field> field_new = *iter_new;
const auto field_old = *iter_old;
const auto field_new = *iter_new;
if(field_old && field_new
&& field_old->get_auto_increment() != field_new->get_auto_increment())
{
......
......@@ -312,7 +312,7 @@ bool Formatting::change_field_item_name(const Glib::ustring& table_name, const G
if(!m_choices_related_field)
return false; //Nothing changed.
std::shared_ptr<const Relationship> relationship = get_relationship();
auto relationship = get_relationship();
const Glib::ustring field_table =
m_choices_related_field->get_table_used( relationship->get_to_table() );
......
......@@ -189,7 +189,7 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive() const
for(const auto& item : m_list_items)
{
std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
auto group = std::dynamic_pointer_cast<const LayoutGroup>(item);
if(group)
{
const auto sub_result = group->get_items_recursive();
......@@ -230,7 +230,7 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive_with_groups(
//Add the item itself:
result.push_back(item);
std::shared_ptr<const LayoutGroup> group = std::dynamic_pointer_cast<const LayoutGroup>(item);
auto group = std::dynamic_pointer_cast<const LayoutGroup>(item);
if(group)
{
const auto sub_result = group->get_items_recursive_with_groups();
......@@ -310,7 +310,7 @@ void LayoutGroup::change_related_field_item_name(const Glib::ustring& table_name
{
if(field_item->get_has_relationship_name()) //If it's related table.
{