[libgdamm] Connection: Move enums into the class.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdamm] Connection: Move enums into the class.
- Date: Fri, 28 Apr 2017 07:17:19 +0000 (UTC)
commit c71e36e6bf5df3985f69225e7383dd215d9071c3
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Apr 26 21:52:37 2017 +0200
Connection: Move enums into the class.
examples/simple/main.cc | 4 ++--
libgda/src/connection.ccg | 7 +++++--
libgda/src/connection.hg | 18 +++++++++---------
tools/m4/convert_libgdamm.m4 | 4 ++--
4 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/examples/simple/main.cc b/examples/simple/main.cc
index 9a1cceb..992bd11 100644
--- a/examples/simple/main.cc
+++ b/examples/simple/main.cc
@@ -179,7 +179,7 @@ int main (int, char**)
try
{
cnc = Gda::Connection::open_from_string ("SQLite", "DB_DIR=.;DB_NAME=example_db", "",
- Gda::ConnectionOptions::NONE);
+ Gda::Connection::Options::NONE);
}
catch(const Glib::Error& err)
{
@@ -189,7 +189,7 @@ int main (int, char**)
#else
std::auto_ptr<Glib::Error> error;
cnc = Gda::Connection::open_from_string ("SQLite", "DB_DIR=.;DB_NAME=example_db", "",
- Gda::CONNECTION_OPTIONS_NONE, error);
+ Gda::Connection::Options::NONE, error);
if (error.get())
{
std::cerr << error->what() << std::endl;
diff --git a/libgda/src/connection.ccg b/libgda/src/connection.ccg
index a9e7445..ff7f136 100644
--- a/libgda/src/connection.ccg
+++ b/libgda/src/connection.ccg
@@ -28,6 +28,9 @@
#include <libgda/libgda.h> //For GDA_GENERAL_ERROR
#include <iostream>
+using Options = Gnome::Gda::Connection::Options;
+using MetaType = Gnome::Gda::Connection::MetaType;
+
namespace Gnome
{
@@ -48,7 +51,7 @@ Connection::~Connection()
Glib::RefPtr<Connection> Connection::open_from_string(const Glib::ustring& provider_name,
const Glib::ustring& cnc_string,
const Glib::ustring& auth_string,
- ConnectionOptions options)
+ Options options)
{
GError* gerror = 0;
Glib::RefPtr<Connection> retval = Glib::wrap(gda_connection_open_from_string(provider_name.c_str(),
@@ -329,7 +332,7 @@ bool Connection::update_meta_store(const Glib::ustring& id)
return retvalue;
}
-Glib::RefPtr<DataModel> Connection::get_meta_store_data(ConnectionMetaType meta_type)
+Glib::RefPtr<DataModel> Connection::get_meta_store_data(MetaType meta_type)
{
GError* gerror = 0;
Glib::RefPtr<DataModel> retvalue = Glib::wrap(gda_connection_get_meta_store_data_v(gobj(),
((GdaConnectionMetaType)(meta_type)), 0, &(gerror)));
diff --git a/libgda/src/connection.hg b/libgda/src/connection.hg
index 00d0de6..ac85874 100644
--- a/libgda/src/connection.hg
+++ b/libgda/src/connection.hg
@@ -47,9 +47,6 @@ typedef GdaServerProviderInfo ServerProviderInfo;
*/
_WRAP_GERROR(ConnectionError, GdaConnectionError, GDA_CONNECTION_ERROR)
-_WRAP_ENUM(ConnectionOptions, GdaConnectionOptions)
-_WRAP_ENUM(ConnectionMetaType, GdaConnectionMetaType)
-
/** Manages a connection to a data source.
* This class offers access to all operations involving an opened connection to a database.
* Connection objects are obtained via the Client class.
@@ -70,14 +67,17 @@ protected:
public:
_WRAP_CREATE()
- _WRAP_METHOD(static Glib::RefPtr<Connection> create_from_string(const Glib::ustring& provider_name, const
Glib::ustring& cnc_string, const Glib::ustring& auth_string = Glib::ustring(), ConnectionOptions options =
ConnectionOptions::NONE), gda_connection_new_from_string, errthrow)
+ _WRAP_ENUM(Options, GdaConnectionOptions)
+ _WRAP_ENUM(MetaType, GdaConnectionMetaType)
+
+ _WRAP_METHOD(static Glib::RefPtr<Connection> create_from_string(const Glib::ustring& provider_name, const
Glib::ustring& cnc_string, const Glib::ustring& auth_string = Glib::ustring(), Options options =
Options::NONE), gda_connection_new_from_string, errthrow)
/* This throws an error which we don't want to do in a constructor */
_WRAP_METHOD_DOCS_ONLY(gda_connection_open_from_string)
static Glib::RefPtr<Connection> open_from_string(const Glib::ustring& provider_name,
const Glib::ustring& cnc_string,
const Glib::ustring& auth_string = Glib::ustring(),
- ConnectionOptions options = ConnectionOptions::NONE);
+ Options options = Options::NONE);
_WRAP_METHOD(bool open(), gda_connection_open, errthrow)
@@ -97,7 +97,7 @@ public:
_WRAP_METHOD(bool is_opened() const, gda_connection_is_opened)
- _WRAP_METHOD(ConnectionOptions get_options() const, gda_connection_get_options)
+ _WRAP_METHOD(Options get_options() const, gda_connection_get_options)
_WRAP_METHOD(Glib::ustring get_dsn() const, gda_connection_get_dsn)
_WRAP_METHOD(Glib::ustring get_cnc_string() const, gda_connection_get_cnc_string)
@@ -279,10 +279,10 @@ public:
#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Holder> >&',`GList*',`Glib::ListHandler<
Glib::RefPtr<Holder> >::vector_to_list($3).data()')
- _WRAP_METHOD(Glib::RefPtr<DataModel> get_meta_store_data(ConnectionMetaType meta_type, const std::vector<
Glib::RefPtr<Holder> >& filters), gda_connection_get_meta_store_data_v, errthrow)
+ _WRAP_METHOD(Glib::RefPtr<DataModel> get_meta_store_data(MetaType meta_type, const std::vector<
Glib::RefPtr<Holder> >& filters), gda_connection_get_meta_store_data_v, errthrow)
_IGNORE(gda_connection_get_meta_store_data)
- Glib::RefPtr<DataModel> get_meta_store_data(ConnectionMetaType meta_type);
+ Glib::RefPtr<DataModel> get_meta_store_data(MetaType meta_type);
_WRAP_METHOD(Glib::RefPtr<MetaStore> get_meta_store(), gda_connection_get_meta_store, refreturn)
_WRAP_METHOD(Glib::RefPtr<const MetaStore> get_meta_store() const, gda_connection_get_meta_store,
constversion)
@@ -346,7 +346,7 @@ public:
_WRAP_PROPERTY("cnc-string", Glib::ustring)
_WRAP_PROPERTY("dsn", Glib::ustring)
_WRAP_PROPERTY("meta-store", Glib::RefPtr<MetaStore>)
- _WRAP_PROPERTY("options", ConnectionOptions)
+ _WRAP_PROPERTY("options", Options)
_WRAP_PROPERTY("is-wrapper", bool)
_WRAP_PROPERTY("monitor-wrapped-in-mainloop", bool)
//We ignore the thread-owner property because it is strange and should only be used (well, modified) by
provider implementations.
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index c8da9ea..92b76c0 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -111,7 +111,6 @@ _CONVERSION(`ServerOperationNodeStatus&',`GdaServerOperationNodeStatus*',`(($2)
_CONV_ENUM(Gda,ConnectionFeature)
_CONV_ENUM(Gda,ConnectionSchema)
-_CONV_ENUM(Gda,ConnectionOptions)
_CONV_ENUM(Gda,ClientEvent)
_CONV_ENUM(Gda,ClientSpecsType)
_CONV_ENUM(Gda,DataModelAccessFlags)
@@ -124,7 +123,8 @@ _CONV_ENUM(Gda,TransactionIsolation)
_CONV_ENUM(Gda,Sorting)
_CONV_GNOME_GDA_INCLASS_ENUM(ConnectionEvent,Code)
_CONV_GNOME_GDA_INCLASS_ENUM(ConnectionEvent,Type)
-_CONV_ENUM(Gda,ConnectionMetaType)
+_CONV_GNOME_GDA_INCLASS_ENUM(Connection,MetaType)
+_CONV_GNOME_GDA_INCLASS_ENUM(Connection,Options)
_CONV_ENUM(Gda,ServerOperationType)
_CONV_ENUM(Gda,ServerOperationNodeType)
_CONV_ENUM(Gda,ServerOperationNodeStatus)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]