simplify the EObject class

This commit is contained in:
Edouard Dupin 2012-07-24 17:48:18 +02:00
parent 53c34d0894
commit 64be551b35
11 changed files with 9 additions and 292 deletions

View File

@ -33,39 +33,12 @@
#undef __class__
#define __class__ "classBufferManager"
//!< EObject name :
extern const char * const TYPE_EOBJECT_EDN_BUFFER_MANAGER = "BufferManager";
class classBufferManager: public ewol::EObject
{
public:
// Constructeur
classBufferManager(void);
~classBufferManager(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_BUFFER_MANAGER << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_BUFFER_MANAGER) {
return true;
} else {
if(true == ewol::EObject::CheckObjectType(objectType)) {
return true;
}
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_BUFFER_MANAGER << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
@ -74,7 +47,7 @@ class classBufferManager: public ewol::EObject
*/
const char * const GetObjectType(void)
{
return TYPE_EOBJECT_EDN_BUFFER_MANAGER;
return "ApplBufferManager";
}
public:
/**
@ -114,8 +87,6 @@ class classBufferManager: public ewol::EObject
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
};
#define EDN_CAST_BUFFER_MANAGER(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_BUFFER_MANAGER,classBufferManager,curentPointer)
// Constructeur
/**

View File

@ -31,38 +31,12 @@
#define PFX "ColorizeManager "
//!< EObject name :
extern const char * const TYPE_EOBJECT_EDN_COLORIZE_MANAGER = "ColorizeManager";
class classColorManager: public ewol::EObject
{
public:
// Constructeur
classColorManager(void);
~classColorManager(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_COLORIZE_MANAGER << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_COLORIZE_MANAGER) {
return true;
} else {
if(true == ewol::EObject::CheckObjectType(objectType)) {
return true;
}
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_COLORIZE_MANAGER << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
@ -72,7 +46,7 @@ class classColorManager: public ewol::EObject
*/
const char * const GetObjectType(void)
{
return TYPE_EOBJECT_EDN_COLORIZE_MANAGER;
return "ApplColorManager";
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data
@ -99,8 +73,6 @@ class classColorManager: public ewol::EObject
color_ts basicColors[COLOR_NUMBER_MAX];
};
#define EDN_CAST_COLORIZE_MANAGER(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_COLORIZE_MANAGER,classColorManager,curentPointer)
classColorManager::classColorManager(void)
{

View File

@ -35,8 +35,6 @@
#define __class__ "BufferView"
extern const char * const TYPE_EOBJECT_EDN_BUFFER_VIEW = "BufferView";
BufferView::BufferView(void)
{
SetCanHaveFocus(true);
@ -52,39 +50,6 @@ BufferView::~BufferView(void)
}
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool BufferView::CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_BUFFER_VIEW << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_BUFFER_VIEW) {
return true;
} else {
if(true == ewol::List::CheckObjectType(objectType)) {
return true;
}
EWOL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_BUFFER_VIEW << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const BufferView::GetObjectType(void)
{
return TYPE_EOBJECT_EDN_BUFFER_VIEW;
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data

View File

@ -31,29 +31,19 @@
#include <appl/globalMsg.h>
#include <ewol/widget/List.h>
//!< EObject name :
extern const char * const TYPE_EOBJECT_EDN_BUFFER_VIEW;
class BufferView : public ewol::List
{
public:
// Constructeur
BufferView(void);
~BufferView(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const GetObjectType(void);
const char * const GetObjectType(void) { return "ApplBufferView"; };
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
@ -75,7 +65,6 @@ class BufferView : public ewol::List
int32_t m_selectedID;
};
#define EDN_CAST_BUFFER_VIEW(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_BUFFER_VIEW,BufferView,curentPointer)
#endif

View File

@ -42,8 +42,6 @@
#define __class__ "CodeView"
extern const char * const TYPE_EOBJECT_EDN_CODE_VIEW = "CodeView";
CodeView::CodeView(void)
{
m_label = "CodeView is disable ...";
@ -103,41 +101,6 @@ void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
}
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CodeView::CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_CODE_VIEW << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_CODE_VIEW) {
return true;
} else {
if(true == ewol::WidgetScrooled::CheckObjectType(objectType)) {
return true;
}
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_CODE_VIEW << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const CodeView::GetObjectType(void)
{
return TYPE_EOBJECT_EDN_CODE_VIEW;
}
bool CodeView::CalculateMinSize(void)
{
m_minSize.x = 50;

View File

@ -34,28 +34,18 @@
#include <etk/Types.h>
#include <ewol/widget/WidgetScrolled.h>
//!< EObject name :
extern const char * const TYPE_EOBJECT_EDN_CODE_VIEW;
class CodeView :public ewol::WidgetScrooled
{
public:
CodeView(void);
virtual ~CodeView(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const GetObjectType(void);
const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void);
private:
etk::UString m_label;
@ -116,7 +106,5 @@ class CodeView :public ewol::WidgetScrooled
virtual void OnDraw(ewol::DrawProperty& displayProp);
};
#define EDN_CAST_CODE_VIEW(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_CODE_VIEW,CodeView,curentPointer)
#endif

View File

@ -116,8 +116,6 @@ class ParameterAboutGui : public ewol::SizerVert
#undef __class__
#define __class__ "MainWindows"
extern const char * const TYPE_EOBJECT_EDN_MAIN_WINDOWS = __class__;
MainWindows::MainWindows(void)
{
APPL_DEBUG("CREATE WINDOWS ... ");
@ -231,40 +229,6 @@ MainWindows::~MainWindows(void)
}
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool MainWindows::CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_MAIN_WINDOWS << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_MAIN_WINDOWS) {
return true;
} else {
if(true == ewol::Windows::CheckObjectType(objectType)) {
return true;
}
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_MAIN_WINDOWS << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const MainWindows::GetObjectType(void)
{
return TYPE_EOBJECT_EDN_MAIN_WINDOWS;
}
const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
@ -297,14 +261,8 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (eventId == ednEventPopUpFileSelected) {
// get widget:
ewol::FileChooser * tmpWidget = EWOL_CAST_WIDGET_FILE_CHOOSER(CallerObject);
if (NULL == tmpWidget) {
APPL_ERROR("impossible to get pop_upWidget " << CallerObject);
return;
}
// get the filename :
etk::UString tmpData = tmpWidget->GetCompleateFileName();
etk::UString tmpData = data;
APPL_DEBUG("Request opening the file : " << tmpData);
SendMultiCast(ednMsgOpenFile, tmpData);
} else if (eventId == ednMsgGuiSaveAs) {
@ -343,14 +301,8 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
}
}
} else if (eventId == ednEventPopUpFileSaveAs) {
// get widget:
ewol::FileChooser * tmpWidget = EWOL_CAST_WIDGET_FILE_CHOOSER(CallerObject);
if (NULL == tmpWidget) {
APPL_ERROR("impossible to get pop_upWidget " << CallerObject);
return;
}
// get the filename :
etk::UString tmpData = tmpWidget->GetCompleateFileName();
etk::UString tmpData = data;
APPL_DEBUG("Request Saving As file : " << tmpData);
BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);

View File

@ -33,8 +33,6 @@
#include <BufferManager.h>
#include <ewol/widget/Label.h>
extern const char * const TYPE_EOBJECT_EDN_MAIN_WINDOWS;
class MainWindows : public ewol::Windows
{
private:
@ -44,20 +42,13 @@ class MainWindows : public ewol::Windows
// Constructeur
MainWindows(void);
~MainWindows(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const GetObjectType(void);
const char * const GetObjectType(void) { return "MainWindows"; };
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from

View File

@ -37,9 +37,6 @@
#undef __class__
#define __class__ "Search"
extern const char * const TYPE_EOBJECT_APPL_SEARCH = __class__;
const char* const l_eventSearchEntry = "appl-search-entry";
const char* const l_eventSearchEntryEnter = "appl-search-entry-enter";
const char* const l_eventReplaceEntry = "appl-replace-entry";
@ -154,39 +151,6 @@ Search::~Search(void)
}
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool Search::CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
APPL_ERROR("check error : \"" << TYPE_EOBJECT_APPL_SEARCH << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_APPL_SEARCH) {
return true;
} else {
if(true == ewol::SizerHori::CheckObjectType(objectType)) {
return true;
}
APPL_ERROR("check error : \"" << TYPE_EOBJECT_APPL_SEARCH << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const Search::GetObjectType(void)
{
return TYPE_EOBJECT_APPL_SEARCH;
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data

View File

@ -30,28 +30,19 @@
#include <ewol/widget/SizerHori.h>
#include <ewol/widget/Entry.h>
extern const char * const TYPE_EOBJECT_APPL_SEARCH;
class Search : public ewol::SizerHori
{
public:
// Constructeur
Search(void);
~Search(void);
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
const char * const GetObjectType(void);
const char * const GetObjectType(void) { return "ApplSearch"; };
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
@ -73,8 +64,6 @@ class Search : public ewol::SizerHori
ewol::Entry * m_replaceEntry;
};
#define EDN_CAST_APPL_SEARCH(curentPointer) EWOL_CAST(TYPE_EOBJECT_APPL_SEARCH,Search,curentPointer)
#endif

View File

@ -32,10 +32,6 @@
#undef __class__
#define __class__ "HighlightManager"
//!< EObject name :
extern const char * const TYPE_EOBJECT_EDN_HIGHLIGHT_MANAGER = "HighlightManager";
class localClassHighlightManager: public ewol::EObject
{
private:
@ -58,29 +54,6 @@ class localClassHighlightManager: public ewol::EObject
listHighlight.Clear();
};
/**
* @brief Check if the object has the specific type.
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type of the object we want to check
* @return true if the object is compatible, otherwise false
*/
bool CheckObjectType(const char * const objectType)
{
if (NULL == objectType) {
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_HIGHLIGHT_MANAGER << "\" != NULL(pointer) ");
return false;
}
if (objectType == TYPE_EOBJECT_EDN_HIGHLIGHT_MANAGER) {
return true;
} else {
if(true == ewol::EObject::CheckObjectType(objectType)) {
return true;
}
APPL_ERROR("check error : \"" << TYPE_EOBJECT_EDN_HIGHLIGHT_MANAGER << "\" != \"" << objectType << "\"");
return false;
}
}
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
@ -89,7 +62,7 @@ class localClassHighlightManager: public ewol::EObject
*/
const char * const GetObjectType(void)
{
return TYPE_EOBJECT_EDN_HIGHLIGHT_MANAGER;
return "ApplHighlightManager";
}
/**