[glom/c++11] C++11: Use std::make_shared.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/c++11] C++11: Use std::make_shared.
- Date: Fri, 5 Jul 2013 14:32:13 +0000 (UTC)
commit 745836d5b143b46947546ffec9e63ae3b02f9530
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Jul 5 10:19:05 2013 +0200
C++11: Use std::make_shared.
glom/base_db.cc | 24 +++---
glom/base_db_table_data.cc | 6 +-
glom/box_reports.cc | 2 +-
glom/frame_glom.cc | 6 +-
glom/import_csv/dialog_import_csv.cc | 2 +-
glom/import_csv/dialog_import_csv_progress.cc | 4 +-
glom/libglom/data_structure/has_title_singular.cc | 2 +-
.../data_structure/layout/layoutitem_portal.cc | 4 +-
.../data_structure/layout/layoutitem_text.cc | 2 +-
.../layout/report_parts/layoutitem_groupby.cc | 2 +-
glom/libglom/data_structure/print_layout.cc | 2 +-
glom/libglom/data_structure/report.cc | 2 +-
glom/libglom/db_utils.cc | 4 +-
glom/libglom/document/document.cc | 76 ++++++++++----------
glom/libglom/document/document.h | 2 +-
glom/libglom/utils.cc | 10 ++--
glom/mode_data/box_data_calendar_related.cc | 8 +-
glom/mode_data/box_data_details.cc | 8 +-
glom/mode_data/box_data_list.cc | 6 +-
glom/mode_data/box_data_list_related.cc | 6 +-
glom/mode_data/box_data_portal.cc | 2 +-
glom/mode_data/db_adddel/db_adddel.cc | 10 ++--
glom/mode_data/flowtablewithfields.cc | 12 ++--
glom/mode_design/box_db_table_relationships.cc | 2 +-
glom/mode_design/fields/box_db_table_definition.cc | 2 +-
glom/mode_design/fields/dialog_fieldcalculation.cc | 4 +-
glom/mode_design/fields/dialog_fielddefinition.cc | 2 +-
glom/mode_design/layout/dialog_choose_field.cc | 4 +-
.../layout/dialog_layout_calendar_related.cc | 4 +-
glom/mode_design/layout/dialog_layout_details.cc | 18 +++---
glom/mode_design/layout/dialog_layout_export.cc | 2 +-
.../layout/dialog_layout_list_related.cc | 6 +-
.../layout/layout_item_dialogs/box_formatting.cc | 6 +-
.../layout_item_dialogs/dialog_field_layout.cc | 2 +-
.../layout/layout_item_dialogs/dialog_notebook.cc | 2 +-
.../mode_design/print_layouts/box_print_layouts.cc | 2 +-
.../print_layouts/window_print_layout_edit.cc | 18 +++---
.../report_layout/dialog_layout_report.cc | 36 +++++-----
glom/navigation/box_tables.cc | 2 +-
glom/print_layout/canvas_print_layout.cc | 4 +-
glom/print_layout/print_layout_utils.cc | 8 +-
tests/test_document_load.cc | 2 +-
tests/test_fake_connection.cc | 4 +-
tests/test_field_file_format.cc | 4 +-
tests/test_selfhosting_new_from_example_float.cc | 2 +-
tests/test_selfhosting_new_then_change_columns.cc | 2 +-
tests/test_selfhosting_new_then_image.cc | 2 +-
tests/test_selfhosting_sqlinjection.cc | 16 ++--
tests/test_selfhosting_utils.cc | 12 ++--
49 files changed, 185 insertions(+), 185 deletions(-)
---
diff --git a/glom/base_db.cc b/glom/base_db.cc
index f47439d..7926b82 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -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;
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index a2a11e8..cf93737 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -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:
diff --git a/glom/box_reports.cc b/glom/box_reports.cc
index 0b22e15..ade5fd5 100644
--- a/glom/box_reports.cc
+++ b/glom/box_reports.cc
@@ -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())
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index aa44d28..93836b0 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -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());
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index d336f39..a0dc40d 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -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));
diff --git a/glom/import_csv/dialog_import_csv_progress.cc b/glom/import_csv/dialog_import_csv_progress.cc
index 07c9cd2..d7b4704 100644
--- a/glom/import_csv/dialog_import_csv_progress.cc
+++ b/glom/import_csv/dialog_import_csv_progress.cc
@@ -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))
diff --git a/glom/libglom/data_structure/has_title_singular.cc
b/glom/libglom/data_structure/has_title_singular.cc
index 6a0b430..92ae1cc 100644
--- a/glom/libglom/data_structure/has_title_singular.cc
+++ b/glom/libglom/data_structure/has_title_singular.cc
@@ -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);
}
diff --git a/glom/libglom/data_structure/layout/layoutitem_portal.cc
b/glom/libglom/data_structure/layout/layoutitem_portal.cc
index f0a2b37..6a4588a 100644
--- a/glom/libglom/data_structure/layout/layoutitem_portal.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_portal.cc
@@ -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);
diff --git a/glom/libglom/data_structure/layout/layoutitem_text.cc
b/glom/libglom/data_structure/layout/layoutitem_text.cc
index 50c95f3..7e475d9 100644
--- a/glom/libglom/data_structure/layout/layoutitem_text.cc
+++ b/glom/libglom/data_structure/layout/layoutitem_text.cc
@@ -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)
diff --git a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
index 026b887..1ce6ebd 100644
--- a/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
+++ b/glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc
@@ -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)
diff --git a/glom/libglom/data_structure/print_layout.cc b/glom/libglom/data_structure/print_layout.cc
index 728741b..e9caeb2 100644
--- a/glom/libglom/data_structure/print_layout.cc
+++ b/glom/libglom/data_structure/print_layout.cc
@@ -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)
diff --git a/glom/libglom/data_structure/report.cc b/glom/libglom/data_structure/report.cc
index f36b126..7010358 100644
--- a/glom/libglom/data_structure/report.cc
+++ b/glom/libglom/data_structure/report.cc
@@ -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)
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 2fc5990..296e200 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -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);
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index a785b39..c08f2b0 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -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) );
}
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index 88f9fcb..d33c031 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -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;
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 987f812..bad51a7 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -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);
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 6dc8968..4d51ce2 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -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
if(test)
{
//Show it on the view, if it's visible:
- 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_primary_key);
//TODO: m_calendar.set_value(row, layout_item, m_key_value);
@@ -338,7 +338,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):
- std::shared_ptr<LayoutItem_Field> layout_item_date_field = std::shared_ptr<LayoutItem_Field>(new
LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> 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);
m_query_column_date_field = layout_fields.size() - 1;
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 7216b0e..819b056 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -296,7 +296,7 @@ bool Box_Data_Details::fill_from_database()
if(table_privs.m_view)
{
//Add extra possibly-non-visible columns that we need:
- 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);
//Get the primary key index, adding the primary key if necessary:
@@ -524,13 +524,13 @@ void Box_Data_Details::recalculate_fields_for_related_records(const Glib::ustrin
std::shared_ptr<Field> field = *iter;
if(field)
{
- 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);
LayoutFieldInRecord field_in_record(layoutitem_field, m_table_name, m_field_primary_key,
primary_key_value);
calculate_field(field_in_record); //And any dependencies.
//Calculate anything that depends on 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(field);
do_calculations(field_in_record, false /* recurse, reusing m_FieldsCalculationInProgress */);
@@ -743,7 +743,7 @@ void Box_Data_Details::on_flowtable_field_edited(const std::shared_ptr<const Lay
if(primary_key_field)
{
//Get the value of the corresponding key in the current table (that identifies the record in the
table that we will change)
- 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( document->get_field(relationship->get_from_table(),
relationship->get_from_field()) );
primary_key_value = get_entered_field_data(layout_item);
diff --git a/glom/mode_data/box_data_list.cc b/glom/mode_data/box_data_list.cc
index c2c985a..9ceea22 100644
--- a/glom/mode_data/box_data_list.cc
+++ b/glom/mode_data/box_data_list.cc
@@ -185,14 +185,14 @@ void Box_Data_List::on_adddel_user_reordered_columns()
Document* pDoc = dynamic_cast<Document*>(get_document());
if(pDoc)
{
- std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> group = std::make_shared<LayoutGroup>();
group->set_name("toplevel");
AddDel::type_vec_strings vec_field_names = m_AddDel.get_columns_order();
for(AddDel::type_vec_strings::iterator iter = vec_field_names.begin(); iter != vec_field_names.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_name(*iter);
group->add_item(layout_item);
}
@@ -472,7 +472,7 @@ void Box_Data_List::create_layout()
items_to_use = Utils::get_layout_items_plus_primary_key(items_to_use, pDoc, m_table_name);
if(field_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_hidden();
layout_item->set_full_field_details(m_AddDel.get_key_field());
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index c079740..82eac8c 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -275,7 +275,7 @@ void Box_Data_List_Related::on_adddel_record_added(const Gtk::TreeModel::iterato
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);
key_value = m_AddDel.get_value(row, layout_item);
}
@@ -303,7 +303,7 @@ void Box_Data_List_Related::on_adddel_record_added(const Gtk::TreeModel::iterato
make_record_related(primary_key_value);
//Show it on the view, if it's visible:
- 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: Although the to-field value is visible on the new related record, get_value() returns NULL so
you can't immediately navigate to the new record:
@@ -470,7 +470,7 @@ void Box_Data_List_Related::create_layout()
//TODO: Only add it if it is not already there.
if(field_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_hidden();
layout_item->set_full_field_details(m_AddDel.get_key_field());
m_FieldsShown.push_back(layout_item);
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 6b28bab..6862e8f 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -274,7 +274,7 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
std::shared_ptr<Field> navigation_table_primary_key =
get_field_primary_key_for_table(navigation_table_name);
//Build a layout item to get the field's value:
- 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(navigation_table_primary_key);
if(navigation_relationship)
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 55a84d0..a366278 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -2128,7 +2128,7 @@ bool DbAddDel::start_new_record()
else
{
//The primary key is not auto-increment, so start by editing it:
- fieldToEdit = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
+ fieldToEdit = std::make_shared<LayoutItem_Field>();
fieldToEdit->set_full_field_details(fieldPrimaryKey);
}
@@ -2190,7 +2190,7 @@ void DbAddDel::user_changed(const Gtk::TreeModel::iterator& row, guint col)
if(primary_key_field)
{
//Get the value of the corresponding key in the current table (that identifies the record in the
table that we will change)
- 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( document->get_field(relationship->get_from_table(),
relationship->get_from_field()) );
primary_key_value = get_value_selected(layout_item);
@@ -2334,7 +2334,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
//This only works when the primary key is already stored: primary_key_value = get_value_key(row);
//primary_key_value = get_value_key_selected();
- std::shared_ptr<LayoutItem_Field> layout_field = std::shared_ptr<LayoutItem_Field>(new
LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> layout_field = std::make_shared<LayoutItem_Field>();
layout_field->set_full_field_details(primary_key_field);
primary_key_value = get_value_selected(layout_field);
std::cout << "DEBUG: get_value_key_selected(): " << primary_key_value.to_string() << std::endl;
@@ -2354,7 +2354,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
}
- std::shared_ptr<LayoutItem_Field> layout_field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> layout_field = std::make_shared<LayoutItem_Field>();
layout_field->set_full_field_details(primary_key_field);
if(!check_entered_value_for_uniqueness(m_found_set.m_table_name, layout_field, primary_key_value,
get_appwindow()))
{
@@ -2382,7 +2382,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
//If it's an auto-increment, then get the value and show it:
if(primary_key_field->get_auto_increment())
{
- 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_field);
set_value(row, layout_item, primary_key_value);
}
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 893af4e..24a94f9 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -1162,17 +1162,17 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
}
else if(item_type == LayoutWidgetBase::TYPE_GROUP)
{
- std::shared_ptr<LayoutGroup> layout_item = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> layout_item = std::make_shared<LayoutGroup>();
layout_item->set_title_original(_("New Group"));
layout_item_new = layout_item;
}
else if(item_type == LayoutWidgetBase::TYPE_NOTEBOOK)
{
- std::shared_ptr<LayoutItem_Notebook> layout_item = std::shared_ptr<LayoutItem_Notebook>(new
LayoutItem_Notebook());
+ std::shared_ptr<LayoutItem_Notebook> layout_item = std::make_shared<LayoutItem_Notebook>();
layout_item->set_name(_("notebook"));
//Add an example tab, so that it shows up.
- std::shared_ptr<LayoutGroup> group_tab = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> group_tab = std::make_shared<LayoutGroup>();
//Note to translators: This is the default name (not seen by most users) for a notebook tab.
group_tab->set_name(_("tab1"));
@@ -1190,14 +1190,14 @@ void FlowTableWithFields::on_datawidget_layout_item_added(LayoutWidgetBase::enum
}
else if(item_type == LayoutWidgetBase::TYPE_BUTTON)
{
- std::shared_ptr<LayoutItem_Button> layout_item = std::shared_ptr<LayoutItem_Button>(new
LayoutItem_Button());
+ std::shared_ptr<LayoutItem_Button> layout_item = std::make_shared<LayoutItem_Button>();
layout_item->set_name(_("button"));
layout_item->set_title_original(_("New Button"));
layout_item_new = layout_item;
}
else if(item_type == LayoutWidgetBase::TYPE_TEXT)
{
- std::shared_ptr<LayoutItem_Text> layout_item = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
+ std::shared_ptr<LayoutItem_Text> layout_item = std::make_shared<LayoutItem_Text>();
layout_item->set_name(_("text"));
layout_item->set_text_original(_("New Text"));
layout_item_new = layout_item;
@@ -1409,7 +1409,7 @@ std::shared_ptr<LayoutItem_Portal> FlowTableWithFields::get_portal_relationship(
std::shared_ptr<Relationship> relationship = dialog->get_relationship_chosen();
if(relationship)
{
- std::shared_ptr<LayoutItem_Portal> layout_item = std::shared_ptr<LayoutItem_Portal>(new
LayoutItem_Portal());
+ std::shared_ptr<LayoutItem_Portal> layout_item = std::make_shared<LayoutItem_Portal>();
layout_item->set_relationship(relationship);
delete dialog;
return layout_item;
diff --git a/glom/mode_design/box_db_table_relationships.cc b/glom/mode_design/box_db_table_relationships.cc
index 97bdb01..6726705 100644
--- a/glom/mode_design/box_db_table_relationships.cc
+++ b/glom/mode_design/box_db_table_relationships.cc
@@ -156,7 +156,7 @@ void Box_DB_Table_Relationships::save_to_document()
{
std::shared_ptr<Relationship> relationship = document->get_relationship(m_table_name, name);
//Preserve other information, such as translations.
if(!relationship)
- relationship = std::shared_ptr<Relationship>(new Relationship());
+ relationship = std::make_shared<Relationship>();
relationship->set_name(name);
relationship->set_title(m_AddDel.get_value(iter, m_colTitle), AppWindow::get_current_locale());
diff --git a/glom/mode_design/fields/box_db_table_definition.cc
b/glom/mode_design/fields/box_db_table_definition.cc
index 4ba8b7e..a31e093 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -429,7 +429,7 @@ std::shared_ptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::
else
{
//Start with a default:
- fieldResult = std::shared_ptr<Field>(new Field());
+ fieldResult = std::make_shared<Field>();
}
}
diff --git a/glom/mode_design/fields/dialog_fieldcalculation.cc
b/glom/mode_design/fields/dialog_fieldcalculation.cc
index 124ec4f..cc9d14a 100644
--- a/glom/mode_design/fields/dialog_fieldcalculation.cc
+++ b/glom/mode_design/fields/dialog_fieldcalculation.cc
@@ -150,9 +150,9 @@ void Dialog_FieldCalculation::on_button_test()
Utils::show_ok_dialog( _("Calculation failed"), Glib::ustring::compose(_("The calculation failed with
this error:\n%s"), error_message), *this, Gtk::MESSAGE_ERROR);
//Show what fields would trigger the recalculation:
- std::shared_ptr<Field> temp = std::shared_ptr<Field>(new Field());
+ std::shared_ptr<Field> temp = std::make_shared<Field>();
temp->set_calculation(calculation);
- std::shared_ptr<LayoutItem_Field> layoutitem_temp = std::shared_ptr<LayoutItem_Field>(new
LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> layoutitem_temp = std::make_shared<LayoutItem_Field>();
layoutitem_temp->set_full_field_details(temp);
const type_list_const_field_items triggered_fields = get_calculation_fields(m_table_name, layoutitem_temp);
diff --git a/glom/mode_design/fields/dialog_fielddefinition.cc
b/glom/mode_design/fields/dialog_fielddefinition.cc
index 52e1a51..358a023 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.cc
+++ b/glom/mode_design/fields/dialog_fielddefinition.cc
@@ -153,7 +153,7 @@ void Dialog_FieldDefinition::set_field(const std::shared_ptr<const Field>& field
//We use a regular DataWidget for the default value, so we can reuse its functionality,
//but it's not a real field - hence the special title.
- 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>();
std::shared_ptr<Field> field_default_value = glom_sharedptr_clone(m_Field);
field_default_value->set_name("glom_temp_default_value");
field_default_value->set_title_original(_("Default Value"));
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index c75b4b1..f8c11f5 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -253,7 +253,7 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
// Setup a LayoutItem_Field for the Field,
// so is_same_field() can work:
- std::shared_ptr<LayoutItem_Field> field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> field = std::make_shared<LayoutItem_Field>();
field->set_relationship(relationship);
field->set_related_relationship(related_relationship);
@@ -266,7 +266,7 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
if(m_start_field && m_start_field->is_same_field(field))
field = m_start_field;
else
- field = std::shared_ptr<LayoutItem_Field>(new LayoutItem_Field());
+ field = std::make_shared<LayoutItem_Field>();
//Use the chosen field:
field->set_relationship(relationship);
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc
b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index c2b0f02..97b7f2b 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -110,7 +110,7 @@ void Dialog_Layout_Calendar_Related::init_with_tablename(const Glib::ustring& la
{
if(!m_portal)
{
- m_portal = std::shared_ptr<LayoutItem_CalendarPortal>(new LayoutItem_CalendarPortal()); //The rest of
the class assumes that this is not null.
+ m_portal = std::make_shared<LayoutItem_CalendarPortal>(); //The rest of the class assumes that this is
not null.
}
type_vecConstLayoutFields empty_fields; //Just to satisfy the base class.
@@ -288,7 +288,7 @@ void Dialog_Layout_Calendar_Related::save_to_document()
std::shared_ptr<Relationship> rel, rel_related;
rel = m_combo_navigation_specify->get_selected_relationship(rel_related);
- 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(rel);
uses_rel->set_related_relationship(rel_related);
diff --git a/glom/mode_design/layout/dialog_layout_details.cc
b/glom/mode_design/layout/dialog_layout_details.cc
index 885f687..2e20b0d 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -351,7 +351,7 @@ void Dialog_Layout_Details::init(const Glib::ustring& layout_name, const Glib::u
if(list_groups.empty())
{
- std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> group = std::make_shared<LayoutGroup>();
group->set_name("main");
group->set_columns_count(1);
@@ -658,7 +658,7 @@ void Dialog_Layout_Details::on_button_add_button()
Gtk::TreeModel::Row row = *iter;
//Add a new button:
- std::shared_ptr<LayoutItem_Button> button = std::shared_ptr<LayoutItem_Button>(new LayoutItem_Button());
+ std::shared_ptr<LayoutItem_Button> button = std::make_shared<LayoutItem_Button>();
button->set_title_original(_("New Button")); //Give the button a default title, so it is big enough, and
so people see that they should change it.
row[m_model_items->m_columns.m_col_layout_item] = button;
@@ -683,7 +683,7 @@ void Dialog_Layout_Details::on_button_add_text()
Gtk::TreeModel::Row row = *iter;
//Add a new button:
- std::shared_ptr<LayoutItem_Text> textobject = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
+ std::shared_ptr<LayoutItem_Text> textobject = std::make_shared<LayoutItem_Text>();
textobject->set_title_original(_("Text Title")); //Give the button a default title, so it is big enough,
and so people see that they should change it.
row[m_model_items->m_columns.m_col_layout_item] = textobject;
@@ -708,7 +708,7 @@ void Dialog_Layout_Details::on_button_add_image()
Gtk::TreeModel::Row row = *iter;
//Add a new button:
- std::shared_ptr<LayoutItem_Image> imageobject = std::shared_ptr<LayoutItem_Image>(new
LayoutItem_Image());
+ std::shared_ptr<LayoutItem_Image> imageobject = std::make_shared<LayoutItem_Image>();
imageobject->set_title_original(_("Image Title")); //Give the item a default title, so it is big enough,
and so people see that they should change it.
row[m_model_items->m_columns.m_col_layout_item] = imageobject;
@@ -732,7 +732,7 @@ void Dialog_Layout_Details::on_button_add_notebook()
{
Gtk::TreeModel::Row row = *iter;
- 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>();
notebook->set_name(_("notebook"));
row[m_model_items->m_columns.m_col_layout_item] = notebook;
@@ -761,7 +761,7 @@ void Dialog_Layout_Details::on_button_add_related()
{
Gtk::TreeModel::Row row = *iter;
- std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_Portal>(new
LayoutItem_Portal());
+ std::shared_ptr<LayoutItem_Portal> portal = std::make_shared<LayoutItem_Portal>();
//portal->set_relationship(relationship);
row[m_model_items->m_columns.m_col_layout_item] = portal;
@@ -793,7 +793,7 @@ void Dialog_Layout_Details::on_button_add_related_calendar()
{
Gtk::TreeModel::Row row = *iter;
- std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_CalendarPortal>(new
LayoutItem_CalendarPortal());
+ std::shared_ptr<LayoutItem_Portal> portal = std::make_shared<LayoutItem_CalendarPortal>();
//portal->set_relationship(relationship);
row[m_model_items->m_columns.m_col_layout_item] = portal;
@@ -863,7 +863,7 @@ void Dialog_Layout_Details::on_button_add_group()
if(iterNewGroup)
{
Gtk::TreeModel::Row row = *iterNewGroup;
- std::shared_ptr<LayoutGroup> layout_item = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> layout_item = std::make_shared<LayoutGroup>();
layout_item->set_name(_("group"));
row[m_model_items->m_columns.m_col_layout_item] = layout_item;
@@ -1075,7 +1075,7 @@ void Dialog_Layout_Details::save_to_document()
std::shared_ptr<LayoutItem_Portal> layout_portal =
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
if(layout_group && !layout_portal) //There may be top-level groups, but no top-level fields, because
the fields must be in a group (so that they are in columns)
{
- std::shared_ptr<LayoutGroup> group = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> group = std::make_shared<LayoutGroup>();
fill_group(iterFields, group);
list_groups.push_back(group);
diff --git a/glom/mode_design/layout/dialog_layout_export.cc b/glom/mode_design/layout/dialog_layout_export.cc
index 8fedf89..6372cae 100644
--- a/glom/mode_design/layout/dialog_layout_export.cc
+++ b/glom/mode_design/layout/dialog_layout_export.cc
@@ -230,7 +230,7 @@ void Dialog_Layout_Export::get_layout_groups(Document::type_list_layout_groups&
Document::type_list_layout_groups groups;
//Add the fields to the one group:
- std::shared_ptr<LayoutGroup> others = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> others = std::make_shared<LayoutGroup>();
others->set_name("main");
guint field_sequence = 1; //0 means no sequence
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc
b/glom/mode_design/layout/dialog_layout_list_related.cc
index 076ef33..15aff70 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -133,7 +133,7 @@ void Dialog_Layout_List_Related::init_with_portal(const Glib::ustring& layout_na
if(portal)
m_portal = glom_sharedptr_clone(portal);
else
- m_portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal()); //The rest of the class assumes
that this is not null.
+ m_portal = std::make_shared<LayoutItem_Portal>(); //The rest of the class assumes that this is not null.
gulong rows_count_min = 0;
gulong rows_count_max = 0;
@@ -335,7 +335,7 @@ void Dialog_Layout_List_Related::save_to_document()
std::shared_ptr<Relationship> rel, rel_related;
rel = m_combo_navigation_specify->get_selected_relationship(rel_related);
- 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(rel);
uses_rel->set_related_relationship(rel_related);
@@ -358,7 +358,7 @@ void Dialog_Layout_List_Related::save_to_document()
if(m_radio_navigation_none->get_active())
{
- 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_related_relationship(std::shared_ptr<Relationship>());
m_portal->set_navigation_type(LayoutItem_Portal::NAVIGATION_NONE);
}
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 4cb6da3..59c7f2a 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -395,10 +395,10 @@ bool Box_Formatting::get_formatting(Formatting& format) const
m_checkbutton_choices_restricted_as_radio_buttons->get_active());
const std::shared_ptr<const Relationship> choices_relationship =
m_combo_choices_relationship->get_selected_relationship();
- std::shared_ptr<LayoutItem_Field> layout_choice_first = std::shared_ptr<LayoutItem_Field>(new
LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> layout_choice_first = std::make_shared<LayoutItem_Field>();
layout_choice_first->set_name(m_combo_choices_field->get_selected_field_name());
- std::shared_ptr<LayoutGroup> layout_choice_extra = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ std::shared_ptr<LayoutGroup> layout_choice_extra = std::make_shared<LayoutGroup>();
layout_choice_extra->m_list_items = m_dialog_choices_extra_fields->get_fields();
const Formatting::type_list_sort_fields sort_fields = m_dialog_choices_sortby->get_fields();
@@ -423,7 +423,7 @@ bool Box_Formatting::get_formatting(Formatting& format) const
if(success)
{
- std::shared_ptr<ChoiceValue> choicevalue = std::shared_ptr<ChoiceValue>(new ChoiceValue());
+ std::shared_ptr<ChoiceValue> choicevalue = std::make_shared<ChoiceValue>();
choicevalue->set_value(value);
list_choice_values.push_back(choicevalue);
}
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
index 8fc7868..d4b5359 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
@@ -112,7 +112,7 @@ std::shared_ptr<LayoutItem_Field> Dialog_FieldLayout::get_field_chosen() const
m_layout_item->set_formatting_use_default( !m_radiobutton_custom_formatting->get_active() );
m_box_formatting->get_formatting(m_layout_item->m_formatting);
- std::shared_ptr<CustomTitle> title_custom = std::shared_ptr<CustomTitle>(new CustomTitle());
+ std::shared_ptr<CustomTitle> title_custom = std::make_shared<CustomTitle>();
title_custom->set_use_custom_title(m_radiobutton_title_custom->get_active()); //For instance, tell it to
really use a blank title.
title_custom->set_title(m_entry_title_custom->get_text(), AppWindow::get_current_locale());
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
index 96240a8..9fa215f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
@@ -182,7 +182,7 @@ std::shared_ptr<LayoutItem_Notebook> Dialog_Notebook::get_notebook() const
if(item)
group_copy = glom_sharedptr_clone(item);
else
- group_copy = std::shared_ptr<LayoutGroup>(new LayoutGroup());
+ group_copy = std::make_shared<LayoutGroup>();
group_copy->set_name(name);
group_copy->set_title( row[m_ColumnsTabs.m_col_title] , AppWindow::get_current_locale());
diff --git a/glom/mode_design/print_layouts/box_print_layouts.cc
b/glom/mode_design/print_layouts/box_print_layouts.cc
index 76d307e..f1dbe3b 100644
--- a/glom/mode_design/print_layouts/box_print_layouts.cc
+++ b/glom/mode_design/print_layouts/box_print_layouts.cc
@@ -127,7 +127,7 @@ bool Box_Print_Layouts::fill_from_database()
void Box_Print_Layouts::on_adddel_user_added(const Gtk::TreeModel::iterator& row)
{
- std::shared_ptr<PrintLayout> item = std::shared_ptr<PrintLayout>(new PrintLayout());
+ std::shared_ptr<PrintLayout> item = std::make_shared<PrintLayout>();
const Glib::ustring name = m_AddDel.get_value(row, m_colName);
if(!name.empty())
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 4d14def..6fe9d4c 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -441,7 +441,7 @@ std::shared_ptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayo
if(item_type == PrintLayoutToolbarButton::ITEM_FIELD)
{
- std::shared_ptr<LayoutItem_Field> layout_item_derived = std::shared_ptr<LayoutItem_Field>(new
LayoutItem_Field());
+ std::shared_ptr<LayoutItem_Field> layout_item_derived = std::make_shared<LayoutItem_Field>();
layout_item = layout_item_derived;
layout_item->set_print_layout_position(0, 0,
PrintLayoutUtils::ITEM_WIDTH_WIDE, PrintLayoutUtils::ITEM_HEIGHT);
@@ -451,7 +451,7 @@ std::shared_ptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayo
}
else if(item_type == PrintLayoutToolbarButton::ITEM_TEXT)
{
- std::shared_ptr<LayoutItem_Text> layout_item_derived = std::shared_ptr<LayoutItem_Text>(new
LayoutItem_Text());
+ std::shared_ptr<LayoutItem_Text> layout_item_derived = std::make_shared<LayoutItem_Text>();
// Note to translators: This is the default contents of a text item on a print layout:
layout_item_derived->set_text_original(_("text")); //TODO: Choose some other longer default because this
is hidden under the drag icon?
@@ -461,26 +461,26 @@ std::shared_ptr<LayoutItem> Window_PrintLayout_Edit::create_empty_item(PrintLayo
}
else if(item_type == PrintLayoutToolbarButton::ITEM_IMAGE)
{
- layout_item = std::shared_ptr<LayoutItem_Image>(new LayoutItem_Image());
+ layout_item = std::make_shared<LayoutItem_Image>();
layout_item->set_print_layout_position(0, 0,
PrintLayoutUtils::ITEM_WIDTH_WIDE, PrintLayoutUtils::ITEM_WIDTH_WIDE);
}
else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL)
{
- std::shared_ptr<LayoutItem_Line> layout_item_derived = std::shared_ptr<LayoutItem_Line>(new
LayoutItem_Line());
+ std::shared_ptr<LayoutItem_Line> layout_item_derived = std::make_shared<LayoutItem_Line>();
layout_item_derived->set_coordinates(0, 0,
PrintLayoutUtils::ITEM_WIDTH_WIDE * 2, 0);
layout_item = layout_item_derived;
}
else if(item_type == PrintLayoutToolbarButton::ITEM_LINE_VERTICAL)
{
- std::shared_ptr<LayoutItem_Line> layout_item_derived = std::shared_ptr<LayoutItem_Line>(new
LayoutItem_Line());
+ std::shared_ptr<LayoutItem_Line> layout_item_derived = std::make_shared<LayoutItem_Line>();
layout_item_derived->set_coordinates(0, 0, 0, PrintLayoutUtils::ITEM_WIDTH_WIDE * 2);
layout_item = layout_item_derived;
}
else if(item_type == PrintLayoutToolbarButton::ITEM_PORTAL)
{
- std::shared_ptr<LayoutItem_Portal> portal = std::shared_ptr<LayoutItem_Portal>(new LayoutItem_Portal());
+ std::shared_ptr<LayoutItem_Portal> portal = std::make_shared<LayoutItem_Portal>();
portal->set_print_layout_row_height(10); //Otherwise it will be 0, which is useless.
layout_item = portal;
layout_item->set_print_layout_position(0, 0,
@@ -672,7 +672,7 @@ void Window_PrintLayout_Edit::set_print_layout(const Glib::ustring& table_name,
m_modified = false;
m_name_original = print_layout->get_name();
- m_print_layout = std::shared_ptr<PrintLayout>(new PrintLayout(*print_layout)); //Copy it, so we only use
the changes when we want to.
+ m_print_layout = std::make_shared<PrintLayout>(*print_layout); //Copy it, so we only use the changes when
we want to.
m_canvas.set_print_layout(table_name, m_print_layout);
m_table_name = table_name;
@@ -717,7 +717,7 @@ std::shared_ptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
m_print_layout->get_layout_group()->remove_all_items();
//The Header and Footer parts are implicit (they are the whole header or footer treeview)
- std::shared_ptr<LayoutItem_Header> header = std::shared_ptr<LayoutItem_Header>(new LayoutItem_Header());
+ std::shared_ptr<LayoutItem_Header> header = std::make_shared<LayoutItem_Header>();
std::shared_ptr<LayoutGroup> group_temp = header;
fill_print_layout_parts(group_temp, m_model_parts_header);
if(header->get_items_count())
@@ -725,7 +725,7 @@ std::shared_ptr<PrintLayout> Window_PrintLayout_Edit::get_print_layout()
fill_print_layout_parts(m_print_layout->get_layout_group(), m_model_parts_main);
- std::shared_ptr<LayoutItem_Footer> footer = std::shared_ptr<LayoutItem_Footer>(new LayoutItem_Footer());
+ std::shared_ptr<LayoutItem_Footer> footer = std::make_shared<LayoutItem_Footer>();
group_temp = footer;
fill_print_layout_parts(group_temp, m_model_parts_footer);
if(footer->get_items_count())
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc
b/glom/mode_design/report_layout/dialog_layout_report.cc
index 8ed9086..b5c3529 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -102,30 +102,30 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
m_model_available_parts_main = type_model::create();
// Gtk::TreeModel::iterator iterHeader = m_model_available_parts_main->append();
- // (*iterHeader)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Header()));
+ // (*iterHeader)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Header>();
Gtk::TreeModel::iterator iter = m_model_available_parts_main->append();
- (*iter)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_GroupBy()));
+ (*iter)[m_model_available_parts_main->m_columns.m_col_item] = std::make_shared<LayoutItem_GroupBy>();
Gtk::TreeModel::iterator iterField = m_model_available_parts_main->append(iter->children()); //Place
Field under GroupBy to indicate that that's where it belongs in the actual layout.
- (*iterField)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
+ (*iterField)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Field>();
Gtk::TreeModel::iterator iterText = m_model_available_parts_main->append(iter->children());
- (*iterText)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
+ (*iterText)[m_model_available_parts_main->m_columns.m_col_item] = std::make_shared<LayoutItem_Text>();
Gtk::TreeModel::iterator iterImage = m_model_available_parts_main->append(iter->children());
- (*iterImage)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
+ (*iterImage)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Image>();
Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_main->append(iter->children());
- (*iterVerticalGroup)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
+ (*iterVerticalGroup)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_VerticalGroup>();
iter = m_model_available_parts_main->append();
- (*iter)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Summary()));
+ (*iter)[m_model_available_parts_main->m_columns.m_col_item] = std::make_shared<LayoutItem_Summary>();
iter = m_model_available_parts_main->append(iter->children());
- (*iter)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_FieldSummary()));
+ (*iter)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_FieldSummary>();
// Gtk::TreeModel::iterator iterFooter = m_model_available_parts_main->append();
-// (*iterFooter)[m_model_available_parts_main->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Footer()));
+// (*iterFooter)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Footer>();
}
//Header/Footer parts:
@@ -133,16 +133,16 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
m_model_available_parts_headerfooter = type_model::create();
Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_headerfooter->append();
- (*iterVerticalGroup)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_VerticalGroup()));
+ (*iterVerticalGroup)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_VerticalGroup>();
Gtk::TreeModel::iterator iterField =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
- (*iterField)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Field()));
+ (*iterField)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Field>();
Gtk::TreeModel::iterator iterText =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
- (*iterText)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Text()));
+ (*iterText)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Text>();
Gtk::TreeModel::iterator iterImage =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
- (*iterImage)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(new LayoutItem_Image()));
+ (*iterImage)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Image>();
}
m_treeview_available_parts->set_model(m_model_available_parts_main);
@@ -328,7 +328,7 @@ void Dialog_Layout_Report::add_group(const Glib::RefPtr<type_model>& model_parts
{
Gtk::TreeModel::Row row = *iterNewItem;
- row[model_parts->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
+ row[model_parts->m_columns.m_col_item] = glom_sharedptr_clone(group);
add_group_children(model_parts, iterNewItem /* parent */, group);
@@ -342,7 +342,7 @@ void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const std
m_modified = false;
m_name_original = report->get_name();
- m_report = std::shared_ptr<Report>(new Report(*report)); //Copy it, so we only use the changes when we
want to.
+ m_report = std::make_shared<Report>(*report); //Copy it, so we only use the changes when we want to.
m_table_name = table_name;
//Dialog_Layout::set_document(layout, document, table_name, table_fields);
@@ -683,7 +683,7 @@ void Dialog_Layout_Report::on_button_add()
else
iter = model->append();
- (*iter)[model->m_columns.m_col_item] = std::shared_ptr<LayoutItem>(pAvailablePart->clone());
+ (*iter)[model->m_columns.m_col_item] = glom_sharedptr_clone(pAvailablePart);
}
if(parent)
@@ -1016,7 +1016,7 @@ std::shared_ptr<Report> Dialog_Layout_Report::get_report()
group->remove_all_items();
//The Header and Footer parts are implicit (they are the whole header or footer treeview)
- std::shared_ptr<LayoutItem_Header> header = std::shared_ptr<LayoutItem_Header>(new LayoutItem_Header());
+ std::shared_ptr<LayoutItem_Header> header = std::make_shared<LayoutItem_Header>();
std::shared_ptr<LayoutGroup> group_temp = header;
fill_report_parts(group_temp, m_model_parts_header);
if(header->get_items_count())
@@ -1024,7 +1024,7 @@ std::shared_ptr<Report> Dialog_Layout_Report::get_report()
fill_report_parts(group, m_model_parts_main);
- std::shared_ptr<LayoutItem_Footer> footer = std::shared_ptr<LayoutItem_Footer>(new LayoutItem_Footer());
+ std::shared_ptr<LayoutItem_Footer> footer = std::make_shared<LayoutItem_Footer>();
group_temp = footer;
fill_report_parts(group_temp, m_model_parts_footer);
if(footer->get_items_count())
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 0a6426e..edc6225 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -181,7 +181,7 @@ bool Box_Tables::fill_from_database()
{
//This table is in the database, but not in the document.
//Show it as hidden:
- table_info = std::shared_ptr<TableInfo>(new TableInfo());
+ table_info = std::make_shared<TableInfo>();
table_info->set_name(strName);
table_info->set_hidden(true);
}
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 426bd8a..4564b40 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -120,7 +120,7 @@ void Canvas_PrintLayout::set_print_layout(const Glib::ustring& table_name, const
std::shared_ptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
{
- std::shared_ptr<PrintLayout> result = std::shared_ptr<PrintLayout>(new PrintLayout());
+ std::shared_ptr<PrintLayout> result = std::make_shared<PrintLayout>();
fill_layout_group(result->get_layout_group());
//Page Setup:
@@ -218,7 +218,7 @@ void Canvas_PrintLayout::remove_canvas_layout_item(const Glib::RefPtr<CanvasLayo
void Canvas_PrintLayout::add_layout_group(const std::shared_ptr<LayoutGroup>& group, bool is_top_level)
{
- //row[model_parts->m_columns.m_col_item] =
std::shared_ptr<LayoutItem>(static_cast<LayoutItem*>(group->clone()));
+ //row[model_parts->m_columns.m_col_item] = group->clone();
//Add the group item:
if(!is_top_level)
diff --git a/glom/print_layout/print_layout_utils.cc b/glom/print_layout/print_layout_utils.cc
index b08d7b0..1432f01 100644
--- a/glom/print_layout/print_layout_utils.cc
+++ b/glom/print_layout/print_layout_utils.cc
@@ -187,7 +187,7 @@ static void create_standard(const std::shared_ptr<const LayoutGroup>& layout_gro
const Glib::ustring title = item_get_title(layout_group);
if(!title.empty())
{
- std::shared_ptr<LayoutItem_Text> text = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
+ std::shared_ptr<LayoutItem_Text> text = std::make_shared<LayoutItem_Text>();
text->set_text(title, AppWindow::get_current_locale());
text->m_formatting.set_text_format_font("Sans Bold 10");
@@ -247,7 +247,7 @@ static void create_standard(const std::shared_ptr<const LayoutGroup>& layout_gro
const std::shared_ptr<const LayoutItem_Field> field = std::dynamic_pointer_cast<const
LayoutItem_Field>(item);
if(field)
{
- text_title = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
+ text_title = std::make_shared<LayoutItem_Text>();
const Glib::ustring field_title = item_get_title_or_name(field);
text_title->set_text(field_title + ":", AppWindow::get_current_locale());
@@ -314,7 +314,7 @@ guint get_page_for_y(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, Gtk::
std::shared_ptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageSetup>& page_setup, const
Glib::ustring& table_name, const Document* document, bool avoid_page_margins)
{
const Gtk::Unit units = Gtk::UNIT_MM;
- std::shared_ptr<PrintLayout> print_layout = std::shared_ptr<PrintLayout>(new PrintLayout());
+ std::shared_ptr<PrintLayout> print_layout = std::make_shared<PrintLayout>();
//Start inside the border, on the next grid line:
double y = 0;
@@ -332,7 +332,7 @@ std::shared_ptr<PrintLayout> create_standard(const Glib::RefPtr<const Gtk::PageS
const Glib::ustring title = document->get_table_title_singular(table_name,
AppWindow::get_current_locale());
if(!title.empty())
{
- std::shared_ptr<LayoutItem_Text> text = std::shared_ptr<LayoutItem_Text>(new LayoutItem_Text());
+ std::shared_ptr<LayoutItem_Text> text = std::make_shared<LayoutItem_Text>();
text->set_text(title, AppWindow::get_current_locale());
text->m_formatting.set_text_format_font("Sans Bold 12");
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index ec22fef..02f51cc 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -80,7 +80,7 @@ static bool get_group_named(const Glom::Document::type_list_groups& container, c
static bool needs_navigation(Glom::Document& document, const Glib::ustring& table_name, const Glib::ustring&
field_name)
{
- std::shared_ptr<Glom::LayoutItem_Field> layout_item = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layout_item = std::make_shared<Glom::LayoutItem_Field>();
layout_item->set_name(field_name);
layout_item->set_full_field_details(
document.get_field(table_name, field_name));
diff --git a/tests/test_fake_connection.cc b/tests/test_fake_connection.cc
index 71c794a..a95cb0d 100644
--- a/tests/test_fake_connection.cc
+++ b/tests/test_fake_connection.cc
@@ -72,11 +72,11 @@ int main()
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
field = document.get_field("albums", "name");
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
diff --git a/tests/test_field_file_format.cc b/tests/test_field_file_format.cc
index 9e9048d..7e5d065 100644
--- a/tests/test_field_file_format.cc
+++ b/tests/test_field_file_format.cc
@@ -26,7 +26,7 @@
static void test_text_field()
{
- std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
+ std::shared_ptr<Glom::Field> field = std::make_shared<Glom::Field>();
field->set_glom_type(Glom::Field::TYPE_TEXT);
const Gnome::Gda::Value value_original("text with \" double quote and ' single quote");
@@ -41,7 +41,7 @@ static void test_text_field()
static void test_image_field()
{
- std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
+ std::shared_ptr<Glom::Field> field = std::make_shared<Glom::Field>();
field->set_glom_type(Glom::Field::TYPE_IMAGE);
//TODO: Test an image too:
diff --git a/tests/test_selfhosting_new_from_example_float.cc
b/tests/test_selfhosting_new_from_example_float.cc
index e212554..fbb4857 100644
--- a/tests/test_selfhosting_new_from_example_float.cc
+++ b/tests/test_selfhosting_new_from_example_float.cc
@@ -56,7 +56,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field(table_name, "price");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
diff --git a/tests/test_selfhosting_new_then_change_columns.cc
b/tests/test_selfhosting_new_then_change_columns.cc
index a11ea77..90d7e27 100644
--- a/tests/test_selfhosting_new_then_change_columns.cc
+++ b/tests/test_selfhosting_new_then_change_columns.cc
@@ -156,7 +156,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
try
{
//TODO: Avoid the need for this awkward use of set_g_type():
- std::shared_ptr<Glom::Field> field = std::shared_ptr<Glom::Field>(new Glom::Field());
+ std::shared_ptr<Glom::Field> field = std::make_shared<Glom::Field>();
field->set_name("newfield");
field->set_glom_type(Glom::Field::TYPE_NUMERIC);
Glib::RefPtr<Gnome::Gda::Column> field_info = field->get_field_info();
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
index a10d5e1..2f69748 100644
--- a/tests/test_selfhosting_new_then_image.cc
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -76,7 +76,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
//Get the value:
Glom::Utils::type_vecLayoutFields fieldsToGet;
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
diff --git a/tests/test_selfhosting_sqlinjection.cc b/tests/test_selfhosting_sqlinjection.cc
index c046057..3e19b3d 100644
--- a/tests/test_selfhosting_sqlinjection.cc
+++ b/tests/test_selfhosting_sqlinjection.cc
@@ -39,11 +39,11 @@ static bool check_get_extra_rows(const Glib::ustring& quote_char)
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
field = document.get_field("albums", "name");
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -72,11 +72,11 @@ static bool check_drop_table(const Glib::ustring& quote_char)
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
field = document.get_field("albums", "name");
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -112,11 +112,11 @@ static bool check_avoid_quotes_and_drop_table_with_false_value_type()
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
field = document.get_field("albums", "name");
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -172,11 +172,11 @@ static bool check_avoid_quotes_and_drop_table_with_false_field_type()
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document.get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
field = document.get_field("albums", "name");
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 94d1998..d9fcbc7 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -398,7 +398,7 @@ bool test_table_exists(const Glib::ustring& table_name, const Glom::Document& do
return false;
}
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -428,7 +428,7 @@ static bool test_example_musiccollection_data_related(const Glom::Document* docu
//Normal fields:
std::shared_ptr<const Glom::Field> field_album_id = document->get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field_album_id);
fieldsToGet.push_back(layoutitem);
std::shared_ptr<const Glom::Field> field = document->get_field("albums", "name");
@@ -437,7 +437,7 @@ static bool test_example_musiccollection_data_related(const Glom::Document* docu
std::cerr << G_STRFUNC << "Failure: Could not get field." << std::endl;
return false;
}
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -448,7 +448,7 @@ static bool test_example_musiccollection_data_related(const Glom::Document* docu
std::cerr << "Failure: The relationship could not be found." << std::endl;
return false;
}
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_relationship(relationship);
field = document->get_field("artists", "name");
if(!field)
@@ -488,7 +488,7 @@ bool test_example_musiccollection_data(const Glom::Document* document)
Glom::Utils::type_vecLayoutFields fieldsToGet;
std::shared_ptr<const Glom::Field> field = document->get_field("albums", "album_id");
- std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new
Glom::LayoutItem_Field());
+ std::shared_ptr<Glom::LayoutItem_Field> layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
@@ -498,7 +498,7 @@ bool test_example_musiccollection_data(const Glom::Document* document)
std::cerr << G_STRFUNC << "Failure: Could not get field." << std::endl;
return false;
}
- layoutitem = std::shared_ptr<Glom::LayoutItem_Field>(new Glom::LayoutItem_Field());
+ layoutitem = std::make_shared<Glom::LayoutItem_Field>();
layoutitem->set_full_field_details(field);
fieldsToGet.push_back(layoutitem);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]