[DEV] continue removing stl
This commit is contained in:
parent
9bab81a1ad
commit
44cba70919
@ -18,19 +18,19 @@ void esignal::BaseInternal::setPeriodic(bool _state) {
|
||||
m_periodic = _state;
|
||||
}
|
||||
|
||||
const std::string& esignal::BaseInternal::getName() const {
|
||||
const etk::String& esignal::BaseInternal::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void esignal::BaseInternal::setName(const std::string& _name) {
|
||||
void esignal::BaseInternal::setName(const etk::String& _name) {
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
const std::string& esignal::BaseInternal::getDescription() const {
|
||||
const etk::String& esignal::BaseInternal::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void esignal::BaseInternal::setDescription(const std::string& _desc) {
|
||||
void esignal::BaseInternal::setDescription(const etk::String& _desc) {
|
||||
m_description = _desc;
|
||||
}
|
||||
|
||||
@ -43,19 +43,19 @@ esignal::Base::~Base() {
|
||||
m_data.reset();
|
||||
}
|
||||
|
||||
const std::string& esignal::Base::getName() const {
|
||||
const etk::String& esignal::Base::getName() const {
|
||||
if (m_data != nullptr) {
|
||||
return m_data->getName();
|
||||
}
|
||||
static std::string noValue;
|
||||
static etk::String noValue;
|
||||
return noValue;
|
||||
}
|
||||
|
||||
const std::string& esignal::Base::getDescription() const {
|
||||
const etk::String& esignal::Base::getDescription() const {
|
||||
if (m_data != nullptr) {
|
||||
return m_data->getDescription();
|
||||
}
|
||||
static std::string noValue;
|
||||
static etk::String noValue;
|
||||
return noValue;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ void esignal::Base::setPeriodic(bool _state) {
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& esignal::operator <<(std::ostream& _os, const esignal::Base& _obj) {
|
||||
etk::Stream& esignal::operator <<(etk::Stream& _os, const esignal::Base& _obj) {
|
||||
_os << _obj.getName();
|
||||
return _os;
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ namespace esignal {
|
||||
static size_t s_uid; //!< global id of the signal (STATIC)
|
||||
static int64_t s_uidSignalEmit; //!< global id to emit counting
|
||||
ObserverConnection m_connectionObserver; //!< propriétéry of the connection handle basic
|
||||
std::string m_name; //!< name of the signal.
|
||||
std::string m_description; //!< description of the signal.
|
||||
etk::String m_name; //!< name of the signal.
|
||||
etk::String m_description; //!< description of the signal.
|
||||
public:
|
||||
/**
|
||||
* @brief Basic constructor:
|
||||
@ -55,22 +55,22 @@ namespace esignal {
|
||||
* @brief Get name of the signal.
|
||||
* @return requested name.
|
||||
*/
|
||||
const std::string& getName() const;
|
||||
const etk::String& getName() const;
|
||||
/**
|
||||
* @brief Set name of the signal.
|
||||
* @param[in] _name new name.
|
||||
*/
|
||||
void setName(const std::string& _name);
|
||||
void setName(const etk::String& _name);
|
||||
/**
|
||||
* @brief Get decription of the signal.
|
||||
* @return requested decription.
|
||||
*/
|
||||
const std::string& getDescription() const;
|
||||
const etk::String& getDescription() const;
|
||||
/**
|
||||
* @brief Set decription of the signal.
|
||||
* @param[in] _desc new decription.
|
||||
*/
|
||||
void setDescription(const std::string& _desc);
|
||||
void setDescription(const etk::String& _desc);
|
||||
/**
|
||||
* @brief Tag the signal as periodic...
|
||||
* @param[in] _state state of the periodic element
|
||||
@ -121,12 +121,12 @@ namespace esignal {
|
||||
* @brief Get name of the signal.
|
||||
* @return requested name.
|
||||
*/
|
||||
virtual const std::string& getName() const;
|
||||
virtual const etk::String& getName() const;
|
||||
/**
|
||||
* @brief Get decription of the signal.
|
||||
* @return requested decription.
|
||||
*/
|
||||
virtual const std::string& getDescription() const;
|
||||
virtual const etk::String& getDescription() const;
|
||||
/**
|
||||
* @brief Tag the signal as periodic...
|
||||
* @param[in] _state state of the periodic element
|
||||
@ -134,7 +134,7 @@ namespace esignal {
|
||||
void setPeriodic(bool _state);
|
||||
};
|
||||
//! @not-in-doc
|
||||
std::ostream& operator <<(std::ostream& _os, const esignal::Base& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const esignal::Base& _obj);
|
||||
#ifdef DEBUG
|
||||
const char* logIndent(int32_t _iii);
|
||||
#endif
|
||||
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
#include <esignal/InterfaceData.hpp>
|
||||
|
||||
namespace esignal {
|
||||
|
@ -25,7 +25,7 @@ void esignal::InterfaceData::add(esignal::Base* _pointerOnSignal) {
|
||||
ESIGNAL_ERROR("Try to link a nullptr parameters");
|
||||
return;
|
||||
}
|
||||
m_list.push_back(_pointerOnSignal);
|
||||
m_list.pushBack(_pointerOnSignal);
|
||||
}
|
||||
|
||||
void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) {
|
||||
@ -40,11 +40,11 @@ void esignal::InterfaceData::remove(esignal::Base* _pointerOnSignal) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> esignal::InterfaceData::getAll() const {
|
||||
std::vector<std::string> out;
|
||||
etk::Vector<etk::String> esignal::InterfaceData::getAll() const {
|
||||
etk::Vector<etk::String> out;
|
||||
for (auto &it : m_list) {
|
||||
if(it != nullptr) {
|
||||
out.push_back(it->getName());
|
||||
out.pushBack(it->getName());
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
|
||||
namespace esignal {
|
||||
class Base;
|
||||
@ -17,7 +17,7 @@ namespace esignal {
|
||||
*/
|
||||
class InterfaceData {
|
||||
private:
|
||||
std::vector<esignal::Base*> m_list; //!< list of availlable Parameters
|
||||
etk::Vector<esignal::Base*> m_list; //!< list of availlable Parameters
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor.
|
||||
@ -43,7 +43,7 @@ namespace esignal {
|
||||
* @brief Get All the signal list:
|
||||
* @return vector on all the signals names
|
||||
*/
|
||||
std::vector<std::string> getAll() const;
|
||||
etk::Vector<etk::String> getAll() const;
|
||||
/**
|
||||
* @brief Remove binding on all event class.
|
||||
* @param[in] _sharedPtr sharedPtr to unlink (no type needed ...).
|
||||
|
@ -67,7 +67,7 @@ namespace esignal {
|
||||
virtual bool isSharedPtr(const ememory::SharedPtr<void>& _obj);
|
||||
};
|
||||
protected:
|
||||
std::vector<std::unique_ptr<Executor>> m_executors; //!< List of all executors.
|
||||
etk::Vector<std::unique_ptr<Executor>> m_executors; //!< List of all executors.
|
||||
private:
|
||||
/**
|
||||
* @brief Executor specific to the Shared_ptr caller that does not want to worry about the removing of the signal.
|
||||
@ -154,8 +154,8 @@ namespace esignal {
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
Signal(esignal::BaseInternal::ObserverConnection _countObs=nullptr,
|
||||
const std::string& _name="",
|
||||
const std::string& _description="");
|
||||
const etk::String& _name="",
|
||||
const etk::String& _description="");
|
||||
/**
|
||||
* @brief Basic constructor with connection interface
|
||||
* @param[in] _signalInterfaceLink reference on the signal lister.
|
||||
@ -163,8 +163,8 @@ namespace esignal {
|
||||
* @param[in] _description Description of the signal.
|
||||
*/
|
||||
Signal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
const etk::String& _name,
|
||||
const etk::String& _description);
|
||||
/**
|
||||
* @brief Basic constructor with connection observer
|
||||
* @param[in] _class Class which is associated the function to call.
|
||||
@ -178,16 +178,16 @@ namespace esignal {
|
||||
, int>::type = 0>
|
||||
Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description);
|
||||
const etk::String& _name,
|
||||
const etk::String& _description);
|
||||
template<class CLASS_TYPE,
|
||||
class FUNC_TYPE,
|
||||
typename std::enable_if<!std::is_base_of<esignal::Interface, CLASS_TYPE>::value
|
||||
, int>::type = 0>
|
||||
Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name="",
|
||||
const std::string& _description="");
|
||||
const etk::String& _name="",
|
||||
const etk::String& _description="");
|
||||
//! @brief Copy constructor (REMOVED)
|
||||
Signal(const Signal&) = delete;
|
||||
/**
|
||||
@ -321,7 +321,7 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(OBSERVER_TYPE&&
|
||||
ESIGNAL_DEBUG("esignal: '" << getName() << "' try connect: '" << getName() << "' (observer)");
|
||||
std::unique_ptr<Executor> executer(new Executor(std::forward<OBSERVER_TYPE>(_observer)));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
@ -343,7 +343,7 @@ esignal::Connection esignal::SignalInternal<T_ARGS...>::connect(CLASS_TYPE* _cla
|
||||
(*_class.*_func)(_argBase..., _arg... );
|
||||
}));
|
||||
size_t uid = executer->m_uid;
|
||||
m_executors.push_back(std::move(executer));
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver != nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
@ -371,7 +371,7 @@ void esignal::SignalInternal<T_ARGS...>::connect(const ememory::SharedPtr<PARENT
|
||||
// TODO : Check if compilator does not use the shared ptr ...
|
||||
(*directPointer.*_func)(_argBase..., _args... );
|
||||
}));
|
||||
m_executors.push_back(std::move(executer));
|
||||
m_executors.pushBack(etk::move(executer));
|
||||
if (m_connectionObserver!=nullptr) {
|
||||
m_connectionObserver(m_executors.size());
|
||||
}
|
||||
@ -385,8 +385,8 @@ template<class CLASS_TYPE,
|
||||
, int>::type>
|
||||
esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
@ -411,8 +411,8 @@ template<class CLASS_TYPE,
|
||||
, int>::type>
|
||||
esignal::Signal<T_ARGS...>::Signal(CLASS_TYPE* _class,
|
||||
FUNC_TYPE _func,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// nothing to do
|
||||
if (_func != nullptr) {
|
||||
|
@ -17,9 +17,9 @@
|
||||
ESIGNAL_DECLARE_SIGNAL();
|
||||
// std generic signal
|
||||
ESIGNAL_DECLARE_SIGNAL(bool);
|
||||
ESIGNAL_DECLARE_SIGNAL(std::string);
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::String);
|
||||
#if __CPP_VERSION__ >= 2011
|
||||
ESIGNAL_DECLARE_SIGNAL(std::u32string);
|
||||
ESIGNAL_DECLARE_SIGNAL(etk::UString);
|
||||
#endif
|
||||
|
||||
ESIGNAL_DECLARE_SIGNAL(int64_t);
|
||||
|
@ -18,12 +18,12 @@ esignal::Signal<T_ARGS...>::~Signal() {
|
||||
|
||||
template<typename... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::Signal(esignal::BaseInternal::ObserverConnection _countObs,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
esignal::Base(),
|
||||
m_signalInterfaceLink(nullptr) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(std::move(_countObs));
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(etk::move(_countObs));
|
||||
if (esignal::Base::m_data != nullptr) {
|
||||
esignal::Base::m_data->setName(_name);
|
||||
esignal::Base::m_data->setDescription(_description);
|
||||
@ -32,8 +32,8 @@ esignal::Signal<T_ARGS...>::Signal(esignal::BaseInternal::ObserverConnection _co
|
||||
|
||||
template<class... T_ARGS>
|
||||
esignal::Signal<T_ARGS...>::Signal(esignal::Interface* _signalInterfaceLink,
|
||||
const std::string& _name,
|
||||
const std::string& _description):
|
||||
const etk::String& _name,
|
||||
const etk::String& _description):
|
||||
m_signalInterfaceLink(_signalInterfaceLink) {
|
||||
// create internal data assiciated:
|
||||
m_data = ememory::makeShared<esignal::SignalInternal<T_ARGS...>>(nullptr);
|
||||
@ -154,7 +154,7 @@ esignal::SignalInternal<T_ARGS...>::Executor::Executor(Observer&& _observer):
|
||||
m_removed(false),
|
||||
m_uid(0) {
|
||||
m_uid = s_uid++;
|
||||
m_observer = std::move(_observer);
|
||||
m_observer = etk::move(_observer);
|
||||
}
|
||||
|
||||
template<typename... T_ARGS>
|
||||
@ -179,7 +179,7 @@ bool esignal::SignalInternal<T_ARGS...>::Executor::isSharedPtr(const ememory::Sh
|
||||
|
||||
template<typename... T_ARGS>
|
||||
esignal::SignalInternal<T_ARGS...>::ExecutorShared::ExecutorShared(ememory::WeakPtr<void> _object, Observer&& _observer) :
|
||||
Executor(std::move(_observer)),
|
||||
Executor(etk::move(_observer)),
|
||||
m_object(_object) {
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_path(".")
|
||||
my_module.add_flag('c++', [
|
||||
"-DESIGNAL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
|
||||
"-DESIGNAL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
|
||||
])
|
||||
my_module.add_optionnal_depend('echrono', compilation_flags=["c++", "-DESIGNAL_BUILD_WITH_ECHRONO"])
|
||||
my_module.add_tools(['esignal-test'])
|
||||
|
@ -22,7 +22,7 @@ void declareSignals() {
|
||||
//! [esignal_sample_declare_void]
|
||||
|
||||
//! [esignal_sample_declare_string]
|
||||
esignal::Signal<std::string> signalString;
|
||||
esignal::Signal<etk::String> signalString;
|
||||
//! [esignal_sample_declare_string]
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ class TmpClass {
|
||||
void localCallBack(const int32_t& _val) {
|
||||
TEST_PRINT("Callback Local the value is : " << _val);
|
||||
}
|
||||
void localCallBackSecond(const int32_t& _val, const std::string& _otherValue) {
|
||||
void localCallBackSecond(const int32_t& _val, const etk::String& _otherValue) {
|
||||
TEST_PRINT("Callback 2 Local the value is : " << _val << " with perso: '" << _otherValue << "'");
|
||||
}
|
||||
};
|
||||
@ -114,12 +114,12 @@ void sharedConnection() {
|
||||
void newSignal() {
|
||||
// Declare new signal
|
||||
//! [esignal_sample_new_declare]
|
||||
esignal::Signal<int32_t, std::string> signalCustum;
|
||||
esignal::Signal<int32_t, etk::String> signalCustum;
|
||||
//! [esignal_sample_new_declare]
|
||||
// Connect a lambda
|
||||
//! [esignal_sample_new_lambda]
|
||||
esignal::Connection con2 = signalCustum.connect(
|
||||
[](int32_t _val, std::string _val2) {
|
||||
[](int32_t _val, etk::String _val2) {
|
||||
TEST_PRINT("lambda callback: " << _val << " vel2=" << _val2);
|
||||
});
|
||||
//! [esignal_sample_new_lambda]
|
||||
@ -132,7 +132,7 @@ void newSignal() {
|
||||
// do it in a single C++: Implementation of signal
|
||||
//! [esignal_sample_new_register]
|
||||
#include <esignal/details/Signal.hxx>
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, std::string);
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, etk::String);
|
||||
//! [esignal_sample_new_register]
|
||||
|
||||
//! [esignal_sample_new]
|
||||
|
@ -9,6 +9,6 @@
|
||||
#include <etk/types.hpp>
|
||||
|
||||
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, std::string);
|
||||
ESIGNAL_DECLARE_SIGNAL(int32_t, etk::String);
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||
etk::init(_argc, _argv);
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
TEST_PRINT("esignal-test - help : ");
|
||||
|
@ -17,7 +17,7 @@
|
||||
class testISignal : public esignal::Interface {
|
||||
public:
|
||||
esignal::Signal<int32_t> m_signalInt;
|
||||
esignal::Signal<std::string> m_signalString;
|
||||
esignal::Signal<etk::String> m_signalString;
|
||||
esignal::Signal<float> m_signalFloat;
|
||||
public:
|
||||
size_t m_count;
|
||||
@ -37,10 +37,10 @@ TEST(test_isignal_counter, localbasicCounter1) {
|
||||
testISignal localClass;
|
||||
EXPECT_EQ(localClass.m_signalString.size(), 0);
|
||||
EXPECT_EQ(localClass.m_signalString.empty(), true);
|
||||
esignal::Connection connection1 = localClass.m_signalString.connect([=](std::string){});
|
||||
esignal::Connection connection1 = localClass.m_signalString.connect([=](etk::String){});
|
||||
EXPECT_EQ(localClass.m_signalString.size(), 1);
|
||||
EXPECT_EQ(localClass.m_signalString.empty(), false);
|
||||
esignal::Connection connection2 = localClass.m_signalString.connect([=](std::string){});
|
||||
esignal::Connection connection2 = localClass.m_signalString.connect([=](etk::String){});
|
||||
EXPECT_EQ(localClass.m_signalString.size(), 2);
|
||||
EXPECT_EQ(localClass.m_signalString.empty(), false);
|
||||
connection1.disconnect();
|
||||
@ -96,10 +96,10 @@ class testCallbackIShared : public ememory::EnableSharedFromThis<testCallbackISh
|
||||
|
||||
TEST(test_isignal_counter, localbasicInterfaceGetListSignal) {
|
||||
testISignal localClass;
|
||||
std::vector<std::string> list;
|
||||
list.push_back("int");
|
||||
list.push_back("string");
|
||||
list.push_back("float");
|
||||
etk::Vector<etk::String> list;
|
||||
list.pushBack("int");
|
||||
list.pushBack("string");
|
||||
list.pushBack("float");
|
||||
EXPECT_EQ(localClass.signals.getAll(), list);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
class testCallback {
|
||||
public:
|
||||
int32_t m_int32;
|
||||
std::string m_string;
|
||||
etk::String m_string;
|
||||
bool m_void;
|
||||
testCallback() {
|
||||
m_emptyFunctor = nullptr;
|
||||
@ -40,30 +40,30 @@ class testCallback {
|
||||
TEST_VERBOSE("event a=" << _a);
|
||||
m_int32 = _a;
|
||||
}
|
||||
void callbackString(std::string _b){
|
||||
void callbackString(etk::String _b){
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackConstString(const std::string& _b){
|
||||
void callbackConstString(const etk::String& _b){
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackIntString(int32_t _a, std::string _b){
|
||||
void callbackIntString(int32_t _a, etk::String _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackConstIntString(const int32_t& _a, const std::string& _b){
|
||||
void callbackConstIntString(const int32_t& _a, const etk::String& _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackMixedIntString(int32_t _a, const std::string& _b){
|
||||
void callbackMixedIntString(int32_t _a, const etk::String& _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackPolyargs(const int32_t& _a, const std::string& _b, char _char, int _int) {
|
||||
void callbackPolyargs(const int32_t& _a, const etk::String& _b, char _char, int _int) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b << " _char=" << _char << " _int=" << _int);
|
||||
m_int32 = _a + _int;
|
||||
m_string = _b + _char;
|
||||
@ -168,7 +168,7 @@ TEST(test_signal_class_func, localFunctionConstInt32) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionString) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackString);
|
||||
@ -180,7 +180,7 @@ TEST(test_signal_class_func, localFunctionString) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionConstString) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackConstString);
|
||||
@ -192,7 +192,7 @@ TEST(test_signal_class_func, localFunctionConstString) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionIntString) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackIntString);
|
||||
@ -205,7 +205,7 @@ TEST(test_signal_class_func, localFunctionIntString) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionConstIntString) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackConstIntString);
|
||||
@ -218,7 +218,7 @@ TEST(test_signal_class_func, localFunctionConstIntString) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionMixedIntString) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackMixedIntString);
|
||||
@ -231,7 +231,7 @@ TEST(test_signal_class_func, localFunctionMixedIntString) {
|
||||
|
||||
TEST(test_signal_class_func, localFunctionConstIntStringPolyArg) {
|
||||
testCallback localClass;
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&localClass, &testCallback::callbackPolyargs, 'c', 12365);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
class testCounter {
|
||||
public:
|
||||
esignal::Signal<std::string> m_signal;
|
||||
esignal::Signal<etk::String> m_signal;
|
||||
public:
|
||||
size_t m_int32;
|
||||
testCounter():
|
||||
@ -33,11 +33,11 @@ TEST(test_signal_counter, localbasicCounter) {
|
||||
EXPECT_EQ(localClass.m_signal.size(), 0);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), true);
|
||||
EXPECT_EQ(localClass.m_int32, 0);
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](std::string){});
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](etk::String){});
|
||||
EXPECT_EQ(localClass.m_signal.size(), 1);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), false);
|
||||
EXPECT_EQ(localClass.m_int32, 1);
|
||||
esignal::Connection connection2 = localClass.m_signal.connect([=](std::string){});
|
||||
esignal::Connection connection2 = localClass.m_signal.connect([=](etk::String){});
|
||||
EXPECT_EQ(localClass.m_signal.size(), 2);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), false);
|
||||
EXPECT_EQ(localClass.m_int32, 2);
|
||||
@ -57,11 +57,11 @@ TEST(test_signal_counter, localbasicCopy) {
|
||||
EXPECT_EQ(localClass.m_signal.size(), 0);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), true);
|
||||
EXPECT_EQ(localClass.m_int32, 0);
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](std::string){});
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](etk::String){});
|
||||
EXPECT_EQ(localClass.m_signal.size(), 1);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), false);
|
||||
EXPECT_EQ(localClass.m_int32, 1);
|
||||
esignal::Connection connection2 = std::move(connection1);
|
||||
esignal::Connection connection2 = etk::move(connection1);
|
||||
EXPECT_EQ(localClass.m_signal.size(), 1);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), false);
|
||||
EXPECT_EQ(localClass.m_int32, 1);
|
||||
@ -81,7 +81,7 @@ TEST(test_signal_counter, localbasicCheckConnection) {
|
||||
EXPECT_EQ(localClass.m_signal.size(), 0);
|
||||
EXPECT_EQ(localClass.m_signal.empty(), true);
|
||||
EXPECT_EQ(localClass.m_int32, 0);
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](std::string){});
|
||||
esignal::Connection connection1 = localClass.m_signal.connect([=](etk::String){});
|
||||
EXPECT_EQ(connection1.isConnected(), true);
|
||||
connection1.disconnect();
|
||||
EXPECT_EQ(connection1.isConnected(), false);
|
||||
|
@ -16,7 +16,7 @@
|
||||
class testCallbackShared : public ememory::EnableSharedFromThis<testCallbackShared> {
|
||||
public:
|
||||
int32_t m_int32;
|
||||
std::string m_string;
|
||||
etk::String m_string;
|
||||
bool m_void;
|
||||
testCallbackShared() {
|
||||
m_emptyFunctor = nullptr;
|
||||
@ -45,30 +45,30 @@ class testCallbackShared : public ememory::EnableSharedFromThis<testCallbackShar
|
||||
TEST_VERBOSE("event a=" << _a);
|
||||
m_int32 = _a;
|
||||
}
|
||||
void callbackString(std::string _b) {
|
||||
void callbackString(etk::String _b) {
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackConstString(const std::string& _b) {
|
||||
void callbackConstString(const etk::String& _b) {
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackIntString(int32_t _a, std::string _b) {
|
||||
void callbackIntString(int32_t _a, etk::String _b) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackConstIntString(const int32_t& _a, const std::string& _b) {
|
||||
void callbackConstIntString(const int32_t& _a, const etk::String& _b) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackMixedIntString(int32_t _a, const std::string& _b) {
|
||||
void callbackMixedIntString(int32_t _a, const etk::String& _b) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
void callbackPolyargs(const int32_t& _a, const std::string& _b, char _char, int _int) {
|
||||
void callbackPolyargs(const int32_t& _a, const etk::String& _b, char _char, int _int) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b << " _char=" << _char << " _int=" << _int);
|
||||
m_int32 = _a + _int;
|
||||
m_string = _b + _char;
|
||||
@ -149,7 +149,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstInt32) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionString) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
#if 0
|
||||
@ -165,7 +165,7 @@ TEST(test_signal_shared_ptr_func, localFunctionString) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstString) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
signal.connect(localClass, &testCallbackShared::callbackConstString);
|
||||
@ -177,7 +177,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstString) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionIntString) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
#if 0
|
||||
@ -194,7 +194,7 @@ TEST(test_signal_shared_ptr_func, localFunctionIntString) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstIntString) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
signal.connect(localClass, &testCallbackShared::callbackConstIntString);
|
||||
@ -207,7 +207,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstIntString) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionMixedIntString) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
#if 0
|
||||
@ -225,7 +225,7 @@ TEST(test_signal_shared_ptr_func, localFunctionMixedIntString) {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionConstIntStringPolyArg) {
|
||||
ememory::SharedPtr<testCallbackShared> localClass = ememory::makeShared<testCallbackShared>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
signal.connect(localClass, &testCallbackShared::callbackPolyargs, 'c', 12365);
|
||||
@ -238,7 +238,7 @@ TEST(test_signal_shared_ptr_func, localFunctionConstIntStringPolyArg) {
|
||||
|
||||
class testCallbackSharedHerited : public testCallbackShared {
|
||||
public:
|
||||
void callbackHerited(const int32_t& _a, const std::string& _b) {
|
||||
void callbackHerited(const int32_t& _a, const etk::String& _b) {
|
||||
m_int32 = _a;
|
||||
m_string = _b;
|
||||
}
|
||||
@ -247,7 +247,7 @@ class testCallbackSharedHerited : public testCallbackShared {
|
||||
|
||||
TEST(test_signal_shared_ptr_func, localFunctionHerited) {
|
||||
ememory::SharedPtr<testCallbackSharedHerited> localClass = ememory::makeShared<testCallbackSharedHerited>();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
signal.connect(localClass, &testCallbackSharedHerited::callbackHerited);
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
static int32_t tmpRetInt32 = 0;
|
||||
static std::string tmpRetString = "";
|
||||
static etk::String tmpRetString = "";
|
||||
static bool tmpRetVoid = false;
|
||||
|
||||
static void clear() {
|
||||
@ -38,35 +38,35 @@ static void callbackConstInt(const int32_t& _a){
|
||||
tmpRetInt32 = _a;
|
||||
};
|
||||
|
||||
static void callbackString(std::string _b){
|
||||
static void callbackString(etk::String _b){
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
tmpRetString = _b;
|
||||
};
|
||||
|
||||
static void callbackConstString(const std::string& _b){
|
||||
static void callbackConstString(const etk::String& _b){
|
||||
TEST_VERBOSE("event b=" << _b);
|
||||
tmpRetString = _b;
|
||||
};
|
||||
|
||||
static void callbackIntString(int32_t _a, std::string _b){
|
||||
static void callbackIntString(int32_t _a, etk::String _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
tmpRetInt32 = _a;
|
||||
tmpRetString = _b;
|
||||
};
|
||||
|
||||
static void callbackConstIntString(const int32_t& _a, const std::string& _b){
|
||||
static void callbackConstIntString(const int32_t& _a, const etk::String& _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
tmpRetInt32 = _a;
|
||||
tmpRetString = _b;
|
||||
};
|
||||
|
||||
static void callbackMixedIntString(int32_t _a, const std::string& _b){
|
||||
static void callbackMixedIntString(int32_t _a, const etk::String& _b){
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b);
|
||||
tmpRetInt32 = _a;
|
||||
tmpRetString = _b;
|
||||
};
|
||||
|
||||
static void callbackPolyargs(const int32_t& _a, const std::string& _b, char _char, int _int) {
|
||||
static void callbackPolyargs(const int32_t& _a, const etk::String& _b, char _char, int _int) {
|
||||
TEST_VERBOSE("event a=" << _a << " b=" << _b << " _char=" << _char << " _int=" << _int);
|
||||
tmpRetInt32 = _a + _int;
|
||||
tmpRetString = _b + _char;
|
||||
@ -110,7 +110,7 @@ TEST(test_signal_static_func, localFunctionConstInt32) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionString) {
|
||||
clear();
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackString);
|
||||
@ -122,7 +122,7 @@ TEST(test_signal_static_func, localFunctionString) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionConstString) {
|
||||
clear();
|
||||
esignal::Signal<std::string> signal;
|
||||
esignal::Signal<etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackConstString);
|
||||
@ -134,7 +134,7 @@ TEST(test_signal_static_func, localFunctionConstString) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionIntString) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackIntString);
|
||||
@ -147,7 +147,7 @@ TEST(test_signal_static_func, localFunctionIntString) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionConstIntString) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackConstIntString);
|
||||
@ -160,7 +160,7 @@ TEST(test_signal_static_func, localFunctionConstIntString) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionMixedIntString) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackMixedIntString);
|
||||
@ -180,7 +180,7 @@ TEST(test_signal_static_func, localFunctionMixedIntString) {
|
||||
}
|
||||
TEST(test_signal_static_func, localFunctionConstIntStringPolyArg) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(complete_args(&callbackPolyargs, 'c', 12365));
|
||||
@ -204,7 +204,7 @@ TEST(test_signal_static_func, localFunctionMixedIntString) {
|
||||
#if 0
|
||||
TEST(test_signal_static_func, localFunctionConstIntStringPolyArgWithJAJA) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(&callbackPolyargs, 'c', 12365);
|
||||
@ -218,11 +218,11 @@ TEST(test_signal_static_func, localFunctionConstIntStringPolyArgWithJAJA) {
|
||||
|
||||
TEST(test_signal_static_func, localFunctionLambda) {
|
||||
clear();
|
||||
esignal::Signal<int32_t, std::string> signal;
|
||||
esignal::Signal<int32_t, etk::String> signal;
|
||||
EXPECT_EQ(signal.size(), 0);
|
||||
EXPECT_EQ(signal.empty(), true);
|
||||
esignal::Connection connection1 = signal.connect(
|
||||
[](int32_t _a, const std::string& _b) {
|
||||
[](int32_t _a, const etk::String& _b) {
|
||||
tmpRetInt32 = _a;
|
||||
tmpRetString = _b;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user