[libgdamm] ConnectionEvent: Move enums into the class.



commit aa4a87b5a0b217c97de9dc792eb41ee269e55dba
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Apr 26 21:48:34 2017 +0200

    ConnectionEvent: Move enums into the class.

 libgda/src/connectionevent.ccg |    7 ++-----
 libgda/src/connectionevent.hg  |   16 ++++++++--------
 tools/m4/convert_libgdamm.m4   |   16 ++++++++++++++--
 3 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/libgda/src/connectionevent.ccg b/libgda/src/connectionevent.ccg
index 6cdbe66..25371fd 100644
--- a/libgda/src/connectionevent.ccg
+++ b/libgda/src/connectionevent.ccg
@@ -22,9 +22,6 @@
 
 #include <libgda/gda-enum-types.h>
 
-namespace Gnome
-{
-
-
-} /* namespace Gnome */
+using Type = Gnome::Gda::ConnectionEvent::Type;
+using Code = Gnome::Gda::ConnectionEvent::Code;
 
diff --git a/libgda/src/connectionevent.hg b/libgda/src/connectionevent.hg
index f45b806..e13f61b 100644
--- a/libgda/src/connectionevent.hg
+++ b/libgda/src/connectionevent.hg
@@ -32,9 +32,6 @@ namespace Gnome
 namespace Gda
 {
 
-_WRAP_ENUM(ConnectionEventCode, GdaConnectionEventCode, NO_GTYPE)
-_WRAP_ENUM(ConnectionEventType, GdaConnectionEventType, NO_GTYPE)
-
 /** Any event which has occurred on a Gda::Connection.
  * Events occuring on a connection are each represented as a ConnectionEvent object. 
  * Each Connection is responsible for keeping a list of past events; that list can be consulted using the 
Connection::get_events() function.
@@ -52,20 +49,23 @@ protected:
 public:
   _WRAP_CREATE()
 
-  _WRAP_METHOD(void set_event_type(ConnectionEventType type), gda_connection_event_set_event_type)
-  _WRAP_METHOD(ConnectionEventType get_event_type() const, gda_connection_event_get_event_type)
+  _WRAP_ENUM(Code, GdaConnectionEventCode, NO_GTYPE)
+  _WRAP_ENUM(Type, GdaConnectionEventType, NO_GTYPE)
+
+  _WRAP_METHOD(void set_event_type(Type type), gda_connection_event_set_event_type)
+  _WRAP_METHOD(Type get_event_type() const, gda_connection_event_get_event_type)
   _WRAP_METHOD(Glib::ustring get_description() const, gda_connection_event_get_description)
   _WRAP_METHOD(void set_description(const Glib::ustring& description), gda_connection_event_set_description)
   _WRAP_METHOD(glong get_code() const, gda_connection_event_get_code)
   _WRAP_METHOD(void set_code(glong code), gda_connection_event_set_code)
-  _WRAP_METHOD(ConnectionEventCode get_gda_code() const, gda_connection_event_get_gda_code)
-  _WRAP_METHOD(void set_gda_code(ConnectionEventCode code), gda_connection_event_set_gda_code)
+  _WRAP_METHOD(Code get_gda_code() const, gda_connection_event_get_gda_code)
+  _WRAP_METHOD(void set_gda_code(Code code), gda_connection_event_set_gda_code)
   _WRAP_METHOD(Glib::ustring get_source() const, gda_connection_event_get_source)
   _WRAP_METHOD(void set_source(const Glib::ustring& source), gda_connection_event_set_source)
   _WRAP_METHOD(Glib::ustring get_sqlstate() const, gda_connection_event_get_sqlstate)
   _WRAP_METHOD(void set_sqlstate(const Glib::ustring& sqlstate), gda_connection_event_set_sqlstate)
 
-  _WRAP_PROPERTY("type", ConnectionEventType)
+  _WRAP_PROPERTY("type", Type)
 };
 
 } // namespace Gda
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index c490104..c8da9ea 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -1,3 +1,15 @@
+# _CONV_GNOME_GDA_ENUM(enum_name[, C_enum_name])
+# Specify C_enum_name, if it's not the concatenation of GDBus+enum_name.
+define(`_CONV_GNOME_GDA_ENUM',`dnl
+_CONV_ENUM(`Gnome::Gda',`$1',`m4_ifelse(`$2',,`Gda$1',`$2')')
+')dnl
+
+# _CONV_GNOME_GDA_INCLASS_ENUM(class_name, enum_name[, C_enum_name])
+# Specify C_enum_name, if it's not the concatenation of GDBus+class_name+enum_name.
+define(`_CONV_GNOME_GDA_INCLASS_ENUM',`dnl
+_CONV_INCLASS_ENUM(`Gnome::Gda',`$1',`$2',`m4_ifelse(`$3',,`Gda$1$2',`$3')')
+')dnl
+
 _EQUAL(glong,long)
 _EQUAL(GdaMetaContext*, MetaContext*)
 _EQUAL(GdaMetaDbObject*, MetaDbObject*)
@@ -110,8 +122,8 @@ _CONV_ENUM(Gda,ConnectionOptions)
 _CONV_ENUM(Gda,ValueType)
 _CONV_ENUM(Gda,TransactionIsolation)
 _CONV_ENUM(Gda,Sorting)
-_CONV_ENUM(Gda,ConnectionEventCode)
-_CONV_ENUM(Gda,ConnectionEventType)
+_CONV_GNOME_GDA_INCLASS_ENUM(ConnectionEvent,Code)
+_CONV_GNOME_GDA_INCLASS_ENUM(ConnectionEvent,Type)
 _CONV_ENUM(Gda,ConnectionMetaType)
 _CONV_ENUM(Gda,ServerOperationType)
 _CONV_ENUM(Gda,ServerOperationNodeType)


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