From 702e257caecd6e5915c69c054bafe701aeabd3fc Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 5 Feb 2018 16:07:10 +0100 Subject: [PATCH] Automatically generate Core creation method for C++ wrapper. --- include/linphone/factory.h | 2 -- wrappers/cpp/class_header.mustache | 8 ------ wrappers/cpp/class_impl.mustache | 44 ------------------------------ wrappers/cpp/genwrapper.py | 1 - 4 files changed, 55 deletions(-) diff --git a/include/linphone/factory.h b/include/linphone/factory.h index 8e421a984..932e5d953 100644 --- a/include/linphone/factory.h +++ b/include/linphone/factory.h @@ -118,7 +118,6 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core_2 * @param[in] system_context A pointer to a system object required by the core to operate. Currently it is required to * pass an android Context on android, pass NULL on other platforms. * @see linphone_core_new_with_config_3 - * @deprecated 2018-01-10: Use linphone_factory_create_core_3() instead */ LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core_3 ( const LinphoneFactory *factory, @@ -180,7 +179,6 @@ LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core_w * @param[in] system_context A pointer to a system object required by the core to operate. Currently it is required to * pass an android Context on android, pass NULL on other platforms. * @see linphone_factory_create_core_3 - * @deprecated 2018-01-10: Use linphone_factory_create_core_with_config_3() instead */ LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core_with_config_3 ( const LinphoneFactory *factory, diff --git a/wrappers/cpp/class_header.mustache b/wrappers/cpp/class_header.mustache index 71bd810fb..674d93e48 100644 --- a/wrappers/cpp/class_header.mustache +++ b/wrappers/cpp/class_header.mustache @@ -29,10 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. {{/includes}} #include "object.hh" -{{#_class}}{{#isfactory}} -#include "config.hh" -{{/isfactory}}{{/_class}} - {{#_class}}{{#isVcard}} namespace belcard { class BelCard; @@ -98,10 +94,6 @@ namespace linphone { {{/ismultilistenable}} public: - {{#isfactory}} - LINPHONECXX_PUBLIC std::shared_ptr createCore(const std::shared_ptr &listener, const std::string & configPath, const std::string & factoryConfigPath) const; - LINPHONECXX_PUBLIC std::shared_ptr createCoreWithConfig(const std::shared_ptr &listener, const std::shared_ptr & config) const; - {{/isfactory}} {{#isVcard}} LINPHONECXX_PUBLIC std::shared_ptr &getVcard(); {{/isVcard}} diff --git a/wrappers/cpp/class_impl.mustache b/wrappers/cpp/class_impl.mustache index ec0c55c07..e98acedfa 100644 --- a/wrappers/cpp/class_impl.mustache +++ b/wrappers/cpp/class_impl.mustache @@ -117,50 +117,6 @@ void *{{{className}}}::createCallbacks(void *userData) { } {{/ismultilistenable}} -{{#isfactory}} -std::shared_ptr Factory::createCore(const std::shared_ptr & listener, const std::string & configPath, const std::string & factoryConfigPath) const { - ::LinphoneCoreCbs *cbs = NULL; - std::list > listeners; - if (listener != nullptr) { - listeners.push_back(std::static_pointer_cast(listener)); - cbs = (::LinphoneCoreCbs *)Core::createCallbacks(&listeners); - } - - ::LinphoneFactory *factory = linphone_factory_get(); - ::LinphoneCore *core_ptr = linphone_factory_create_core(factory, cbs, StringUtilities::cppStringToC(configPath), StringUtilities::cppStringToC(factoryConfigPath)); - - if (cbs != NULL) { - linphone_core_remove_callbacks(core_ptr, cbs); - linphone_core_cbs_unref(cbs); - } - - std::shared_ptr cppCore = cPtrToSharedPtr((::belle_sip_object_t *)core_ptr, false); - if (listener != nullptr) cppCore->addListener(listener); - return cppCore; -} - -std::shared_ptr Factory::createCoreWithConfig(const std::shared_ptr & listener, const std::shared_ptr & config) const { - ::LinphoneCoreCbs *cbs = NULL; - std::list > listeners; - if (listener != nullptr) { - listeners.push_back(std::static_pointer_cast(listener)); - cbs = (::LinphoneCoreCbs *)Core::createCallbacks(&listeners); - } - - ::LinphoneFactory *factory = linphone_factory_get(); - ::LinphoneCore *core_ptr = linphone_factory_create_core_with_config(factory, cbs, (::LinphoneConfig *)sharedPtrToCPtr(config)); - - if (cbs != NULL) { - linphone_core_remove_callbacks(core_ptr, cbs); - linphone_core_cbs_unref(cbs); - } - - std::shared_ptr cppCore = cPtrToSharedPtr((::belle_sip_object_t *)core_ptr, false); - if (listener != nullptr) cppCore->addListener(listener); - return cppCore; -} -{{/isfactory}} - {{#isVcard}} std::shared_ptr &Vcard::getVcard() { return *(shared_ptr *)linphone_vcard_get_belcard((LinphoneVcard *)mPrivPtr); diff --git a/wrappers/cpp/genwrapper.py b/wrappers/cpp/genwrapper.py index 3e1587f35..bd99465e6 100755 --- a/wrappers/cpp/genwrapper.py +++ b/wrappers/cpp/genwrapper.py @@ -82,7 +82,6 @@ class CppTranslator(object): 'isnotrefcountable' : not _class.refcountable, 'isNotListener' : True, 'isListener' : False, - 'isfactory' : (_class.name.to_c() == 'LinphoneFactory'), 'isVcard' : (_class.name.to_c() == 'LinphoneVcard'), 'className' : _class.name.translate(self.nameTranslator), 'cClassName' : '::' + _class.name.to_c(),