Commit 745836d5 authored by Murray Cumming's avatar Murray Cumming

C++11: Use std::make_shared.

parent 740dadd8
......@@ -708,7 +708,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(all_fields[iPrimaryKey]);
//Don't use thousands separators with ID numbers:
......@@ -730,7 +730,7 @@ Base_DB::type_vecConstLayoutFields Base_DB::get_table_fields_to_show_for_sequenc
if((*iter)->get_name() != primary_key_field_name) //We already added the primary key.
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_info);
layout_item->set_editable(true); //A sensible default.
......@@ -793,7 +793,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> 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;
......@@ -851,7 +851,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
refCalcProgress.m_calc_in_progress = true; //Let the recursive calls to calculate_field() check this.
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(refCalcProgress.m_field);
//Calculate dependencies first:
......@@ -925,7 +925,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
refCalcProgress.m_calc_finished = true;
refCalcProgress.m_calc_in_progress = false;
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
//show it:
......@@ -962,7 +962,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
type_vecLayoutFields fieldsToGet;
for(Document::type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(*iter);
fieldsToGet.push_back(layout_item);
......@@ -1180,7 +1180,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> 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,
......@@ -1257,7 +1257,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculated_fields(const Glib::
for(type_vec_fields::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
{
std::shared_ptr<Field> field_to_examine = *iter;
std::shared_ptr<LayoutItem_Field> layoutitem_field_to_examine = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> 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;
......@@ -1319,7 +1319,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
std::shared_ptr<Field> field_found = document->get_field(table_name, field_name);
if(field)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_found);
result.push_back(layout_item);
......@@ -1344,7 +1344,7 @@ Base_DB::type_list_const_field_items Base_DB::get_calculation_fields(const Glib:
std::shared_ptr<Field> field_from = document->get_field(table_name, field_from_name);
if(field_from)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field_from);
result.push_back(layout_item);
......@@ -1488,7 +1488,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(primary_key);
fieldsToGet.push_back(layout_item);
......@@ -1557,7 +1557,7 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
if(relationship_related)
{
//Add the extra JOIN:
std::shared_ptr<UsesRelationship> uses_rel_temp = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> uses_rel_temp = std::make_shared<UsesRelationship>();
uses_rel_temp->set_relationship(relationship);
found_set.m_extra_join = relationship;
......
......@@ -43,7 +43,7 @@ Base_DB_Table_Data::~Base_DB_Table_Data()
Gnome::Gda::Value Base_DB_Table_Data::get_entered_field_data_field_only(const std::shared_ptr<const Field>& field) const
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
return get_entered_field_data(layout_item);
......@@ -87,7 +87,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
type_vecConstLayoutFields::const_iterator iterFind = std::find_if(fieldsToAdd.begin(), fieldsToAdd.end(), predicate_FieldHasName<LayoutItem_Field>((*iter)->get_name()));
if(iterFind == fieldsToAdd.end())
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(*iter);
fieldsToAdd.push_back(layout_item);
......@@ -312,7 +312,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> 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:
......
......@@ -127,7 +127,7 @@ bool Box_Reports::fill_from_database()
void Box_Reports::on_adddel_Add(const Gtk::TreeModel::iterator& row)
{
std::shared_ptr<Report> report = std::shared_ptr<Report>(new Report());
std::shared_ptr<Report> report = std::make_shared<Report>();
const Glib::ustring report_name = m_AddDel.get_value(row, m_colReportName);
if(!report_name.empty())
......
......@@ -380,7 +380,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
std::shared_ptr<Field> 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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item_sort = std::make_shared<LayoutItem_Field>();
layout_item_sort->set_full_field_details(field_primary_key);
found_set.m_sort_clause.clear();
......@@ -389,7 +389,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::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> 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);
......@@ -1181,7 +1181,7 @@ void Frame_Glom::on_dialog_add_related_table_response(int response)
}
//Create the new relationship:
std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new Relationship());
std::shared_ptr<Relationship> relationship = std::make_shared<Relationship>();
relationship->set_name(relationship_name);
relationship->set_title(Utils::title_from_string(relationship_name), AppWindow::get_current_locale());
......
......@@ -124,7 +124,7 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
m_encoding_combo->signal_changed().connect(sigc::mem_fun(*this, &Dialog_Import_CSV::on_combo_encoding_changed));
// TODO: Reset parser encoding on selection changed.
m_parser = std::shared_ptr<CsvParser>(new CsvParser(get_current_encoding().c_str()));
m_parser = std::make_shared<CsvParser>(get_current_encoding().c_str());
m_parser->signal_file_read_error().connect(sigc::mem_fun(*this, &Dialog_Import_CSV::on_parser_file_read_error));
m_parser->signal_have_display_name().connect(sigc::mem_fun(*this, &Dialog_Import_CSV::on_parser_have_display_name));
m_parser->signal_encoding_error().connect(sigc::mem_fun(*this, &Dialog_Import_CSV::on_parser_encoding_error));
......
......@@ -195,7 +195,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
// Make the value empty if the value is not unique.
if(field->get_unique_key())
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
if(!get_field_value_is_unique(m_table_name, layout_item, value))
{
......@@ -226,7 +226,7 @@ bool Dialog_Import_CSV_Progress::on_idle_import()
{
// No auto-increment primary key: Check for uniqueness
Gnome::Gda::Value primary_key_value = m_current_row_values[m_field_primary_key->get_name()];
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(m_field_primary_key);
if(!get_field_value_is_unique(m_table_name, layout_item, primary_key_value))
......
......@@ -96,7 +96,7 @@ Glib::ustring HasTitleSingular::get_title_singular_with_fallback(const Glib::ust
void HasTitleSingular::set_title_singular(const Glib::ustring& title, const Glib::ustring& locale)
{
if(!m_title_singular)
m_title_singular = std::shared_ptr<TranslatableItem>(new TranslatableItem());
m_title_singular = std::make_shared<TranslatableItem>();
m_title_singular->set_title(title, locale);
}
......
......@@ -306,7 +306,7 @@ std::shared_ptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation
if(field)
{
return field; //Returns the UsesRelationship base part. (A relationship belonging to the portal's related table.)
//std::shared_ptr<UsesRelationship> result = std::shared_ptr<UsesRelationship>(new UsesRelationship());
//std::shared_ptr<UsesRelationship> result = std::make_shared<UsesRelationship>();
//result->set_relationship( get_relationship() );
//result->set_related_relationship( field->get_relationship() );
......@@ -320,7 +320,7 @@ std::shared_ptr<const UsesRelationship> LayoutItem_Portal::get_portal_navigation
std::shared_ptr<const LayoutItem_Field> field_identifies = get_field_identifies_non_hidden_related_record(used_in_relationship, document);
if(field_identifies)
{
std::shared_ptr<UsesRelationship> result = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> result = std::make_shared<UsesRelationship>();
std::shared_ptr<Relationship> rel_nonconst = std::const_pointer_cast<Relationship>(used_in_relationship);
result->set_relationship(rel_nonconst);
......
......@@ -27,7 +27,7 @@ namespace Glom
LayoutItem_Text::LayoutItem_Text()
{
m_translatable_item_type = TRANSLATABLE_TYPE_TEXTOBJECT;
m_text = std::shared_ptr<StaticText>(new StaticText()); //TODO: Why use a smartpointer?
m_text = std::make_shared<StaticText>(); //TODO: Why use a smartpointer?
}
LayoutItem_Text::LayoutItem_Text(const LayoutItem_Text& src)
......
......@@ -27,7 +27,7 @@ namespace Glom
LayoutItem_GroupBy::LayoutItem_GroupBy()
{
m_group_secondary_fields = std::shared_ptr<LayoutGroup>(new LayoutGroup()); //So that we dont need to create it from outside.
m_group_secondary_fields = std::make_shared<LayoutGroup>(); //So that we dont need to create it from outside.
}
LayoutItem_GroupBy::LayoutItem_GroupBy(const LayoutItem_GroupBy& src)
......
......@@ -31,7 +31,7 @@ PrintLayout::PrintLayout()
m_page_count(1) //A sensible default
{
m_translatable_item_type = TRANSLATABLE_TYPE_PRINT_LAYOUT;
m_layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
m_layout_group = std::make_shared<LayoutGroup>();
}
PrintLayout::PrintLayout(const PrintLayout& src)
......
......@@ -27,7 +27,7 @@ Report::Report()
: m_show_table_title(true)
{
m_translatable_item_type = TRANSLATABLE_TYPE_REPORT;
m_layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
m_layout_group = std::make_shared<LayoutGroup>();
}
Report::Report(const Report& src)
......
......@@ -941,7 +941,7 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
field_info->set_allow_null(value_notnull.get_boolean());
std::shared_ptr<Field> field = std::shared_ptr<Field>(new Field()); //TODO: Get glom-specific information from the document?
std::shared_ptr<Field> field = std::make_shared<Field>(); //TODO: Get glom-specific information from the document?
field->set_field_info(field_info);
......@@ -1228,7 +1228,7 @@ bool create_table(Document::HostingMode hosting_mode, const std::shared_ptr<cons
//(We don't actually use this yet)
if(std::find_if(fields.begin(), fields.end(), predicate_FieldHasName<Field>(GLOM_STANDARD_FIELD_LOCK)) == fields.end())
{
std::shared_ptr<Field> field = std::shared_ptr<Field>(new Field());
std::shared_ptr<Field> field = std::make_shared<Field>();
field->set_name(GLOM_STANDARD_FIELD_LOCK);
field->set_glom_type(Field::TYPE_TEXT);
fields.push_back(field);
......
......@@ -282,7 +282,7 @@ Document::Document()
m_is_backup(false),
m_opened_from_browse(false)
{
m_database_title = std::shared_ptr<DatabaseTitle>(new DatabaseTitle());
m_database_title = std::make_shared<DatabaseTitle>();
//Prevent autosaving during the constructor:
set_allow_autosave(false); //Prevent saving while we modify the document.
......@@ -511,7 +511,7 @@ void Document::set_relationship(const Glib::ustring& table_name, const std::shar
std::shared_ptr<Relationship> Document::create_relationship_system_preferences(const Glib::ustring& table_name)
{
std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new Relationship());
std::shared_ptr<Relationship> relationship = std::make_shared<Relationship>();
relationship->set_name(GLOM_RELATIONSHIP_NAME_SYSTEM_PROPERTIES);
relationship->set_title_original(_("System Preferences"));
relationship->set_from_table(table_name);
......@@ -529,7 +529,7 @@ std::shared_ptr<TableInfo> Document::create_table_system_preferences()
std::shared_ptr<TableInfo> Document::create_table_system_preferences(type_vec_fields& fields)
{
std::shared_ptr<TableInfo> prefs_table_info = std::shared_ptr<TableInfo>(new TableInfo());
std::shared_ptr<TableInfo> prefs_table_info = std::make_shared<TableInfo>();
prefs_table_info->set_name(GLOM_STANDARD_TABLE_PREFS_TABLE_NAME);
prefs_table_info->set_title_original(_("System Preferences"));
prefs_table_info->set_hidden(true);
......@@ -1243,7 +1243,7 @@ void Document::add_table(const std::shared_ptr<TableInfo>& table_info)
type_tables::const_iterator iterfind = m_tables.find(table_info->get_name());
if(iterfind == m_tables.end())
{
const std::shared_ptr<DocumentTableInfo> item = std::shared_ptr<DocumentTableInfo>(new DocumentTableInfo());
const std::shared_ptr<DocumentTableInfo> item = std::make_shared<DocumentTableInfo>();
item->m_info = table_info;
m_tables[table_info->get_name()] = item;
set_modified();
......@@ -1418,13 +1418,13 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
if(layout_name == "details") //The Details default layout is a bit more complicated.
{
overview = std::shared_ptr<LayoutGroup>(new LayoutGroup());;
overview = std::make_shared<LayoutGroup>();;
overview->set_name("overview");
overview->set_title_original(_("Overview"));
overview->set_columns_count(2);
result.push_back(overview);
details = std::shared_ptr<LayoutGroup>(new LayoutGroup());
details = std::make_shared<LayoutGroup>();
details->set_name("details");
details->set_title_original(_("Details"));
details->set_columns_count(2);
......@@ -1434,7 +1434,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
//If, for some reason, we didn't create the-subgroups, add everything to a top level group:
if(!overview && !details)
{
overview = std::shared_ptr<LayoutGroup>(new LayoutGroup());
overview = std::make_shared<LayoutGroup>();
overview->set_name("main");
overview->set_columns_count(1);
result.push_back(overview);
......@@ -1465,7 +1465,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
if(!found)
{
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(*iter);
//layout_item.set_table_name(child_table_name); //TODO: Allow viewing of fields through relationships.
//layout_item.m_sequence = sequence; add_item() will fill this.
......@@ -1624,7 +1624,7 @@ std::shared_ptr<Document::DocumentTableInfo> Document::get_table_info_with_add(c
}
else
{
doctableinfo = std::shared_ptr<DocumentTableInfo>(new DocumentTableInfo());
doctableinfo = std::make_shared<DocumentTableInfo>();
doctableinfo->m_info->set_name(table_name);
m_tables[table_name] = doctableinfo;
return doctableinfo;
......@@ -2001,7 +2001,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
field_type = field_temp->get_glom_type();
}
std::shared_ptr<ChoiceValue> value = std::shared_ptr<ChoiceValue>(new ChoiceValue());
std::shared_ptr<ChoiceValue> value = std::make_shared<ChoiceValue>();
load_after_choicevalue(element, value, field_type);
list_values.push_back(value);
}
......@@ -2025,7 +2025,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
}
const Glib::ustring field_first = XmlUtils::get_node_attribute_value(element, GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_FIELD);
std::shared_ptr<LayoutItem_Field> layout_field_first = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_field_first = std::make_shared<LayoutItem_Field>();
layout_field_first->set_name(field_first);
std::shared_ptr<LayoutGroup> extra_layouts;
......@@ -2037,8 +2037,8 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
const Glib::ustring field_second = XmlUtils::get_node_attribute_value(element, GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_SECOND);
if(!field_second.empty())
{
extra_layouts = std::shared_ptr<LayoutGroup>(new LayoutGroup());
std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
extra_layouts = std::make_shared<LayoutGroup>();
std::shared_ptr<LayoutItem_Field> item = std::make_shared<LayoutItem_Field>();
item->set_name(field_second);
extra_layouts->add_item(item);
}
......@@ -2053,7 +2053,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
if(nodeGroups)
{
std::shared_ptr<LayoutGroup> layout_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
std::shared_ptr<LayoutGroup> layout_group = std::make_shared<LayoutGroup>();
load_after_layout_group(nodeGroups, relationship->get_to_table(), layout_group);
if(layout_group && !(layout_group->m_list_items.empty()))
{
......@@ -2138,7 +2138,7 @@ void Document::load_after_layout_item_field(const xmlpp::Element* element, const
const xmlpp::Element* nodeCustomTitle = XmlUtils::get_node_child_named(element, GLOM_NODE_LAYOUT_ITEM_CUSTOM_TITLE);
if(nodeCustomTitle)
{
std::shared_ptr<CustomTitle> custom_title = std::shared_ptr<CustomTitle>(new CustomTitle());
std::shared_ptr<CustomTitle> custom_title = std::make_shared<CustomTitle>();
custom_title->set_use_custom_title( XmlUtils::get_node_attribute_value_as_bool(nodeCustomTitle, GLOM_ATTRIBUTE_LAYOUT_ITEM_CUSTOM_TITLE_USE) );
load_after_translations(nodeCustomTitle, custom_title);
......@@ -2159,7 +2159,7 @@ void Document::load_after_sort_by(const xmlpp::Element* node, const Glib::ustrin
const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(*iter);
if(element)
{
std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> item = std::make_shared<LayoutItem_Field>();
//item.set_full_field_details_empty();
load_after_layout_item_field(element, table_name, item);
item->set_full_field_details( get_field(item->get_table_used(table_name), item->get_name()) );
......@@ -2202,7 +2202,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
{
if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM) //TODO: Rename this to GLOM_NODE_DATA_LAYOUT_ITEM_FIELD
{
std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> item = std::make_shared<LayoutItem_Field>();
//item.set_full_field_details_empty();
load_after_layout_item_field(element, table_name, item);
......@@ -2210,7 +2210,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_BUTTON)
{
std::shared_ptr<LayoutItem_Button> item = std::shared_ptr<LayoutItem_Button>(new LayoutItem_Button());
std::shared_ptr<LayoutItem_Button> item = std::make_shared<LayoutItem_Button>();
item->set_script( XmlUtils::get_child_text_node(element, GLOM_NODE_BUTTON_SCRIPT) );
if(!(item->get_has_script())) //Try the deprecated attribute instead
......@@ -2222,14 +2222,14 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_TEXTOBJECT)
{
std::shared_ptr<LayoutItem_Text> item = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
std::shared_ptr<LayoutItem_Text> item = std::make_shared<LayoutItem_Text>();
load_after_translations(element, item);
//The text can be translated too, so it has its own node:
const xmlpp::Element* element_text = XmlUtils::get_node_child_named(element, GLOM_NODE_DATA_LAYOUT_TEXTOBJECT_TEXT);
if(element_text)
{
std::shared_ptr<StaticText> translatable_text = std::shared_ptr<StaticText>(new StaticText());
std::shared_ptr<StaticText> translatable_text = std::make_shared<StaticText>();
load_after_translations(element_text, translatable_text);
item->m_text = translatable_text;
//std::cout << " DEBUG: text: " << item->m_text->get_title_or_name() << std::endl;
......@@ -2239,7 +2239,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_IMAGEOBJECT)
{
std::shared_ptr<LayoutItem_Image> item = std::shared_ptr<LayoutItem_Image>(new LayoutItem_Image());
std::shared_ptr<LayoutItem_Image> item = std::make_shared<LayoutItem_Image>();
load_after_translations(element, item);
Gnome::Gda::Value value_image;
......@@ -2261,7 +2261,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_LINE)
{
std::shared_ptr<LayoutItem_Line> item = std::shared_ptr<LayoutItem_Line>(new LayoutItem_Line());
std::shared_ptr<LayoutItem_Line> item = std::make_shared<LayoutItem_Line>();
//Has no translations: load_after_translations(element, item);
item->set_coordinates(
......@@ -2280,7 +2280,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_FIELDSUMMARY)
{
std::shared_ptr<LayoutItem_FieldSummary> item = std::shared_ptr<LayoutItem_FieldSummary>(new LayoutItem_FieldSummary());
std::shared_ptr<LayoutItem_FieldSummary> item = std::make_shared<LayoutItem_FieldSummary>();
//item.set_full_field_details_empty();
load_after_layout_item_field(element, table_name, item);
item->set_full_field_details( get_field(item->get_table_used(table_name), item->get_name()) );
......@@ -2290,28 +2290,28 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_HEADER)
{
std::shared_ptr<LayoutItem_Header> child_group = std::shared_ptr<LayoutItem_Header>(new LayoutItem_Header());
std::shared_ptr<LayoutItem_Header> child_group = std::make_shared<LayoutItem_Header>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
item_added = child_group;
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_FOOTER)
{
std::shared_ptr<LayoutItem_Footer> child_group = std::shared_ptr<LayoutItem_Footer>(new LayoutItem_Footer());
std::shared_ptr<LayoutItem_Footer> child_group = std::make_shared<LayoutItem_Footer>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
item_added = child_group;
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_GROUP)
{
std::shared_ptr<LayoutGroup> child_group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
std::shared_ptr<LayoutGroup> child_group = std::make_shared<LayoutGroup>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
item_added = child_group;
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_NOTEBOOK)
{
std::shared_ptr<LayoutItem_Notebook> notebook = std::shared_ptr<LayoutItem_Notebook>(new LayoutItem_Notebook());
std::shared_ptr<LayoutItem_Notebook> notebook = std::make_shared<LayoutItem_Notebook>();
load_after_layout_group(element, table_name, notebook, with_print_layout_positions);
item_added = notebook;
}
......@@ -2321,10 +2321,10 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
std::shared_ptr<LayoutItem_CalendarPortal> calendar_portal;
if(element->get_name() == GLOM_NODE_DATA_LAYOUT_PORTAL)
portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal());
portal = std::make_shared<LayoutItem_Portal>();
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_CALENDAR_PORTAL)
{
calendar_portal = std::shared_ptr<LayoutItem_CalendarPortal>(new LayoutItem_CalendarPortal());
calendar_portal = std::make_shared<LayoutItem_CalendarPortal>();
portal = calendar_portal;
}
......@@ -2348,7 +2348,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
else if(navigation_type_as_string == GLOM_ATTRIBUTE_PORTAL_NAVIGATION_TYPE_SPECIFIC)
{
//Read the specified relationship name:
std::shared_ptr<UsesRelationship> relationship_navigation_specific = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> relationship_navigation_specific = std::make_shared<UsesRelationship>();
load_after_layout_item_usesrelationship(elementNavigationRelationshipSpecific, portal->get_table_used(table_name), relationship_navigation_specific);
portal->set_navigation_relationship_specific(relationship_navigation_specific);
}
......@@ -2395,12 +2395,12 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_GROUPBY)
{
std::shared_ptr<LayoutItem_GroupBy> child_group = std::shared_ptr<LayoutItem_GroupBy>(new LayoutItem_GroupBy());
std::shared_ptr<LayoutItem_GroupBy> child_group = std::make_shared<LayoutItem_GroupBy>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
//Group-By field:
std::shared_ptr<LayoutItem_Field> field_groupby = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> field_groupby = std::make_shared<LayoutItem_Field>();
xmlpp::Element* elementGroupBy = XmlUtils::get_node_child_named(element, GLOM_NODE_REPORT_ITEM_GROUPBY_GROUPBY);
if(elementGroupBy)
{
......@@ -2437,7 +2437,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_VERTICALGROUP)
{
std::shared_ptr<LayoutItem_VerticalGroup> child_group = std::shared_ptr<LayoutItem_VerticalGroup>(new LayoutItem_VerticalGroup());
std::shared_ptr<LayoutItem_VerticalGroup> child_group = std::make_shared<LayoutItem_VerticalGroup>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
......@@ -2445,7 +2445,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
}
else if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_SUMMARY)
{
std::shared_ptr<LayoutItem_Summary> child_group = std::shared_ptr<LayoutItem_Summary>(new LayoutItem_Summary());
std::shared_ptr<LayoutItem_Summary> child_group = std::make_shared<LayoutItem_Summary>();
//Recurse:
load_after_layout_group(element, table_name, child_group, with_print_layout_positions);
......@@ -2521,7 +2521,7 @@ void Document::load_after_translations(const xmlpp::Element* element, const std:
const xmlpp::Element* nodeTitleSingular = XmlUtils::get_node_child_named(element, GLOM_NODE_TABLE_TITLE_SINGULAR);
if(!has_title_singular->m_title_singular)
has_title_singular->m_title_singular = std::shared_ptr<TranslatableItem>(new TranslatableItem());
has_title_singular->m_title_singular = std::make_shared<TranslatableItem>();
load_after_translations(nodeTitleSingular, has_title_singular->m_title_singular);
}
......@@ -2670,7 +2670,7 @@ bool Document::load_after(int& failure_code)
{
const Glib::ustring table_name = XmlUtils::get_node_attribute_value(nodeTable, GLOM_ATTRIBUTE_NAME);
const std::shared_ptr<DocumentTableInfo> doctableinfo = std::shared_ptr<DocumentTableInfo>(new DocumentTableInfo());
const std::shared_ptr<DocumentTableInfo> doctableinfo = std::make_shared<DocumentTableInfo>();
m_tables[table_name] = doctableinfo;
std::shared_ptr<TableInfo> table_info(new TableInfo());
......@@ -2697,7 +2697,7 @@ bool Document::load_after(int& failure_code)
const xmlpp::Element* nodeChild = dynamic_cast<xmlpp::Element*>(*iter);
if(nodeChild)
{
std::shared_ptr<Relationship> relationship = std::shared_ptr<Relationship>(new Relationship());
std::shared_ptr<Relationship> relationship = std::make_shared<Relationship>();
const Glib::ustring relationship_name = XmlUtils::get_node_attribute_value(nodeChild, GLOM_ATTRIBUTE_NAME);
relationship->set_from_table(table_name);
......@@ -4970,7 +4970,7 @@ Document::type_list_lookups Document::get_lookup_fields(const Glib::ustring& tab
if(relationship->get_from_field() == field_name)
{
//Add it:
std::shared_ptr<LayoutItem_Field> item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> item = std::make_shared<LayoutItem_Field>();
item->set_full_field_details(field);
result.push_back( type_pairFieldTrigger(item, relationship) );
}
......
......@@ -555,7 +555,7 @@ private:
: m_overviewx ( ),
m_overviewy ( std::numeric_limits<float>::infinity () )
{
m_info = std::shared_ptr<TableInfo>(new TableInfo()); //Avoid a null std::shared_ptr.
m_info = std::make_shared<TableInfo>(); //Avoid a null std::shared_ptr.
}
std::shared_ptr<TableInfo> m_info;
......
......@@ -265,7 +265,7 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
type_list_relationships::const_iterator iterFind = std::find_if(list_relationships.begin(), list_relationships.end(), predicate_UsesRelationshipHasRelationships<UsesRelationship>(layout_item, true /* top_level_only */) );
if(iterFind == list_relationships.end()) //If the table is not yet in the list:
{
std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> uses_rel = std::make_shared<UsesRelationship>();
uses_rel->set_relationship(layout_item->get_relationship());
list_relationships.push_front(uses_rel); //These need to be at the front, so that related relationships can use them later in the SQL statement.
}
......@@ -274,7 +274,7 @@ static void add_to_relationships_list(type_list_relationships& list_relationship
iterFind = std::find_if(list_relationships.begin(), list_relationships.end(), predicate_UsesRelationshipHasRelationships<UsesRelationship>(layout_item) );
if(iterFind == list_relationships.end()) //If the table is not yet in the list:
{
std::shared_ptr<UsesRelationship> uses_rel = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> 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);
......@@ -427,7 +427,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> Utils::build_sql_select_with_where_clause(c
if(extra_join)
{
std::shared_ptr<UsesRelationship> uses_relationship = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> uses_relationship = std::make_shared<UsesRelationship>();
uses_relationship->set_relationship(extra_join);
builder_add_join(builder, uses_relationship);
}
......@@ -1486,7 +1486,7 @@ LayoutGroup::type_list_const_items Utils::get_layout_items_plus_primary_key(cons
return items;
}
std::shared_ptr<LayoutItem_Field> pk_layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> pk_layout_item = std::make_shared<LayoutItem_Field>();
pk_layout_item->set_hidden();
pk_layout_item->set_full_field_details(field_primary_key);
......@@ -1515,7 +1515,7 @@ LayoutGroup::type_list_items Utils::get_layout_items_plus_primary_key(const Layo
return items;
}
std::shared_ptr<LayoutItem_Field> pk_layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> pk_layout_item = std::make_shared<LayoutItem_Field>();
pk_layout_item->set_hidden();
pk_layout_item->set_full_field_details(field_primary_key);
......
......@@ -174,7 +174,7 @@ bool Box_Data_Calendar_Related::fill_from_database()
if(relationship_related)
{
//Adjust the WHERE clause appropriately for the extra JOIN:
std::shared_ptr<UsesRelationship> uses_rel_temp = std::shared_ptr<UsesRelationship>(new UsesRelationship());
std::shared_ptr<UsesRelationship> uses_rel_temp = std::make_shared<UsesRelationship>();
uses_rel_temp->set_relationship(relationship);
where_clause_to_table_name = uses_rel_temp->get_sql_join_alias_name();
}
......@@ -271,7 +271,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary
if(m_key_field)
{
//m_key_field is the field in this table that must match another field in the parent table.
std::shared_ptr<LayoutItem_Field> layout_item = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
std::shared_ptr<LayoutItem_Field> layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(m_key_field);
//TODO: key_value = m_calendar.get_value(row, layout_item);
}
......@@ -308,7 +308,7 @@ void Box_Data_Calendar_Related::on_record_added(const Gnome::Gda::Value& primary