[glom] C++11: Some using instead of typedef.



commit c2fe358cbecb2f2ca4ec6927ba6dd469d8db96df
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 7 17:02:06 2016 +0100

    C++11: Some using instead of typedef.
    
    With help from clang-tidy.

 glom/frame_glom.cc                                 |    2 +-
 glom/libglom/data_structure/glomconversions.cc     |   10 +++++-----
 glom/libglom/db_utils.cc                           |    2 +-
 glom/libglom/spawn_with_feedback.cc                |    2 +-
 glom/libglom/sql_utils.cc                          |    2 +-
 glom/mode_data/datawidget/treemodel_db.cc          |    3 +--
 .../datawidget/treemodel_db_withextratext.cc       |    2 +-
 glom/mode_design/iso_codes.cc                      |    2 +-
 glom/utility_widgets/adddel/adddel.cc              |    4 ++--
 .../eggspreadtablemm/eggspreadtabledndmm.cc        |    6 +++---
 tests/import/test_parsing.cc                       |    2 +-
 tests/import/test_signals.cc                       |    2 +-
 12 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index adb1f50..38f3d11 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1287,7 +1287,7 @@ void Frame_Glom::update_table_in_document_from_database()
   //TODO_performance: There are a lot of temporary Field and Column instances here, with a lot of string 
copying.
 
   //For instance, changed field details, or new fields, or removed fields.
-  typedef Box_DB_Table::type_vec_fields type_vec_fields;
+  using type_vec_fields = Box_DB_Table::type_vec_fields;
 
   //Get the fields information from the database:
   DbUtils::type_vec_fields fieldsDatabase = DbUtils::get_fields_for_table_from_database(m_table_name);
diff --git a/glom/libglom/data_structure/glomconversions.cc b/glom/libglom/data_structure/glomconversions.cc
index a5215a5..170cbee 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -267,7 +267,7 @@ Glib::ustring Conversions::format_tm(const tm& tm_data, const std::locale& local
   the_stream.imbue(locale); //Make it format things for this locale. (Actually, I don't know if this is 
necessary, because we mention the locale in the time_put<> constructor.
 
   // Get a time_put face:
-  typedef std::time_put<char> type_time_put;
+  using type_time_put = std::time_put<char>;
   const auto& tp = std::use_facet<type_time_put>(locale);
 
   //type_iterator begin(the_stream);
@@ -730,7 +730,7 @@ tm Conversions::parse_date(const Glib::ustring& text, const std::locale& locale,
   //http://www.roguewave.com/support/docs/sourcepro/stdlibref/time-get.html
 
   //Format it into this stream:
-  typedef std::stringstream type_stream;
+  using type_stream = std::stringstream;
 
 
   //tm the_c_time = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -760,8 +760,8 @@ tm Conversions::parse_date(const Glib::ustring& text, const std::locale& locale,
 
     // Get a time_get facet:
 
-    typedef std::time_get<char> type_time_get;
-    typedef type_time_get::iter_type type_iterator;
+    using type_time_get = std::time_get<char>;
+    using type_iterator = type_time_get::iter_type;
 
     const auto& tg = std::use_facet<type_time_get>(locale);
 
@@ -877,7 +877,7 @@ tm Conversions::parse_time(const Glib::ustring& text, const std::locale& locale,
   //http://www.roguewave.com/support/docs/sourcepro/stdlibref/time-get.html
 
   //Format it into this stream:
-  typedef std::stringstream type_stream;
+  using type_stream = std::stringstream;
 
    //tm the_c_time = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index d4918a6..f5c95d1 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -2310,7 +2310,7 @@ type_map_fields get_record_field_values(const std::shared_ptr<const Document>& d
   const auto fields = document->get_table_fields(table_name);
 
   //TODO: This seems silly. We should just have a build_sql_select() that can take this container:
-  typedef std::vector< std::shared_ptr<LayoutItem_Field> > type_vecLayoutFields;
+  using type_vecLayoutFields = std::vector<std::shared_ptr<LayoutItem_Field> >;
   type_vecLayoutFields fieldsToGet;
   for(const auto& field : fields)
   {
diff --git a/glom/libglom/spawn_with_feedback.cc b/glom/libglom/spawn_with_feedback.cc
index 957686f..f1b7c07 100644
--- a/glom/libglom/spawn_with_feedback.cc
+++ b/glom/libglom/spawn_with_feedback.cc
@@ -146,7 +146,7 @@ private:
 #endif // !G_OS_WIN32
 
 public:
-  typedef sigc::signal<void()> SignalFinished;
+  using SignalFinished = sigc::signal<void ()>;
 
   /** TODO: Document the redirect parameter.
    */
diff --git a/glom/libglom/sql_utils.cc b/glom/libglom/sql_utils.cc
index d20cc07..cb04440 100644
--- a/glom/libglom/sql_utils.cc
+++ b/glom/libglom/sql_utils.cc
@@ -90,7 +90,7 @@ Glib::RefPtr<Gnome::Gda::SqlBuilder> build_sql_select_count_rows(const Glib::Ref
   return result;
 }
 
-typedef std::list< std::shared_ptr<const UsesRelationship> > type_list_relationships;
+using type_list_relationships = std::list<std::shared_ptr<const UsesRelationship> >;
 
 static void add_to_relationships_list(type_list_relationships& list_relationships, const 
std::shared_ptr<const LayoutItem_Field>& layout_item)
 {
diff --git a/glom/mode_data/datawidget/treemodel_db.cc b/glom/mode_data/datawidget/treemodel_db.cc
index 379c8c1..bc22748 100644
--- a/glom/mode_data/datawidget/treemodel_db.cc
+++ b/glom/mode_data/datawidget/treemodel_db.cc
@@ -781,8 +781,7 @@ void DbTreeModel::set_value_impl(const iterator& row, int column, const Glib::Va
 
     //Cast it to the specific value type.
     //It can't work with anything else anyway.
-    typedef Glib::Value< DbValue > ValueDbValue;
-
+    using ValueDbValue = Glib::Value<DbValue>;
     const auto pDbValue = static_cast<const ValueDbValue*>(&value);
     if(!pDbValue)
       std::cerr << G_STRFUNC << ": value is not a Value< DbValue >.\n";
diff --git a/glom/mode_data/datawidget/treemodel_db_withextratext.cc 
b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
index 75b3def..4ad88d2 100644
--- a/glom/mode_data/datawidget/treemodel_db_withextratext.cc
+++ b/glom/mode_data/datawidget/treemodel_db_withextratext.cc
@@ -25,7 +25,7 @@
 namespace Glom
 {
 
-typedef Glib::Value<Glib::ustring> type_value_string;
+using type_value_string = Glib::Value<Glib::ustring>;
 
 DbTreeModelWithExtraText::DbTreeModelWithExtraText(const FoundSet& found_set, const 
type_vec_const_layout_items& layout_items, bool get_records, bool find_mode, 
Base_DB::type_vecConstLayoutFields& fields_shown)
 : Glib::ObjectBase( typeid(DbTreeModel) ), //register a custom GType.
diff --git a/glom/mode_design/iso_codes.cc b/glom/mode_design/iso_codes.cc
index 520737a..5c2cac0 100644
--- a/glom/mode_design/iso_codes.cc
+++ b/glom/mode_design/iso_codes.cc
@@ -111,7 +111,7 @@ Glib::ustring get_locale_name(const Glib::ustring& locale_id)
   if(map_locales.empty())
   {
     //Get a list of locale IDs:
-    typedef std::vector<std::string> type_list_ids;
+    using type_list_ids = std::vector<std::string>;
     type_list_ids list_ids;
 
     const std::string locales_path = "/usr/share/i18n/locales/";
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index ebde76d..0286f7f 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -536,8 +536,8 @@ void AddDel::construct_specified_columns()
   if(m_column_types.empty())
     return;
 
-  typedef std::vector< Gtk::TreeModelColumnBase* > type_vecModelColumns;
-  type_vecModelColumns vecModelColumns(m_column_types.size(), 0);
+  using type_vecModelColumns = std::vector<Gtk::TreeModelColumnBase*>;
+  type_vecModelColumns vecModelColumns(m_column_types.size());
 
   //Create the Gtk ColumnRecord:
 
diff --git a/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc 
b/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
index eb1369f..13bedc0 100644
--- a/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
+++ b/glom/utility_widgets/eggspreadtablemm/eggspreadtabledndmm.cc
@@ -62,7 +62,7 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_callback(EggSpread
     }
   }
 
-  typedef gboolean RType;
+  using RType = gboolean;
   return RType();
 }
 
@@ -90,7 +90,7 @@ static gboolean EggSpreadTableDnd_signal_widget_drop_possible_notify_callback(Eg
     }
   }
 
-  typedef gboolean RType;
+  using RType = gboolean;
   return RType();
 }
 
@@ -177,7 +177,7 @@ gboolean SpreadTableDnd_Class::widget_drop_possible_callback(EggSpreadTableDnd*
   if(base && base->widget_drop_possible)
     return (*base->widget_drop_possible)(self, p0, drop_possible);
 
-  typedef gboolean RType;
+  using RType = gboolean;
   return RType();
 }
 
diff --git a/tests/import/test_parsing.cc b/tests/import/test_parsing.cc
index 32313e5..b9bd686 100644
--- a/tests/import/test_parsing.cc
+++ b/tests/import/test_parsing.cc
@@ -12,7 +12,7 @@
 namespace
 {
 
-typedef std::vector<std::string> type_tokens;
+using type_tokens = std::vector<std::string>;
 
 type_tokens& get_tokens_instance()
 {
diff --git a/tests/import/test_signals.cc b/tests/import/test_signals.cc
index 116b55c..e4bd364 100644
--- a/tests/import/test_signals.cc
+++ b/tests/import/test_signals.cc
@@ -9,7 +9,7 @@
 
 namespace {
 
-typedef std::vector<std::string> type_encodings;
+using type_encodings = std::vector<std::string>;
 
 guint& get_line_scanned_count_instance()
 {


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