[glom] C++11: Again, more auto.



commit 54e1bf38f4254ddeed2f7c568fd8cf86dce983ff
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 18 21:57:40 2016 +0100

    C++11: Again, more auto.

 glom/glom_create_from_example.cc                   |    2 +-
 glom/libglom/example_document_load.cc              |    4 ++--
 .../test_python_execute_func_change_result_type.cc |    2 +-
 .../python/test_python_execute_func_with_record.cc |    2 +-
 ..._python_execute_func_with_record_field_types.cc |    2 +-
 tests/test_conversions.cc                          |    2 +-
 tests/test_document_load.cc                        |   10 +++++-----
 tests/test_document_load_image.cc                  |    6 +++---
 .../test_selfhosting_new_empty_change_sysprefs.cc  |    2 +-
 tests/test_selfhosting_new_from_example.cc         |    2 +-
 .../test_selfhosting_new_from_example_operator.cc  |    6 +++---
 tests/test_selfhosting_non_numeric_primary_keys.cc |    2 +-
 tests/test_selfhosting_utils.cc                    |    2 +-
 13 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/glom/glom_create_from_example.cc b/glom/glom_create_from_example.cc
index 118ac15..ee36499 100644
--- a/glom/glom_create_from_example.cc
+++ b/glom/glom_create_from_example.cc
@@ -497,7 +497,7 @@ int main(int argc, char* argv[])
   }
         
   //Startup. For instance, create the self-hosting files if necessary:
-  const Glom::ConnectionPool::InitErrors initialized_errors =
+  const auto initialized_errors =
     connection_pool->initialize( sigc::ptr_fun(&on_initialize_progress) );
   g_assert(initialized_errors == Glom::ConnectionPool::Backend::InitErrors::NONE);
 
diff --git a/glom/libglom/example_document_load.cc b/glom/libglom/example_document_load.cc
index bfc327a..6911a3b 100644
--- a/glom/libglom/example_document_load.cc
+++ b/glom/libglom/example_document_load.cc
@@ -134,12 +134,12 @@ int main()
     }
 
     //Show the layouts for this table:
-    const Glom::Document::type_list_layout_groups layout_list =
+    const auto layout_list =
       document->get_data_layout_groups("list", table_name);
     std::cout << "  Layout: List:\n";
     print_layout(layout_list);
 
-    const Glom::Document::type_list_layout_groups layout_details =
+    const auto layout_details =
       document->get_data_layout_groups("details", table_name);
     std::cout << "  Layout: Details:\n";
     print_layout(layout_details);
diff --git a/tests/python/test_python_execute_func_change_result_type.cc 
b/tests/python/test_python_execute_func_change_result_type.cc
index 7965fae..6ad22ca 100644
--- a/tests/python/test_python_execute_func_change_result_type.cc
+++ b/tests/python/test_python_execute_func_change_result_type.cc
@@ -15,7 +15,7 @@ int main()
   //Execute a python function:
   Gnome::Gda::Value value;
   Glib::ustring error_message;
-  const Glom::Field::glom_field_type result_type = Glom::Field::glom_field_type::TEXT;
+  const auto result_type = Glom::Field::glom_field_type::TEXT;
   try
   {
     //We ask for a text result though the python function actually returns a number.
diff --git a/tests/python/test_python_execute_func_with_record.cc 
b/tests/python/test_python_execute_func_with_record.cc
index 8d37564..09d4532 100644
--- a/tests/python/test_python_execute_func_with_record.cc
+++ b/tests/python/test_python_execute_func_with_record.cc
@@ -72,7 +72,7 @@ int main()
   connection_pool->setup_from_document(document);
 
   //This is not really necessary for sqlite-based databases.
-  const Glom::ConnectionPool::StartupErrors started =
+  const auto started =
     connection_pool->startup( sigc::ptr_fun(&on_startup_progress) );
   if(started != Glom::ConnectionPool::Backend::StartupErrors::NONE)
   {
diff --git a/tests/python/test_python_execute_func_with_record_field_types.cc 
b/tests/python/test_python_execute_func_with_record_field_types.cc
index 81aecbe..d13f54c 100644
--- a/tests/python/test_python_execute_func_with_record_field_types.cc
+++ b/tests/python/test_python_execute_func_with_record_field_types.cc
@@ -124,7 +124,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
 
   const Gnome::Gda::Value primary_key_value(2);
 
-  const Glom::type_map_fields field_values =
+  const auto field_values =
     Glom::DbUtils::get_record_field_values(document,
       table_name,
       primary_key_field,
diff --git a/tests/test_conversions.cc b/tests/test_conversions.cc
index bd7b949..a97cfb9 100644
--- a/tests/test_conversions.cc
+++ b/tests/test_conversions.cc
@@ -25,7 +25,7 @@
 
 static bool test_string_value(const Glib::ustring& str)
 {
-  const Glom::Field::glom_field_type field_type = Glom::Field::glom_field_type::TEXT;
+  const auto field_type = Glom::Field::glom_field_type::TEXT;
 
   bool success = false;
   const Gnome::Gda::Value value =
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index da4dbcb..597351f 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -207,16 +207,16 @@ int main()
 
 
   //Check a layout:
-  const Glom::Document::type_list_layout_groups groups = 
+  const auto groups = 
     document->get_data_layout_groups("details", "scenes");
   g_assert(groups.size() == 3);
   const auto group =
     groups[1];
-  const Glom::LayoutGroup::type_list_const_items items = 
+  const auto items = 
     group->get_items_recursive();
   //std::cout << "size: " << items.size() << std::endl;
   g_assert(items.size() == 13);
-  const Glom::LayoutGroup::type_list_const_items items_with_groups = 
+  const auto items_with_groups = 
     group->get_items_recursive_with_groups();
   //std::cout << "size: " << items_with_groups.size() << std::endl;
   g_assert(items_with_groups.size() == 15);
@@ -233,7 +233,7 @@ int main()
   field = document->get_field("contacts", "name_title");  
   g_assert(field);
   g_assert(field->get_glom_type() == Glom::Field::glom_field_type::TEXT);
-  const Glom::Formatting& formatting = field->m_default_formatting;
+  const auto& formatting = field->m_default_formatting;
   g_assert(formatting.get_horizontal_alignment() == Glom::Formatting::HorizontalAlignment::AUTO);
   
   g_assert(formatting.get_has_choices());
@@ -346,7 +346,7 @@ int main()
     group_info_accounts.m_map_privileges.find("scenes");
   const bool privileges_found = (iterFind != group_info_accounts.m_map_privileges.end());
   g_assert(privileges_found);
-  const Glom::Privileges privs = iterFind->second;
+  const auto privs = iterFind->second;
   g_assert(privs.m_view == true);
   g_assert(privs.m_edit == true);
   g_assert(privs.m_create == false);
diff --git a/tests/test_document_load_image.cc b/tests/test_document_load_image.cc
index dc3c393..a4eda72 100644
--- a/tests/test_document_load_image.cc
+++ b/tests/test_document_load_image.cc
@@ -69,7 +69,7 @@ int main()
   g_assert(document->get_database_title_original() == "Project Manager Example");
 
   //Check a layout:
-  const Glom::Document::type_list_layout_groups groups = 
+  const auto groups = 
     document->get_data_layout_groups("details", "projects");
   g_assert(groups.size() == 3);
   const auto group =
@@ -77,11 +77,11 @@ int main()
   g_assert(group);
   g_assert(group->get_name() == "overview");
 
-  const Glom::LayoutGroup::type_list_const_items items = 
+  const auto items = 
     group->get_items();
   //std::cout << "size: " << items.size() << std::endl;
   g_assert(items.size() == 3);
-  std::shared_ptr<const Glom::LayoutItem> item = items[2];
+  auto item = items[2];
   g_assert(item);
   auto image_item =
     std::dynamic_pointer_cast<const Glom::LayoutItem_Image>(item);
diff --git a/tests/test_selfhosting_new_empty_change_sysprefs.cc 
b/tests/test_selfhosting_new_empty_change_sysprefs.cc
index c912630..f7da230 100644
--- a/tests/test_selfhosting_new_empty_change_sysprefs.cc
+++ b/tests/test_selfhosting_new_empty_change_sysprefs.cc
@@ -48,7 +48,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     prefs_in.m_org_address_country = "test country";
     Glom::DbUtils::set_database_preferences(document, prefs_in);
 
-    const Glom::SystemPrefs prefs_out = 
+    const auto prefs_out = 
       Glom::DbUtils::get_database_preferences(document);
     if(prefs_out != prefs_in)
     {
diff --git a/tests/test_selfhosting_new_from_example.cc b/tests/test_selfhosting_new_from_example.cc
index c61fda9..73b08c1 100644
--- a/tests/test_selfhosting_new_from_example.cc
+++ b/tests/test_selfhosting_new_from_example.cc
@@ -57,7 +57,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   //TODO: We should store this only in the document anyway,
   //and make it translatable:
   /* TODO: This is not stored in the examples. Should it be?
-  const Glom::SystemPrefs prefs = 
+  const auto prefs = 
     Glom::DbUtils::get_database_preferences(document);
   g_return_val_if_fail(prefs.m_name == "Music Collection", false);
   g_return_val_if_fail(prefs.m_org_name == "SomeOrganization Incorporated", false);
diff --git a/tests/test_selfhosting_new_from_example_operator.cc 
b/tests/test_selfhosting_new_from_example_operator.cc
index 63ffc09..c15a2a5 100644
--- a/tests/test_selfhosting_new_from_example_operator.cc
+++ b/tests/test_selfhosting_new_from_example_operator.cc
@@ -77,7 +77,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
 
     //Add an operator user:
     const Glib::ustring operator_group_name = "personnel_department";
-    const Glom::DbUtils::type_vec_strings group_list = 
+    const auto group_list = 
       Glom::Privs::get_database_groups();
     if(!contains(group_list, operator_group_name))
     {
@@ -93,7 +93,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
     }
 
     //Check that the developer user has access to database metadata:
-    const Glom::DbUtils::type_vec_strings tables = 
+    const auto tables = 
       Glom::DbUtils::get_table_names_from_database(true /* ignore system tables */);
     if(tables.empty())
     {
@@ -142,7 +142,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
 
     //std::cout << "field_types count=" << field_types->get_types_count() << std::endl;
 
-    const Glom::DbUtils::type_vec_strings tables = 
+    const auto tables = 
       Glom::DbUtils::get_table_names_from_database(true /* ignore system tables */);
     if(tables.empty())
     {
diff --git a/tests/test_selfhosting_non_numeric_primary_keys.cc 
b/tests/test_selfhosting_non_numeric_primary_keys.cc
index e2147fd..5c94ae9 100644
--- a/tests/test_selfhosting_non_numeric_primary_keys.cc
+++ b/tests/test_selfhosting_non_numeric_primary_keys.cc
@@ -57,7 +57,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   //TODO: We should store this only in the document anyway,
   //and make it translatable:
   /* TODO: This is not stored in the examples. Should it be?
-  const Glom::SystemPrefs prefs = 
+  const auto prefs = 
     Glom::DbUtils::get_database_preferences(document);
   g_return_val_if_fail(prefs.m_name == "Music Collection", false);
   g_return_val_if_fail(prefs.m_org_name == "SomeOrganization Incorporated", false);
diff --git a/tests/test_selfhosting_utils.cc b/tests/test_selfhosting_utils.cc
index 187991b..1c20a64 100644
--- a/tests/test_selfhosting_utils.cc
+++ b/tests/test_selfhosting_utils.cc
@@ -220,7 +220,7 @@ bool test_create_and_selfhost_new_empty(const std::shared_ptr<Glom::Document>& d
   connection_pool->set_password(password);
 
   //Create the self-hosting files:
-  const Glom::ConnectionPool::InitErrors initialized_errors =
+  const auto initialized_errors =
     connection_pool->initialize( sigc::ptr_fun(&on_initialize_progress) );
   g_assert(initialized_errors == Glom::ConnectionPool::Backend::InitErrors::NONE);
   


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]