Object.hpp File Reference
#include <etk/types.hpp>
#include <vector>
#include <exml/exml.hpp>
#include <mutex>
#include <ememory/memory.hpp>
#include <unordered_map>
#include <ewol/debug.hpp>
#include <eproperty/Interface.hpp>
#include <eproperty/Value.hpp>
#include <eproperty/Range.hpp>
#include <eproperty/List.hpp>
#include <esignal/Interface.hpp>

Go to the source code of this file.

Classes

class  ewol::Object
 

Macros

#define UN_DECLARE_FACTORY(className)   template<class ... EWOL_FACTORY_CREATE_TYPE> static ememory::SharedPtr<className> create(const EWOL_FACTORY_CREATE_TYPE& ... _all) = delete;
 
#define DECLARE_FACTORY(className)
 
#define DECLARE_SINGLE_FACTORY(className, uniqueName)
 
#define subBind(_type, _name, _event, _shared_ptr, _func, ...)
 
#define globalBind(_type, _name, _event, _obj, _func, ...)
 
#define externSubBind(_object, _type, _name, _event, _obj, _func, ...)
 

Typedefs

using ewol::ObjectShared = ememory::SharedPtr< ewol::Object >
 
using ewol::ObjectWeak = ememory::WeakPtr< ewol::Object >
 

Functions

bool ewol::propertySetOnObjectNamed (const std::string &_objectName, const std::string &_config, const std::string &_value)
 

Detailed Description

Author
Edouard DUPIN
Note
License: APACHE v2.0 (see license file)

Macro Definition Documentation

§ DECLARE_FACTORY

#define DECLARE_FACTORY (   className)
Value:
template<class ... EWOL_FACTORY_CREATE_TYPE> static ememory::SharedPtr<className> create(const EWOL_FACTORY_CREATE_TYPE& ... _all) { \
ememory::SharedPtr<className> object(new className()); \
if (object == nullptr) { \
EWOL_ERROR("Factory error"); \
return nullptr; \
} \
baseInit(object, _all... ); \
object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
} \
return object; \
}
void create(enum ewol::tools::message::type _type, const std::string &_message)
Create a simple pop-up message on the screen for application error.

§ DECLARE_SINGLE_FACTORY

#define DECLARE_SINGLE_FACTORY (   className,
  uniqueName 
)
Value:
template<class ... EWOL_FACTORY_CREATE_TYPE> static ememory::SharedPtr<className> create(const EWOL_FACTORY_CREATE_TYPE& ... _all) { \
ememory::SharedPtr<className> object; \
ememory::SharedPtr<ewol::Object> object2 = getObjectNamed(uniqueName); \
if (object2 != nullptr) { \
object = ememory::dynamicPointerCast<className>(object2); \
if (object == nullptr) { \
EWOL_CRITICAL("Request object element: '" << uniqueName << "' With the wrong type (dynamic cast error)"); \
return nullptr; \
} \
} \
if (object != nullptr) { \
return object; \
} \
object = ememory::SharedPtr<className>(new className()); \
if (object == nullptr) { \
EWOL_ERROR("Factory error"); \
return nullptr; \
} \
baseInit(object, "name", std::string(uniqueName), _all... ); \
object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
} \
return object; \
}
void create(enum ewol::tools::message::type _type, const std::string &_message)
Create a simple pop-up message on the screen for application error.

§ externSubBind

#define externSubBind (   _object,
  _type,
  _name,
  _event,
  _obj,
  _func,
  ... 
)
Value:
do {\
ememory::SharedPtr<_type> myObject = ememory::dynamicPointerCast<_type>(_object->getObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)

link on an signal in the subWidget of an object with his name

§ globalBind

#define globalBind (   _type,
  _name,
  _event,
  _obj,
  _func,
  ... 
)
Value:
do {\
ememory::SharedPtr<_type> myObject = ememory::dynamicPointerCast<_type>(ewol::getContext().getEObjectManager().getObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)
ewol::ObjectShared getObjectNamed(const std::string &_name)
retrive an object with his name
Context & getContext()
From everyware in the program, we can get the context inteface.

link on an signal in the global object list with his name

§ subBind

#define subBind (   _type,
  _name,
  _event,
  _shared_ptr,
  _func,
  ... 
)
Value:
do {\
ememory::SharedPtr<_type> myObject = ememory::dynamicPointerCast<_type>(getSubObjectNamed(_name)); \
if (myObject != nullptr) { \
myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \
} else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \
} while (false)

link on an signal in the subwiget with his name