Modified the structure to provide fini() function and correct cleanup for singleton... 81/16781/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 29 Aug 2013 06:00:03 +0000 (15:00 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 5 Mar 2014 06:33:12 +0000 (22:33 -0800)
Change-Id: Icb3956695b8954828b6bcbe731c5912c275a1a3a

87 files changed:
CMakeLists.txt
binary_xmlresource/autopopup_configure_bin_parser.cpp
binary_xmlresource/binary_xmlresource.cpp
binary_xmlresource/default_configure_bin_parser.cpp
binary_xmlresource/include/autopopup_configure_bin_parser.h
binary_xmlresource/include/binary_xmlresource.h
binary_xmlresource/include/default_configure_bin_parser.h
binary_xmlresource/include/input_mode_configure_bin_parser.h
binary_xmlresource/include/key_coordinate_frame_bin_parser.h
binary_xmlresource/include/label_properties_bin_parser.h
binary_xmlresource/include/layout_bin_parser.h
binary_xmlresource/include/magnifier_configure_bin_parser.h
binary_xmlresource/include/modifier_decoration_bin_parser.h
binary_xmlresource/include/nine_patch_file_list_bin_parser.h
binary_xmlresource/input_mode_configure_bin_parser.cpp
binary_xmlresource/key_coordinate_frame_bin_parser.cpp
binary_xmlresource/label_properties_bin_parser.cpp
binary_xmlresource/layout_bin_parser.cpp
binary_xmlresource/magnifier_configure_bin_parser.cpp
binary_xmlresource/modifier_decoration_bin_parser.cpp
binary_xmlresource/nine_patch_file_list_bin_parser.cpp
res/simple_debug.cpp
res/simple_debug.h
scl/gwes/efl/sclevents-efl.cpp
scl/gwes/efl/sclevents-efl.h
scl/gwes/efl/sclgraphics-efl.cpp
scl/gwes/efl/sclgraphics-efl.h
scl/gwes/efl/sclwindows-efl.cpp
scl/gwes/efl/sclwindows-efl.h
scl/include/sclactionstate.h
scl/include/sclcontext.h
scl/include/sclcontroller.h
scl/include/sclerroradjustment.h
scl/include/scleventhandler.h
scl/include/sclevents.h
scl/include/sclfeedback.h
scl/include/sclfontproxy.h
scl/include/sclgraphics.h
scl/include/sclgwes.h
scl/include/sclimageproxy.h
scl/include/sclresourcecache.h
scl/include/sclui.h
scl/include/scluibuilder.h
scl/include/scluiimpl.h
scl/include/sclutils.h
scl/include/sclwindows.h
scl/sclactionstate.cpp
scl/sclcontext.cpp
scl/sclcontroller.cpp
scl/sclerroradjustment.cpp
scl/scleventhandler.cpp
scl/sclevents.cpp
scl/sclfeedback.cpp
scl/sclfontproxy.cpp
scl/sclgraphics.cpp
scl/sclgwes.cpp
scl/sclimageproxy.cpp
scl/sclresourcecache.cpp
scl/sclui.cpp
scl/scluibuilder.cpp
scl/scluiimpl.cpp
scl/sclutils.cpp
scl/sclwindows.cpp
scl/utils/linux/sclutils-linux.cpp
scl/utils/win32/sclutils-win32.cpp
sclres/sclres_manager.cpp
sclres/sclres_manager.h
xmlresource/autopopup_configure_parser.cpp
xmlresource/default_configure_parser.cpp
xmlresource/include/autopopup_configure_parser.h
xmlresource/include/default_configure_parser.h
xmlresource/include/input_mode_configure_parser.h
xmlresource/include/label_properties_parser.h
xmlresource/include/layout_parser.h
xmlresource/include/magnifier_configure_parser.h
xmlresource/include/main_entry_parser.h
xmlresource/include/modifier_decoration_parser.h
xmlresource/include/nine_patch_file_list_parser.h
xmlresource/include/xmlresource.h
xmlresource/input_mode_configure_parser.cpp
xmlresource/label_properties_parser.cpp
xmlresource/layout_parser.cpp
xmlresource/magnifier_configure_parser.cpp
xmlresource/main_entry_parser.cpp
xmlresource/modifier_decoration_parser.cpp
xmlresource/nine_patch_file_list_parser.cpp
xmlresource/xmlresource.cpp

index f22c35b..5038191 100644 (file)
@@ -94,6 +94,7 @@ pkg_check_modules(pkgs REQUIRED
         libxml-2.0
         utilX
         tts
+        vconf
         )
 
 FOREACH(flag ${pkgs_CFLAGS})
index 97db1a8..df8b8ee 100644 (file)
@@ -20,8 +20,6 @@
 using namespace std;
 #include "put_record.h"
 
-BinAutoPopupConfigParser* BinAutoPopupConfigParser::m_instance = NULL;
-
 BinAutoPopupConfigParser::BinAutoPopupConfigParser() {
     memset((void*)&m_autopopup_configure, 0x00, sizeof(SclAutoPopupConfigure));
 }
@@ -30,10 +28,9 @@ BinAutoPopupConfigParser::~BinAutoPopupConfigParser() {
 }
 
 BinAutoPopupConfigParser* BinAutoPopupConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinAutoPopupConfigParser();
-    }
-    return m_instance;
+    static BinAutoPopupConfigParser instance;
+
+    return &instance;
 }
 
 void
index dcebb49..eac0e00 100644 (file)
@@ -26,8 +26,6 @@
 
 using namespace binary_xmlresource;
 
-BinResource* BinResource::m_instance = NULL;
-
 BinResource::BinResource() {
     m_input_mode_configure_parser = NULL;
     m_layout_parser = NULL;
@@ -41,44 +39,20 @@ BinResource::BinResource() {
 }
 
 BinResource::~BinResource() {
-    if (m_input_mode_configure_parser)
-        delete m_input_mode_configure_parser;
     m_input_mode_configure_parser = NULL;
-    if (m_layout_parser)
-        delete m_layout_parser;
     m_layout_parser = NULL;
-    if (m_key_coordinate_frame_parser)
-        delete m_key_coordinate_frame_parser;
     m_key_coordinate_frame_parser = NULL;
-    if (m_modifier_decoration_parser)
-        delete m_modifier_decoration_parser;
     m_modifier_decoration_parser = NULL;
-
-    if (m_label_properties_parser)
-        delete m_label_properties_parser;
     m_label_properties_parser = NULL;
-
-    if (m_default_configure_parser)
-        delete m_default_configure_parser;
     m_default_configure_parser = NULL;
-
-    if (m_autopopup_configure_parser)
-        delete m_autopopup_configure_parser;
     m_autopopup_configure_parser = NULL;
-    if (m_magnifier_configure_parser)
-        delete m_magnifier_configure_parser;
     m_magnifier_configure_parser = NULL;
-
-    if (m_nine_patch_file_list_parser)
-        delete m_nine_patch_file_list_parser;
     m_nine_patch_file_list_parser = NULL;
 }
 
 BinResource* BinResource::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinResource();
-    }
-    return m_instance;
+    static BinResource instance;
+    return &instance;
 }
 
 void BinResource::init(const char *entry_filepath) {
index 2d67414..18446d6 100644 (file)
@@ -20,8 +20,6 @@
 using namespace std;
 #include "put_record.h"
 
-BinDefaultConfigParser* BinDefaultConfigParser::m_instance = NULL;
-
 BinDefaultConfigParser::BinDefaultConfigParser() {
     memset((void*)&m_default_configure, 0x00, sizeof(SclDefaultConfigure));
 }
@@ -30,10 +28,8 @@ BinDefaultConfigParser::~BinDefaultConfigParser() {
 }
 
 BinDefaultConfigParser* BinDefaultConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinDefaultConfigParser();
-    }
-    return m_instance;
+    static BinDefaultConfigParser instance;
+    return &instance;
 }
 
 void BinDefaultConfigParser::init(const FileStorage& storage, int offset, int size,  IParserInfo_Provider* parser_info_provider) {
index b05a4dd..6156e14 100644 (file)
@@ -36,20 +36,10 @@ private:
     void parsing_autopopup_configure();
     void decode_color(SclColor&, int width);
 private:
-    static BinAutoPopupConfigParser *m_instance;
     SclAutoPopupConfigure m_autopopup_configure;
     StringCollector m_string_collector;
     FileStorage m_storage;
     IParserInfo_Provider* parser_info_provider;
-private:
-    class DestructHelper {
-    public:
-        ~DestructHelper() {
-            if (BinAutoPopupConfigParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 6fb876e..ed7b3f5 100644 (file)
@@ -92,8 +92,6 @@ class BinResource: public sclres::SclRes{
     BinResource();
 
     private:
-    static BinResource* m_instance;
-
     BinInputModeConfigParser *m_input_mode_configure_parser;
     BinLayoutParser *m_layout_parser;
     BinKeyCoordFrameParser *m_key_coordinate_frame_parser;
@@ -103,19 +101,6 @@ class BinResource: public sclres::SclRes{
     BinAutoPopupConfigParser *m_autopopup_configure_parser;
     BinMagnifierConfigParser *m_magnifier_configure_parser;
     BinNinePatchFileParser *m_nine_patch_file_list_parser;
-
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinResource::m_instance != NULL)
-            {
-                delete m_instance;
-                m_instance = NULL;
-            }
-        }
-    };
-    static DestructHelper des;
 };
 }
 
index 3b57cdf..48f5138 100644 (file)
@@ -37,20 +37,10 @@ private:
     void parsing_default_configure();
     void decode_color(SclColor&, int width);
 private:
-    static BinDefaultConfigParser *m_instance;
     SclDefaultConfigure m_default_configure;
     StringCollector m_string_collector;
     IParserInfo_Provider* parser_info_provider;
     FileStorage m_storage;
-private:
-    class DestructHelper {
-    public:
-        ~DestructHelper() {
-            if (BinDefaultConfigParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 98eefb7..c237579 100644 (file)
@@ -43,11 +43,9 @@ class BinInputModeConfigParser {
 
         StringCollector m_string_collector;
     private:
-        static BinInputModeConfigParser *m_instance;
         int m_inputmode_size;
         SclInputModeConfigure m_input_mode_configure_table[MAX_SCL_INPUT_MODE];
 
-
         FileStorage m_storage;
         IParserInfo_Provider* parser_info_provider;
 };
index 9b42661..d457d36 100644 (file)
@@ -39,21 +39,11 @@ class BinKeyCoordFrameParser {
     void decode_key_coordinate_record(FileStorage& storage, const PSclLayoutKeyCoordinate cur, const Key_coordinate_record_width&);
 
     private:
-        static BinKeyCoordFrameParser *m_instance;
         SclLayoutKeyCoordinate* m_key_coordinate_pointer_frame[MAX_SCL_LAYOUT][MAX_KEY];
 
         IParserInfo_Provider *parser_info_provider;
         StringCollector m_string_collector;
         FileStorage m_storage;
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinKeyCoordFrameParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 42cc668..23b40f2 100644 (file)
@@ -40,21 +40,11 @@ class BinLabelPropertyParser {
     void decode_color(SclColor& color, int width);
 
     private:
-        static BinLabelPropertyParser *m_instance;
         SclLabelProperties m_label_properties_frame[MAX_SCL_LABEL_PROPERTIES][MAX_SIZE_OF_LABEL_FOR_ONE];
         int m_size;
         IParserInfo_Provider *parser_info_provider;
         FileStorage m_storage;
         StringCollector m_string_collector;
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinLabelPropertyParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 5ea20b5..abc4eb2 100644 (file)
@@ -41,22 +41,12 @@ class BinLayoutParser {
     void decode_color(SclColor&, int width);
 
     private:
-        static BinLayoutParser *m_instance;
         int m_layout_size;
         SclLayout m_layout_table[MAX_SCL_LAYOUT];
 
         FileStorage m_storage;
         IParserInfo_Provider *parser_info_provider;
         StringCollector m_string_collector;
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinLayoutParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 437d7c7..a88b9d3 100644 (file)
@@ -35,21 +35,10 @@ private:
     void parsing_magnifier_configure();
 
 private:
-    static BinMagnifierConfigParser *m_instance;
     SclMagnifierWndConfigure m_magnifier_configure;
     StringCollector m_string_collector;
     FileStorage m_storage;
     IParserInfo_Provider* parser_info_provider;
-
-private:
-    class DestructHelper {
-    public:
-        ~DestructHelper() {
-            if (BinMagnifierConfigParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index adf581c..1d2784e 100644 (file)
@@ -37,21 +37,11 @@ class BinModifierDecorationParser {
     void parsing_modifier_decoration_table();
 
     private:
-        static BinModifierDecorationParser *m_instance;
         SclModifierDecoration m_modifier_decoration_table[MAX_SCL_MODIFIER_DECORATION_NUM];
         IParserInfo_Provider *parser_info_provider;
 
         StringCollector m_string_collector;
         FileStorage m_storage;
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinModifierDecorationParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index a27d94b..e26143b 100644 (file)
@@ -35,21 +35,11 @@ class BinNinePatchFileParser {
     BinNinePatchFileParser();
     void parsing_nine_patch_file_list();
     private:
-        static BinNinePatchFileParser *m_instance;
         SclNinePatchInfo m_nine_patch_file_list[MAX_NINE_PATCH_FILE_LIST];
         int m_size;
         StringCollector m_string_collector;
         FileStorage m_storage;
         IParserInfo_Provider* parser_info_provider;
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (BinNinePatchFileParser::m_instance != NULL)
-                delete m_instance;
-        }
-    };
-    static DestructHelper des;
 };
 
 
index 4a73ba3..4f4ac68 100644 (file)
@@ -19,7 +19,6 @@
 #include "simple_debug.h"
 #include "put_record.h"
 using namespace std;
-BinInputModeConfigParser* BinInputModeConfigParser::m_instance = NULL;
 
 BinInputModeConfigParser::BinInputModeConfigParser() {
     m_inputmode_size = 0;
@@ -31,10 +30,8 @@ BinInputModeConfigParser::~BinInputModeConfigParser() {
 
 BinInputModeConfigParser*
 BinInputModeConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinInputModeConfigParser();
-    }
-    return m_instance;
+    static BinInputModeConfigParser instance;
+    return &instance;
 }
 
 void
index 6fe1519..369b413 100644 (file)
@@ -32,7 +32,6 @@ using namespace binary_xmlresource;
 
 using namespace std;
 using namespace scl;
-BinKeyCoordFrameParser* BinKeyCoordFrameParser::m_instance = NULL;
 
 BinKeyCoordFrameParser::BinKeyCoordFrameParser() {
     memset(m_key_coordinate_pointer_frame, 0x00, sizeof(SclLayoutKeyCoordinatePointer) * MAX_SCL_LAYOUT * MAX_KEY);
@@ -46,10 +45,8 @@ BinKeyCoordFrameParser::~BinKeyCoordFrameParser() {
     }
 }
 BinKeyCoordFrameParser* BinKeyCoordFrameParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinKeyCoordFrameParser();
-    }
-    return m_instance;
+    static BinKeyCoordFrameParser instance;
+    return &instance;
 }
 
 void
index 9a0a801..f862d7a 100644 (file)
@@ -18,7 +18,6 @@
 #include "label_properties_bin_parser.h"
 #include "simple_debug.h"
 #include "put_record.h"
-BinLabelPropertyParser* BinLabelPropertyParser::m_instance = NULL;
 
 BinLabelPropertyParser::BinLabelPropertyParser() {
     m_size = 0;
@@ -30,10 +29,8 @@ BinLabelPropertyParser::~BinLabelPropertyParser() {
 }
 
 BinLabelPropertyParser* BinLabelPropertyParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinLabelPropertyParser();
-    }
-    return m_instance;
+    static BinLabelPropertyParser instance;
+    return &instance;
 }
 void BinLabelPropertyParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
     m_storage.set_str_provider(parser_info_provider);
index 45ba757..4d56e28 100644 (file)
@@ -25,8 +25,6 @@
 using namespace std;
 using namespace scl;
 
-BinLayoutParser* BinLayoutParser::m_instance = NULL;
-
 BinLayoutParser::
 BinLayoutParser() {
     m_layout_size = 0;
@@ -37,10 +35,8 @@ BinLayoutParser::
 }
 BinLayoutParser* BinLayoutParser::
 get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinLayoutParser();
-    }
-    return m_instance;
+    static BinLayoutParser instance;
+    return &instance;
 }
 void BinLayoutParser::
 init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
index 75d1a57..0fdf352 100644 (file)
@@ -20,7 +20,6 @@
 #include <assert.h>
 using namespace std;
 #include "put_record.h"
-BinMagnifierConfigParser* BinMagnifierConfigParser::m_instance = NULL;
 
 BinMagnifierConfigParser::BinMagnifierConfigParser() {
     memset((void*)&m_magnifier_configure, 0x00, sizeof(SclMagnifierWndConfigure));
@@ -30,10 +29,8 @@ BinMagnifierConfigParser::~BinMagnifierConfigParser() {
 }
 
 BinMagnifierConfigParser* BinMagnifierConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinMagnifierConfigParser();
-    }
-    return m_instance;
+    static BinMagnifierConfigParser instance;
+    return &instance;
 }
 
 void BinMagnifierConfigParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
index 40265a3..09d7ae5 100644 (file)
@@ -19,8 +19,6 @@
 #include <memory.h>
 #include "put_record.h"
 
-BinModifierDecorationParser* BinModifierDecorationParser::m_instance = NULL;
-
 BinModifierDecorationParser::BinModifierDecorationParser() {
     memset(m_modifier_decoration_table, 0x00, sizeof(SclModifierDecoration) * MAX_SCL_MODIFIER_DECORATION_NUM);
 }
@@ -30,10 +28,8 @@ BinModifierDecorationParser::~BinModifierDecorationParser() {
 
 BinModifierDecorationParser*
 BinModifierDecorationParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinModifierDecorationParser();
-    }
-    return m_instance;
+    static BinModifierDecorationParser instance;
+    return &instance;
 }
 void
 BinModifierDecorationParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
index e039c7a..273af59 100644 (file)
@@ -19,7 +19,6 @@
 #include <memory.h>
 #include <assert.h>
 #include "put_record.h"
-BinNinePatchFileParser* BinNinePatchFileParser::m_instance = NULL;
 
 BinNinePatchFileParser::BinNinePatchFileParser() {
     m_size = 0;
@@ -30,10 +29,8 @@ BinNinePatchFileParser::~BinNinePatchFileParser() {
     m_size = 0;
 }
 BinNinePatchFileParser* BinNinePatchFileParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new BinNinePatchFileParser();
-    }
-    return m_instance;
+    static BinNinePatchFileParser instance;
+    return &instance;
 }
 void BinNinePatchFileParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* parser_info_provider) {
     m_storage.set_str_provider(parser_info_provider);
index 7173d92..74c3cbf 100644 (file)
@@ -23,8 +23,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-SclLog* SclLog::m_instance = NULL;
-
 SclLog::SclLog() : m_flog(NULL) {
     char *env = NULL;
     char *scllog = NULL;
@@ -58,11 +56,8 @@ SclLog::~SclLog() {
 
 SclLog*
 SclLog::get_instance() {
-    if(m_instance == NULL) {
-        m_instance = new SclLog();
-    }
-
-    return m_instance;
+    static SclLog instance;
+    return &instance;
 }
 
 void
index 0fd3a24..b75d6de 100644 (file)
@@ -34,7 +34,6 @@ class SclLog {
         ~SclLog();
     private:
         SclLog();
-        static SclLog* m_instance;
 
         FILE *m_flog;
 };
index 78c2b06..76887ac 100644 (file)
@@ -49,12 +49,12 @@ Eina_Bool client_message_cb(void *data, int type, void *event);
 CSCLEventsImplEfl::CSCLEventsImplEfl()
 {
     SCL_DEBUG();
-    /* Initializes all window resources */
-    m_mouse_down_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, mouse_press, NULL);
-    m_mouse_move_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, mouse_move, NULL);
-    m_mouse_up_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, mouse_release, NULL);
 
-    m_xclient_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, client_message_cb, NULL);
+    m_mouse_down_handler = NULL;
+    m_mouse_move_handler = NULL;
+    m_mouse_up_handler = NULL;
+
+    m_xclient_msg_handler = NULL;
 }
 
 /**
@@ -64,10 +64,29 @@ CSCLEventsImplEfl::~CSCLEventsImplEfl()
 {
     SCL_DEBUG();
 
+    fini();
+}
+
+void CSCLEventsImplEfl::init()
+{
+    /* Initializes all window resources */
+    m_mouse_down_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, mouse_press, NULL);
+    m_mouse_move_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, mouse_move, NULL);
+    m_mouse_up_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, mouse_release, NULL);
+
+    m_xclient_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, client_message_cb, NULL);
+}
+
+void CSCLEventsImplEfl::fini()
+{
     if (m_mouse_down_handler) ecore_event_handler_del(m_mouse_down_handler);
+    m_mouse_down_handler = NULL;
     if (m_mouse_move_handler) ecore_event_handler_del(m_mouse_move_handler);
+    m_mouse_move_handler = NULL;
     if (m_mouse_up_handler) ecore_event_handler_del(m_mouse_up_handler);
+    m_mouse_up_handler = NULL;
     if (m_xclient_msg_handler) ecore_event_handler_del(m_xclient_msg_handler);
+    m_xclient_msg_handler = NULL;
 }
 
 sclboolean get_window_rect(const sclwindow window, SclRectangle *rect)
index 272b225..5447fcc 100644 (file)
@@ -32,6 +32,9 @@ public :
     CSCLEventsImplEfl();
     ~CSCLEventsImplEfl();
 
+    void init();
+    void fini();
+
     /* Implementation about interface functions */
     void connect_window_events(const sclwindow wnd, const sclint evt);
     void create_timer(const scl16 id, const scl32 interval, scl16 value, sclboolean addToMap);
index 4b41cf7..c2acdcf 100644 (file)
@@ -71,6 +71,16 @@ CSCLGraphicsImplEfl::~CSCLGraphicsImplEfl()
     SCL_DEBUG();
 }
 
+void CSCLGraphicsImplEfl::init()
+{
+
+}
+
+void CSCLGraphicsImplEfl::fini()
+{
+
+}
+
 Evas_Object* extract_partimage_from_fullimage(
     Evas_Object* fullimage,
     int img_x,int img_y,
index 8c8557a..eb80925 100644 (file)
@@ -79,6 +79,9 @@ public :
     CSCLGraphicsImplEfl();
     ~CSCLGraphicsImplEfl();
 
+    void init();
+    void fini();
+
     void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
                     sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
                     sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image);
index 7ad1478..3a47fea 100644 (file)
@@ -73,6 +73,15 @@ CSCLWindowsImplEfl::~CSCLWindowsImplEfl()
     SCL_DEBUG();
 }
 
+void CSCLWindowsImplEfl::init()
+{
+
+}
+
+void CSCLWindowsImplEfl::fini()
+{
+
+}
 
 /**
  * Create a content window and binds it into given parent window as a child
index 2fbd0c9..1af8be2 100644 (file)
@@ -46,6 +46,9 @@ public :
     CSCLWindowsImplEfl();
     ~CSCLWindowsImplEfl();
 
+    void init();
+    void fini();
+
     sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height);
     sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height);
     sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height);
index 8c2b65f..dd0a07c 100644 (file)
@@ -36,7 +36,6 @@ namespace scl
 class CSCLActionState
 {
 private:
-    static CSCLActionState* m_instance; /* For singleton */
     CSCLActionState();
 public:
     ~CSCLActionState();
index 8b5fc25..498fdeb 100644 (file)
@@ -85,7 +85,6 @@ typedef std::map<MagnifierCustomLabelIdx, std::string, MagnifierCustomLabelIdxCo
 class CSCLContext
 {
 private:
-    static CSCLContext* m_instance; /* For singleton */
     CSCLContext();
 public:
     ~CSCLContext();
index 2b44994..ddc7b8e 100644 (file)
@@ -52,7 +52,6 @@ enum SclInternalSignal {
 class CSCLController
 {
 private:
-    static CSCLController* m_instance; /* For singleton */
     CSCLController();
 public:
     ~CSCLController();
index 32a99cf..ffef76b 100644 (file)
@@ -35,9 +35,6 @@ namespace scl
  */
 class CSCLErrorAdjustment
 {
-private:
-    static CSCLErrorAdjustment* m_instance; /* For singleton */
-
 public:
     CSCLErrorAdjustment();
     CSCLErrorAdjustment(sclwindow parent);
index 5149099..ce35e79 100644 (file)
@@ -34,7 +34,6 @@ namespace scl
 class CSCLEventHandler : public ISCLUIEventCallback
 {
 private:
-    static CSCLEventHandler* m_instance; /* For singleton */
     CSCLEventHandler();
 public:
     ~CSCLEventHandler();
index 0f8cea8..c945fe8 100644 (file)
@@ -54,6 +54,9 @@ typedef enum _SCLMouseEvent {
 class CSCLEventsImpl
 {
 public :
+    virtual void init() = 0;
+    virtual void fini() = 0;
+
     virtual void connect_window_events(const sclwindow wnd, const sclint evt) = 0;
     virtual void create_timer(const scl16 id, const scl32 interval, scl16 value, sclboolean addToMap) = 0;
     virtual void destroy_timer(const scl32 id) = 0;
@@ -68,9 +71,11 @@ public :
     CSCLEvents();
     ~CSCLEvents();
 
-    static CSCLEvents* m_instance; /* For singleton */
     static CSCLEvents* get_instance();
 
+    void init();
+    void fini();
+
     void connect_window_events(sclwindow wnd, const sclint evt);
 
     void create_timer(const scl16 id, const scl32 interval, scl16 value, sclboolean addToMap = TRUE) {
index e6ee7a3..276e530 100644 (file)
@@ -37,9 +37,6 @@ namespace scl
  */
 class CSCLFeedback
 {
-private:
-    static CSCLFeedback* m_instance; /* For singleton */
-
 public:
     CSCLFeedback();
     CSCLFeedback(sclwindow parent);
index 100c941..34784bd 100644 (file)
@@ -25,7 +25,6 @@ namespace scl
 class CSCLFontProxy
 {
 private:
-    static CSCLFontProxy* m_instance; /* For singleton */
     CSCLFontProxy();
 public :
     ~CSCLFontProxy();
index ef40d8e..c29c191 100644 (file)
@@ -66,6 +66,9 @@ const SclColor SCLCOLOR_BLUE = {0, 0, 255};
  */
 class CSCLGraphicsImpl
 {
+    virtual void init() = 0;
+    virtual void fini() = 0;
+
     friend class CSCLGraphics;
 private:
     virtual void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path,
@@ -96,13 +99,15 @@ class CSCLGraphics
     friend class CSCLFontProxy;
 
 private:
-    static CSCLGraphics* m_instance; /* For singleton */
     CSCLGraphics();
 public :
     ~CSCLGraphics();
 
     static CSCLGraphics* get_instance();
 
+    void init();
+    void fini();
+
     void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y,
                     sclint dest_width = -1, sclint dest_height = -1, sclint src_x = 0, sclint src_y = 0, sclint src_width = -1, sclint src_height = -1, sclboolean extrace_image = FALSE) {
         get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image);
index 14e0de3..e946eba 100644 (file)
@@ -43,7 +43,6 @@ namespace scl
 class CSCLGwes
 {
 private:
-    static CSCLGwes* m_instance; /* For singleton */
     CSCLGwes();
 public :
     ~CSCLGwes();
@@ -54,6 +53,7 @@ private:
 
 public:
     void init(sclwindow parent, scl16 width, scl16 height);
+    void fini();
 
     CSCLGraphics *m_graphics;
     CSCLWindows *m_windows;
index d45aee7..aa93bb3 100644 (file)
@@ -23,7 +23,6 @@ namespace scl
 class CSCLImageProxy
 {
 private:
-       static CSCLImageProxy* m_instance; /* For singleton */
        CSCLImageProxy();
 public :
     ~CSCLImageProxy();
index 198806d..43acceb 100644 (file)
@@ -42,7 +42,6 @@ typedef struct _SclButtonContext {
 class CSCLResourceCache
 {
 private:
-    static CSCLResourceCache* m_instance; /* For singleton */
     CSCLResourceCache();
 
 public:
index 011c562..3ff6169 100644 (file)
@@ -43,7 +43,7 @@ public:
     ~CSCLUI();
 
     /*
-     * @brief This API initializes SCL library and creates new SCL context
+     * @brief This API initializes SCL library
      * @param[in] main_window a pointer to main window object
      * @param[in] parser_type decides which parser should be selected for parsing SCL UI resource file
      * @param[in] entry_filepath a file path to SCL's UI resource entry file
@@ -51,6 +51,11 @@ public:
      */
     sclboolean init(sclwindow main_window, SCLParserType parser_type, const sclchar *entry_filepath);
 
+    /*
+     * @brief This API deinitializes SCL library
+     */
+    void fini();
+
     /**
      * @brief This API requests SCL library to show the S/W keyboard on the screen
      * @param[in] auto_relocate Indicates whether the SCL library should relocate the keyboard window automatically
index b488baa..5c74587 100644 (file)
@@ -39,7 +39,6 @@ class CSCLUIBuilder
     friend class CSCLFontProxy;
 
 private:
-    static CSCLUIBuilder* m_instance; /* For singleton */
     CSCLUIBuilder();
 public:
     ~CSCLUIBuilder();
index ea1dbc6..18f9717 100644 (file)
@@ -35,7 +35,6 @@ namespace scl
 class CSCLUIImpl
 {
 private:
-    static CSCLUIImpl* m_instance; /* For singleton */
     CSCLUIImpl();
 
 public:
@@ -43,6 +42,7 @@ public:
     static CSCLUIImpl* get_instance();
 
     sclboolean init(sclwindow parent, SCLParserType parser_type, const char *entry_filepath);
+    void fini();
 
     void show();
     void hide();
index e5036a2..54c7241 100644 (file)
@@ -48,6 +48,9 @@ namespace scl
 class CSCLUtilsImpl
 {
 public :
+    virtual void init() = 0;
+    virtual void fini() = 0;
+
     virtual sclboolean get_screen_resolution(sclint *x, sclint *y) = 0;
     virtual sclboolean play_tts(const sclchar *str) = 0;
     virtual sclboolean play_sound(const sclchar* snd_style) = 0;
@@ -62,6 +65,9 @@ public :
 class CSCLUtilsImplLinux : public CSCLUtilsImpl
 {
 public :
+    void init();
+    void fini();
+
     sclboolean get_screen_resolution(sclint *x, sclint *y);
     sclboolean play_tts(const sclchar *str);
     sclboolean play_sound(const sclchar* snd_style);
@@ -76,6 +82,9 @@ public :
 class CSCLUtilsImplWin32 : public CSCLUtilsImpl
 {
 public :
+    void init();
+    void fini();
+
     sclboolean get_screen_resolution(sclint *x, sclint *y);
     sclboolean play_tts(const sclchar *str);
     sclboolean play_sound(const sclchar* snd_style);
@@ -93,13 +102,52 @@ public :
     _CSCLUtils() {
         m_impl = 0;
     }
-    virtual sclboolean get_screen_resolution(sclint *x, sclint *y) = 0;
-    virtual sclboolean play_tts(const sclchar *str) = 0;
-    virtual sclboolean play_sound(const sclchar* snd_style) = 0;
-    virtual sclboolean play_vibration(const sclchar* vibe_style, const scllong duration) = 0;
 
-    virtual sclboolean open_devices() = 0;
-    virtual sclboolean close_devices() = 0;
+    virtual void init() {
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            impl->init();
+        }
+    }
+    virtual void fini() {
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            impl->fini();
+        }
+    }
+
+    virtual sclboolean get_screen_resolution(sclint *x, sclint *y) {
+        sclboolean ret = FALSE;
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            ret = impl->get_screen_resolution(x, y);
+        }
+        return ret;
+    }
+    virtual sclboolean play_tts(const sclchar *str) {
+        sclboolean ret = FALSE;
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            ret = impl->play_tts(str);
+        }
+        return ret;
+    }
+    virtual sclboolean play_sound(const sclchar* snd_style) {
+        sclboolean ret = FALSE;
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            ret = impl->play_sound(snd_style);
+        }
+        return ret;
+    }
+    virtual sclboolean play_vibration(const sclchar* vibe_style, const scllong duration) {
+        sclboolean ret = FALSE;
+        CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+        if (impl) {
+            ret = impl->play_vibration(vibe_style, duration);
+        }
+        return ret;
+    }
 
 protected :
     CSCLUtilsImpl* GetCSCLUtilsImpl() {
@@ -120,7 +168,6 @@ private :
 class CSCLUtils : public _CSCLUtils
 {
 private:
-    static CSCLUtils* m_instance; /* For singleton */
     CSCLUtils();
 public :
     ~CSCLUtils();
@@ -128,6 +175,7 @@ public :
     static CSCLUtils* get_instance();
 
     void init();
+    void fini();
 
     void scale_x(scl16 *x);
     void scale_y(scl16 *y);
@@ -145,29 +193,6 @@ public :
 
     sclchar* get_str_dup(const sclchar* str);
 
-    sclboolean get_screen_resolution(sclint *x, sclint *y) {
-        return GetCSCLUtilsImpl()->get_screen_resolution(x, y);
-    }
-
-    sclboolean play_tts(const sclchar* str) {
-        return GetCSCLUtilsImpl()->play_tts(str);
-    }
-
-    sclboolean play_sound(const sclchar* snd_style) {
-        return GetCSCLUtilsImpl()->play_sound(snd_style);
-    }
-
-    sclboolean play_vibration(const sclchar* vibe_style, const scllong duration) {
-        return GetCSCLUtilsImpl()->play_vibration(vibe_style, duration);
-    }
-
-    sclboolean open_devices() {
-        return GetCSCLUtilsImpl()->open_devices();
-    }
-    sclboolean close_devices() {
-        return GetCSCLUtilsImpl()->close_devices();
-    }
-
     sclboolean sleep(sclulong msc);
 
     sclchar* get_composed_path(sclchar* buf, const sclchar* prefix, const sclchar* path);
index e2ebfb0..f474e60 100644 (file)
@@ -69,6 +69,9 @@ typedef struct _SclWindowContext {
 class CSCLWindowsImpl
 {
 public :
+    virtual void init() = 0;
+    virtual void fini() = 0;
+
     virtual sclwindow create_base_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0;
     virtual sclwindow create_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0;
     virtual sclwindow create_magnifier_window(const sclwindow parent, SclWindowContext *winctx, scl16 width, scl16 height) = 0;
@@ -90,13 +93,15 @@ public :
 class CSCLWindows
 {
 private:
-    static CSCLWindows* m_instance; /* For singleton */
     CSCLWindows();
 public :
     ~CSCLWindows();
 
     static CSCLWindows* get_instance();
 
+    void init();
+    void fini();
+
     sclwindow open_popup(const SclWindowOpener opener, const SclRectangle& geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x = 0, sclint img_offset_y = 0, sclint timeout = 0);
     bool close_popup(sclwindow window);
     bool close_all_popups(sclwindow skip_window = SCLWINDOW_INVALID);
index a1d8868..e8621ed 100644 (file)
@@ -21,8 +21,6 @@
 
 using namespace scl;
 
-CSCLActionState* CSCLActionState::m_instance = NULL; /* For singleton */
-
 CSCLActionState::CSCLActionState()
 {
     SCL_DEBUG();
@@ -38,10 +36,8 @@ CSCLActionState::~CSCLActionState()
 CSCLActionState*
 CSCLActionState::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLActionState();
-    }
-    return (CSCLActionState*)m_instance;
+    static CSCLActionState instance;
+    return &instance;
 }
 
 
index 85c151f..b289183 100644 (file)
@@ -30,8 +30,6 @@
 
 using namespace scl;
 
-CSCLContext* CSCLContext::m_instance = NULL; /* For singleton */
-
 CSCLContext::CSCLContext()
 {
     SCL_DEBUG();
@@ -47,10 +45,8 @@ CSCLContext::~CSCLContext()
 CSCLContext*
 CSCLContext::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLContext();
-    }
-    return (CSCLContext*)m_instance;
+    static CSCLContext instance;
+    return &instance;
 }
 
 void
index 9aa3414..27f9b83 100644 (file)
@@ -75,9 +75,6 @@ _play_tts_for_layout_autopopup_name() {
     return TRUE;
 }
 
-CSCLController* CSCLController::m_instance = NULL; /* For singleton */
-
-
 CSCLController::CSCLController()
 {
     SCL_DEBUG();
@@ -105,10 +102,8 @@ CSCLController::~CSCLController()
 CSCLController*
 CSCLController::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLController();
-    }
-    return (CSCLController*)m_instance;
+    static CSCLController instance;
+    return &instance;
 }
 
 void
index 3f4ed2e..7e68e3c 100644 (file)
 #define TWO                            2
 
 using namespace scl;
-CSCLErrorAdjustment* CSCLErrorAdjustment::m_instance = NULL; /* For singleton */
 
 CSCLErrorAdjustment* CSCLErrorAdjustment::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLErrorAdjustment();
-    }
-    return (CSCLErrorAdjustment*)m_instance;
+    static CSCLErrorAdjustment instance;
+    return &instance;
 }
 
 CSCLErrorAdjustment::CSCLErrorAdjustment()
index c9d47d2..ef17a15 100644 (file)
@@ -23,8 +23,6 @@
 
 using namespace scl;
 
-CSCLEventHandler* CSCLEventHandler::m_instance = NULL; /* For singleton */
-
 CSCLEventHandler::CSCLEventHandler()
 {
     SCL_DEBUG();
@@ -41,10 +39,8 @@ CSCLEventHandler::~CSCLEventHandler()
 CSCLEventHandler*
 CSCLEventHandler::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLEventHandler();
-    }
-    return (CSCLEventHandler*)m_instance;
+    static CSCLEventHandler instance;
+    return &instance;
 }
 
 static void handle_shift_button_click_event(SclUIEventDesc ui_event_desc)
index 3d71a69..b03e6c8 100644 (file)
@@ -28,8 +28,6 @@
 
 using namespace scl;
 
-CSCLEvents* CSCLEvents::m_instance = NULL; /* For singleton */
-
 CSCLEvents::CSCLEvents()
 {
     SCL_DEBUG();
@@ -40,6 +38,29 @@ CSCLEvents::CSCLEvents()
 CSCLEvents::~CSCLEvents()
 {
     SCL_DEBUG();
+
+    fini();
+
+    if (m_impl) {
+        delete m_impl;
+        m_impl = NULL;
+    }
+}
+
+void CSCLEvents::init()
+{
+    CSCLEventsImpl *impl = get_scl_events_impl();
+    if (impl) {
+        impl->init();
+    }
+}
+
+void CSCLEvents::fini()
+{
+    CSCLEventsImpl *impl = get_scl_events_impl();
+    if (impl) {
+        impl->fini();
+    }
 }
 
 CSCLEventsImpl* CSCLEvents::get_scl_events_impl()
@@ -59,10 +80,8 @@ CSCLEventsImpl* CSCLEvents::get_scl_events_impl()
 
 CSCLEvents* CSCLEvents::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLEvents();
-    }
-    return (CSCLEvents*)m_instance;
+    static CSCLEvents instance;
+    return &instance;
 }
 
 void
index db7cb30..ae4f857 100644 (file)
 #include "sclcontext.h"
 
 using namespace scl;
-CSCLFeedback* CSCLFeedback::m_instance = NULL; /* For singleton */
 
 CSCLFeedback* CSCLFeedback::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLFeedback();
-    }
-    return (CSCLFeedback*)m_instance;
+    static CSCLFeedback instance;
+    return &instance;
 }
 
 CSCLFeedback::CSCLFeedback()
index a8c67e0..581401d 100644 (file)
@@ -21,8 +21,6 @@
 
 using namespace scl;
 
-CSCLFontProxy* CSCLFontProxy::m_instance = NULL; /* For singleton */
-
 /**
 * Constructor
 */
@@ -50,10 +48,8 @@ CSCLFontProxy::~CSCLFontProxy()
 
 CSCLFontProxy* CSCLFontProxy::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLFontProxy();
-    }
-    return (CSCLFontProxy*)m_instance;
+    static CSCLFontProxy instance;
+    return &instance;
 }
 
 sclfont
index f506603..048f973 100644 (file)
 
 using namespace scl;
 
-CSCLGraphics* CSCLGraphics::m_instance = NULL; /* For singleton */
-
 CSCLGraphics::CSCLGraphics()
 {
     SCL_DEBUG();
-    m_impl = 0;
+    m_impl = NULL;
 }
 
 CSCLGraphics::~CSCLGraphics()
 {
     SCL_DEBUG();
+
+    fini();
+
+    if (m_impl) {
+        delete m_impl;
+        m_impl = NULL;
+    }
+}
+
+void CSCLGraphics::init()
+{
+    CSCLGraphicsImpl *impl = get_scl_graphics_impl();
+    if (impl) {
+        impl->init();
+    }
+}
+
+void CSCLGraphics::fini()
+{
+    CSCLGraphicsImpl *impl = get_scl_graphics_impl();
+    if (impl) {
+        impl->fini();
+    }
 }
 
 CSCLGraphicsImpl* CSCLGraphics::get_scl_graphics_impl()
@@ -63,9 +84,7 @@ CSCLGraphicsImpl* CSCLGraphics::get_scl_graphics_impl()
 
 CSCLGraphics* CSCLGraphics::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLGraphics();
-    }
-    return (CSCLGraphics*)m_instance;
+    static CSCLGraphics instance;
+    return &instance;
 }
 
index 0df8178..b10503d 100644 (file)
 
 using namespace scl;
 
-CSCLGwes* CSCLGwes::m_instance = NULL; /* For singleton */
-
 CSCLGwes::CSCLGwes()
 {
     SCL_DEBUG();
+
     m_windows = NULL;
     m_graphics = NULL;
     m_events = NULL;
@@ -33,27 +32,53 @@ CSCLGwes::CSCLGwes()
 CSCLGwes::~CSCLGwes()
 {
     SCL_DEBUG();
-    if (m_windows) delete(m_windows);
-    if (m_graphics) delete(m_graphics);
-    if (m_events) delete(m_events);
+
+    fini();
 }
 
 void CSCLGwes::init(sclwindow parent, scl16 width, scl16 height)
 {
     SCL_DEBUG();
+
     if (m_windows == NULL) m_windows = CSCLWindows::get_instance();
     if (m_graphics == NULL) m_graphics = CSCLGraphics::get_instance();
     if (m_events == NULL) m_events = CSCLEvents::get_instance();
 
+    if (m_windows) {
+        m_windows->init();
+    }
+    if (m_graphics) {
+        m_graphics->init();
+    }
+    if (m_events) {
+        m_events->init();
+    }
+
     sclwindow wnd = m_windows->create_base_window(parent, width, height);
     m_events->connect_window_events(wnd, SCL_EVENT_MOUSE | SCL_EVENT_EXPOSE);
 }
 
-CSCLGwes* CSCLGwes::get_instance()
+void CSCLGwes::fini()
 {
-    if (!m_instance) {
-        m_instance = new CSCLGwes();
+    SCL_DEBUG();
+
+    if (m_windows) {
+        m_windows->fini();
+        m_windows = NULL;
+    }
+    if (m_graphics) {
+        m_graphics->fini();
+        m_graphics = NULL;
+    }
+    if (m_events) {
+        m_events->fini();
+        m_events = NULL;
     }
-    return (CSCLGwes*)m_instance;
+}
+
+CSCLGwes* CSCLGwes::get_instance()
+{
+    static CSCLGwes instance;
+    return &instance;
 }
 
index e949c03..1d2c161 100644 (file)
@@ -21,8 +21,6 @@
 
 using namespace scl;
 
-CSCLImageProxy* CSCLImageProxy::m_instance = NULL; /* For singleton */
-
 /**
 * Constructor
 */
@@ -47,10 +45,8 @@ CSCLImageProxy::~CSCLImageProxy()
 
 CSCLImageProxy* CSCLImageProxy::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLImageProxy();
-    }
-    return (CSCLImageProxy*)m_instance;
+    static CSCLImageProxy instance;
+    return &instance;
 }
 
 sclimage
index 435fd49..d980cd0 100644 (file)
@@ -28,8 +28,6 @@
 #include <assert.h>
 using namespace scl;
 
-CSCLResourceCache* CSCLResourceCache::m_instance = NULL; /* For singleton */
-
 CSCLResourceCache::CSCLResourceCache()
 {
     SCL_DEBUG();
@@ -45,10 +43,8 @@ CSCLResourceCache::~CSCLResourceCache()
 CSCLResourceCache*
 CSCLResourceCache::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLResourceCache();
-    }
-    return (CSCLResourceCache*)m_instance;
+    static CSCLResourceCache instance;
+    return &instance;
 }
 
 
@@ -992,10 +988,6 @@ CSCLResourceCache::recompute_layout(sclwindow window)
                             (*pCurLayoutKeyCoordinate)[loop].extract_offset_y *= utils->get_custom_scale_rate_y();
                             (*pCurLayoutKeyCoordinate)[loop].magnifier_offset_x *= utils->get_custom_scale_rate_x();
                             (*pCurLayoutKeyCoordinate)[loop].magnifier_offset_y *= utils->get_custom_scale_rate_y();
-
-                            utils->log("CUSTOM_SCALED_GEOMETRY : %d %d %d %d",
-                                (*pCurLayoutKeyCoordinate)[loop].x, (*pCurLayoutKeyCoordinate)[loop].y,
-                                (*pCurLayoutKeyCoordinate)[loop].width, (*pCurLayoutKeyCoordinate)[loop].height);
                         }
                     }
                 }
index 63aca4c..15e4bf8 100644 (file)
@@ -27,7 +27,7 @@ CSCLUI::CSCLUI()
 
 CSCLUI::~CSCLUI()
 {
-    delete m_impl;
+    m_impl = NULL;
 }
 
 sclboolean CSCLUI::init(sclwindow parent, const SCLParserType parser_type, const char *entry_filepath)
@@ -39,6 +39,14 @@ sclboolean CSCLUI::init(sclwindow parent, const SCLParserType parser_type, const
     return ret;
 }
 
+void
+CSCLUI::fini()
+{
+    if (m_impl) {
+        m_impl->fini();
+    }
+}
+
 /**
  * Shows the SCL main window
  * For displaying the SCL UI, you should explicitly call this function after CSCLUI class is created
index 20d6840..3c9c4de 100644 (file)
@@ -34,8 +34,6 @@ using namespace scl;
 
 //extern sclboolean g_key_spacing_off;
 
-CSCLUIBuilder* CSCLUIBuilder::m_instance = NULL; /* For singleton */
-
 CSCLUIBuilder::CSCLUIBuilder()
 {
     SCL_DEBUG();
@@ -47,19 +45,15 @@ CSCLUIBuilder::CSCLUIBuilder()
 CSCLUIBuilder::~CSCLUIBuilder()
 {
     SCL_DEBUG();
-    if (m_gwes) delete m_gwes;
     m_gwes = NULL;
-    if (m_utils) delete m_utils;
     m_utils = NULL;
 }
 
 CSCLUIBuilder*
 CSCLUIBuilder::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLUIBuilder();
-    }
-    return (CSCLUIBuilder*)m_instance;
+    static CSCLUIBuilder instance;
+    return &instance;
 }
 
 void
index 56f16dd..c9a80a1 100644 (file)
@@ -29,8 +29,6 @@
 
 using namespace scl;
 
-CSCLUIImpl* CSCLUIImpl::m_instance = NULL; /* For singleton */
-
 CSCLUIImpl::CSCLUIImpl()
 {
     SCL_DEBUG();
@@ -56,10 +54,8 @@ CSCLUIImpl::~CSCLUIImpl()
 CSCLUIImpl*
 CSCLUIImpl::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLUIImpl();
-    }
-    return (CSCLUIImpl*)m_instance;
+    static CSCLUIImpl instance;
+    return &instance;
 }
 
 sclboolean CSCLUIImpl::init(sclwindow parent, const SCLParserType parser_type, const char *entry_filepath)
@@ -72,6 +68,7 @@ sclboolean CSCLUIImpl::init(sclwindow parent, const SCLParserType parser_type, c
     CSCLUIBuilder *builder = CSCLUIBuilder::get_instance();
     CSCLResourceCache *cache = CSCLResourceCache::get_instance();
     CSCLUtils *utils = CSCLUtils::get_instance();
+    CSCLGwes *gwes = CSCLGwes::get_instance();
 
     if (sclres_manager && builder && cache && utils) {
         sclres_manager->init(parser_type, entry_filepath);
@@ -93,6 +90,20 @@ sclboolean CSCLUIImpl::init(sclwindow parent, const SCLParserType parser_type, c
     return TRUE;
 }
 
+void
+CSCLUIImpl::fini()
+{
+    CSCLUtils *utils = CSCLUtils::get_instance();
+    if (utils) {
+        utils->fini();
+    }
+
+    CSCLGwes *gwes = CSCLGwes::get_instance();
+    if (gwes) {
+        gwes->fini();
+    }
+}
+
 /**
  * Shows the SCL main window
  * For displaying the SCL UI, you should explicitly call this function after CSCLUIImpl class is created
index 1baf051..1ace1ba 100644 (file)
@@ -31,8 +31,6 @@
 
 using namespace scl;
 
-CSCLUtils* CSCLUtils::m_instance = NULL; /* For singleton */
-
 #define SCL_MAX_UNIQUE_ID 1000
 
 CSCLUtils::CSCLUtils()
@@ -44,28 +42,32 @@ CSCLUtils::CSCLUtils()
     m_custom_scale_rate_y = 1.0f;
     m_scn_resolution_x = 0;
     m_scn_resolution_y = 0;
-    open_devices();
 }
 
 CSCLUtils::~CSCLUtils()
 {
     SCL_DEBUG();
-    close_devices();
+
+    /* To make sure everything's cleaned up */
+    fini();
 }
 
 CSCLUtils* CSCLUtils::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLUtils();
-    }
-    return (CSCLUtils*)m_instance;
+    static CSCLUtils instance;
+    return &instance;
 }
 
 void
 CSCLUtils::init()
 {
     SCL_DEBUG();
-    
+
+    CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+    if (impl) {
+        impl->init();
+    }
+
     SclResParserManager *sclres_manager = SclResParserManager::get_instance();
     PSclDefaultConfigure default_configure = NULL;
     if (sclres_manager) {
@@ -93,6 +95,16 @@ CSCLUtils::init()
     m_nine_patch_info_map.clear();
 }
 
+void CSCLUtils::fini()
+{
+    SCL_DEBUG();
+
+    CSCLUtilsImpl *impl = GetCSCLUtilsImpl();
+    if (impl) {
+        impl->fini();
+    }
+}
+
 /**
  * Returns a scale rate (see default screen resolution in sclconfig.h file)
  */
index 44e9c39..700d6c9 100644 (file)
@@ -32,8 +32,6 @@
 
 using namespace scl;
 
-CSCLWindows* CSCLWindows::m_instance = NULL; /* For singleton */
-
 CSCLWindows::CSCLWindows()
 {
     SCL_DEBUG();
@@ -57,26 +55,54 @@ CSCLWindows::CSCLWindows()
 CSCLWindows::~CSCLWindows()
 {
     SCL_DEBUG();
-    if (SCLWINDOW_INVALID != m_base_winctx.window) {
-        get_scl_windows_impl()->destroy_window(m_base_winctx.window);
-    }
 
-    if (SCLWINDOW_INVALID != m_magnifier_winctx.window) {
-        get_scl_windows_impl()->destroy_window(m_magnifier_winctx.window);
+    fini();
+
+    if (m_impl) {
+        delete m_impl;
+        m_impl = NULL;
     }
+}
 
-    if (SCLWINDOW_INVALID != m_dim_winctx.window) {
-        get_scl_windows_impl()->destroy_window(m_dim_winctx.window);
+void CSCLWindows::init()
+{
+    CSCLWindowsImpl *impl = get_scl_windows_impl();
+    if (impl) {
+        impl->init();
     }
+}
+
+void CSCLWindows::fini()
+{
+    CSCLWindowsImpl* impl = get_scl_windows_impl();
+
+    if (impl) {
+        impl->fini();
+
+        if (SCLWINDOW_INVALID != m_base_winctx.window) {
+            impl->destroy_window(m_base_winctx.window);
+            m_base_winctx.window = SCLWINDOW_INVALID;
+        }
 
-    for (int loop = 0;loop < MAX_POPUP_WINDOW;loop++) {
-        if (m_popup_winctx[loop].window != SCLWINDOW_INVALID) {
-            if (!m_popup_winctx[loop].is_virtual) {
-                get_scl_windows_impl()->destroy_window(m_popup_winctx[loop].window);
+        if (SCLWINDOW_INVALID != m_magnifier_winctx.window) {
+            impl->destroy_window(m_magnifier_winctx.window);
+            m_magnifier_winctx.window = SCLWINDOW_INVALID;
+        }
+
+        if (SCLWINDOW_INVALID != m_dim_winctx.window) {
+            impl->destroy_window(m_dim_winctx.window);
+            m_dim_winctx.window = SCLWINDOW_INVALID;
+        }
+
+        for (int loop = 0;loop < MAX_POPUP_WINDOW;loop++) {
+            if (m_popup_winctx[loop].window != SCLWINDOW_INVALID) {
+                if (!m_popup_winctx[loop].is_virtual) {
+                    impl->destroy_window(m_popup_winctx[loop].window);
+                }
+                m_popup_winctx[loop].window = SCLWINDOW_INVALID;
             }
         }
     }
-
 }
 
 CSCLWindowsImpl*
@@ -97,10 +123,8 @@ CSCLWindows::get_scl_windows_impl()
 CSCLWindows*
 CSCLWindows::get_instance()
 {
-    if (!m_instance) {
-        m_instance = new CSCLWindows();
-    }
-    return (CSCLWindows*)m_instance;
+    static CSCLWindows instance;
+    return &instance;
 }
 
 sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectangle &geometry, sclshort inputmode, sclshort layout, SCLPopupType popup_type, sclboolean is_virtual, sclboolean use_dim_window, sclint img_offset_x, sclint img_offset_y, sclint timeout)
index 96be045..9b727a9 100644 (file)
@@ -27,6 +27,7 @@
 #include <feedback.h>
 #include <Elementary.h>
 #include <tts.h>
+#include <vconf.h>
 
 #include <dlog.h>
 #ifndef LOG_TAG
@@ -77,6 +78,77 @@ static Eina_Bool _get_default_zone_geometry_info (Ecore_X_Window root, scluint *
     return ret;
 }
 
+void accessibility_changed_cb(keynode_t *key, void* data)
+{
+    int r;
+    int enabled;
+    if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &enabled)) {
+        LOGD("VCONFKEY_SETAPPL_ACCESSIBILITY_TTS : %d, (%p)", enabled, tts);
+        if (enabled) {
+            if (tts == NULL) {
+                LOGD("Initializing TTS\n");
+
+                r = tts_create(&tts);
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_create FAILED : result(%d)", r);
+                } else {
+                    tts_set_mode (tts, TTS_MODE_SCREEN_READER);
+                }
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_set_mode FAILED : result(%d)", r);
+                }
+
+                tts_state_e current_state;
+                r = tts_get_state(tts, &current_state);
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_get_state FAILED : result(%d)", r);
+                }
+
+                if (TTS_STATE_CREATED == current_state)  {
+                    r = tts_prepare(tts);
+                }
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_prepare FAILED : ret(%d)\n", r);
+                }
+            }
+        } else {
+            if (tts != NULL) {
+                LOGD("Deinitializing TTS\n");
+
+                r = tts_unprepare(tts);
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_unprepare FAILED : result(%d)", r);
+                }
+
+                r = tts_destroy(tts);
+                if (TTS_ERROR_NONE != r) {
+                    LOGD("tts_destroy FAILED : result(%d)", r);
+                }
+
+                tts = NULL;
+            }
+        }
+    }
+}
+
+void
+CSCLUtilsImplLinux::init() {
+    SCL_DEBUG();
+    open_devices();
+
+    vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
+    accessibility_changed_cb(NULL, NULL);
+}
+
+void
+CSCLUtilsImplLinux::fini() {
+    SCL_DEBUG();
+
+    vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb);
+
+    close_devices();
+}
+
 /* FIXME : Currently the screen resolution is locally cached, should be updated when it gets changed */
 sclboolean
 CSCLUtilsImplLinux::get_screen_resolution(sclint *x, sclint *y) {
@@ -229,29 +301,6 @@ CSCLUtilsImplLinux::open_devices() {
         LOGD("FEEDBACK INITIALIZATION SUCCESSFUL : %d\n", r);
     }
 
-    r = tts_create(&tts);
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_create FAILED : result(%d)", r);
-    } else {
-        r = tts_set_mode (tts, TTS_MODE_SCREEN_READER);
-    }
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_set_mode FAILED : result(%d)", r);
-    }
-
-    tts_state_e current_state;
-    r = tts_get_state(tts, &current_state);
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_get_state FAILED : result(%d)", r);
-    }
-
-    if (TTS_STATE_CREATED == current_state)  {
-        r = tts_prepare(tts);
-    }
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_prepare FAILED : ret(%d)\n", r);
-    }
-
     return TRUE;
 }
 
@@ -267,15 +316,6 @@ CSCLUtilsImplLinux::close_devices() {
         LOGD("FEEDBACK DEINITIALIZATION SUCCESSFUL : %d\n", r);
     }
 
-    r = tts_unprepare(tts);
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_unprepare FAILED : result(%d)", r);
-    }
-
-    r = tts_destroy(tts);
-    if (TTS_ERROR_NONE != r) {
-        LOGD("tts_destroy FAILED : result(%d)", r);
-    }
     return TRUE;
 }
 
index 9d10650..004b7d4 100644 (file)
 
 using namespace scl;
 
+void
+CSCLUtilsImplWin32::init() {
+    SCL_DEBUG();
+    open_devices();
+}
+
+void
+CSCLUtilsImplWin32::fini() {
+    SCL_DEBUG();
+    close_devices();
+}
+
 sclboolean
 CSCLUtilsImplWin32::get_screen_resolution(sclint *x, sclint *y) {
     SCL_DEBUG();
index 9550d9f..76506ec 100644 (file)
@@ -27,19 +27,14 @@ using namespace sclres;
 
 static sclres::SclRes *_current_parser = NULL;
 
-SclResParserManager* SclResParserManager::m_instance = NULL;
 SclResParserManager::~SclResParserManager() {
-    if (_current_parser)
-        delete _current_parser;
     _current_parser = NULL;
 }
 
 SclResParserManager*
 SclResParserManager::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new SclResParserManager();
-    }
-    return m_instance;
+    static SclResParserManager instance;
+    return &instance;
 }
 
 SclResParserManager::SclResParserManager() {
index a1bc91a..ae93467 100644 (file)
@@ -55,7 +55,6 @@ class SclResParserManager{
         void destroy();
     private:
         SclResParserManager();
-        static SclResParserManager* m_instance;
 };
 
 #endif
index a405db0..4305c32 100644 (file)
@@ -301,8 +301,6 @@ class AutoPopupConfigureParserImpl {
         SclAutoPopupConfigure m_autopopup_configure;
 };
 
-AutoPopupConfigParser* AutoPopupConfigParser::m_instance = NULL;
-
 AutoPopupConfigParser::AutoPopupConfigParser() {
     m_impl = new AutoPopupConfigureParserImpl;
 }
@@ -317,10 +315,8 @@ AutoPopupConfigParser::~AutoPopupConfigParser() {
 
 AutoPopupConfigParser*
 AutoPopupConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new AutoPopupConfigParser();
-    }
-    return m_instance;
+    static AutoPopupConfigParser instance;
+    return &instance;
 }
 
 int
index f21d35c..2113b12 100644 (file)
@@ -202,14 +202,10 @@ class DefaultConfigureParserImpl {
         SclDefaultConfigure m_default_configure;
 };
 
-DefaultConfigParser* DefaultConfigParser::m_instance = NULL;
-
 DefaultConfigParser*
 DefaultConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new DefaultConfigParser();
-    }
-    return m_instance;
+    static DefaultConfigParser instance;
+    return &instance;
 }
 DefaultConfigParser::DefaultConfigParser() {
     m_impl = new DefaultConfigureParserImpl;
index 867094b..be8757d 100644 (file)
@@ -33,7 +33,6 @@ class AutoPopupConfigParser {
         static AutoPopupConfigParser *get_instance();
     private:
         AutoPopupConfigParser();
-        static AutoPopupConfigParser *m_instance;
 };
 
 
index bef3018..203ca21 100644 (file)
@@ -33,7 +33,6 @@ public:
     static DefaultConfigParser *get_instance();
 private:
     DefaultConfigParser();
-    static DefaultConfigParser *m_instance;
 };
 
 
index 0e95486..8ec0130 100644 (file)
@@ -34,6 +34,5 @@ class InputModeConfigParser {
         static InputModeConfigParser *get_instance();
     private:
         InputModeConfigParser();
-        static InputModeConfigParser *m_instance;
 };
 #endif
index d800613..3a5a032 100644 (file)
@@ -31,7 +31,6 @@ class LabelPropertyParser {
     static LabelPropertyParser *get_instance();
     private:
     LabelPropertyParser();
-    static LabelPropertyParser *m_instance;
 };
 
 
index 7435090..31e3eaf 100644 (file)
@@ -40,7 +40,6 @@ class LayoutParser {
 
     private:
     LayoutParser();
-    static LayoutParser *m_instance;
 };
 
 
index b746154..edbf61a 100644 (file)
@@ -33,7 +33,6 @@ public:
     static MagnifierConfigParser *get_instance();
 private:
     MagnifierConfigParser();
-    static MagnifierConfigParser *m_instance;
 };
 
 
index 601743f..4862cde 100644 (file)
@@ -72,7 +72,6 @@ class MainEntryParser {
     static MainEntryParser *get_instance();
     private:
     MainEntryParser();
-    static MainEntryParser *m_instance;
 };
 
 #endif
index c59e804..a6b3fdf 100644 (file)
@@ -32,7 +32,6 @@ class ModifierDecorationParser {
         static ModifierDecorationParser *get_instance();
     private:
         ModifierDecorationParser();
-        static ModifierDecorationParser *m_instance;
 };
 
 
index 3ddd5bc..4c0f40e 100644 (file)
@@ -33,7 +33,6 @@ class NinePatchFileParser {
     static NinePatchFileParser *get_instance();
     private:
     NinePatchFileParser();
-    static NinePatchFileParser *m_instance;
 };
 
 
index 28e1132..e42cbd0 100644 (file)
@@ -70,8 +70,6 @@ class XMLResource: public sclres::SclRes{
     XMLResource();
 
     private:
-    static XMLResource* m_instance;
-
     MainEntryParser *m_main_entry_parser;
     InputModeConfigParser *m_input_mode_configure_parser;
     LayoutParser *m_layout_parser;
@@ -81,19 +79,6 @@ class XMLResource: public sclres::SclRes{
     AutoPopupConfigParser *m_autopopup_configure_parser;
     MagnifierConfigParser *m_magnifier_configure_parser;
     NinePatchFileParser *m_nine_patch_file_list_parser;
-
-    private:
-    class DestructHelper {
-        public:
-        ~DestructHelper() {
-            if (XMLResource::m_instance != NULL)
-            {
-                delete m_instance;
-                m_instance = NULL;
-            }
-        }
-    };
-    static DestructHelper des;
 };
 }
 
index a47d624..bd9822c 100644 (file)
@@ -187,8 +187,6 @@ class InputModeConfigureParserImpl {
         SclInputModeConfigure m_input_mode_configure_table[MAX_SCL_INPUT_MODE];
 };
 
-InputModeConfigParser* InputModeConfigParser::m_instance = NULL;
-
 InputModeConfigParser::InputModeConfigParser() {
     m_impl = new InputModeConfigureParserImpl;
 }
@@ -203,10 +201,8 @@ InputModeConfigParser::~InputModeConfigParser() {
 
 InputModeConfigParser*
 InputModeConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new InputModeConfigParser();
-    }
-    return m_instance;
+    static InputModeConfigParser instance;
+    return &instance;
 }
 
 int
index f633313..64ceea3 100644 (file)
@@ -380,8 +380,6 @@ class LabelPropertiesParserImpl {
     int m_size;
 };
 
-LabelPropertyParser* LabelPropertyParser::m_instance = NULL;
-
 LabelPropertyParser::LabelPropertyParser() {
     m_impl = new LabelPropertiesParserImpl;
 }
@@ -396,10 +394,8 @@ LabelPropertyParser::~LabelPropertyParser() {
 
 LabelPropertyParser*
 LabelPropertyParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new LabelPropertyParser();
-    }
-    return m_instance;
+    static LabelPropertyParser instance;
+    return &instance;
 }
 
 int
index 4e08625..26077d2 100644 (file)
@@ -1426,9 +1426,6 @@ LayoutParserImpl::parsing_popup_input_mode_record_node(
     }
 }
 
-/* LayoutParser */
-LayoutParser* LayoutParser::m_instance = NULL;
-
 LayoutParser::LayoutParser() {
     m_impl = new LayoutParserImpl;
 }
@@ -1440,10 +1437,8 @@ LayoutParser::~LayoutParser() {
 
 LayoutParser*
 LayoutParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new LayoutParser();
-    }
-    return m_instance;
+    static LayoutParser instance;
+    return &instance;
 }
 
 int
index df97616..e969d81 100644 (file)
@@ -199,8 +199,6 @@ class MagnifierConfigureParserImpl {
     SclMagnifierWndConfigure m_magnifier_configure;
 };
 
-MagnifierConfigParser* MagnifierConfigParser::m_instance = NULL;
-
 MagnifierConfigParser::MagnifierConfigParser() {
     m_impl = new MagnifierConfigureParserImpl;
 }
@@ -215,10 +213,8 @@ MagnifierConfigParser::~MagnifierConfigParser() {
 
 MagnifierConfigParser*
 MagnifierConfigParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new MagnifierConfigParser();
-    }
-    return m_instance;
+    static MagnifierConfigParser instance;
+    return &instance;
 }
 
 int
index d7331c8..5a587c8 100644 (file)
@@ -105,8 +105,6 @@ class MainEntryParserImpl {
         XMLFiles m_xml_files;
 };
 
-MainEntryParser* MainEntryParser::m_instance = NULL;
-
 MainEntryParser::MainEntryParser() {
     m_impl = new MainEntryParserImpl;
 }
@@ -121,10 +119,8 @@ MainEntryParser::~MainEntryParser() {
 
 MainEntryParser*
 MainEntryParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new MainEntryParser();
-    }
-    return m_instance;
+    static MainEntryParser instance;
+    return &instance;
 }
 
 int
index e538501..42e2ac8 100644 (file)
@@ -233,14 +233,10 @@ class ModifierDecorationParserImpl {
         SclModifierDecoration m_modifier_decoration_table[MAX_SCL_MODIFIER_DECORATION_NUM];
 };
 
-ModifierDecorationParser* ModifierDecorationParser::m_instance = NULL;
-
 ModifierDecorationParser*
 ModifierDecorationParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new ModifierDecorationParser();
-    }
-    return m_instance;
+    static ModifierDecorationParser instance;
+    return &instance;
 }
 
 ModifierDecorationParser::ModifierDecorationParser() {
index 42db7b3..4b275b5 100644 (file)
@@ -96,8 +96,6 @@ class NinePatchFileListParserImpl {
 
 };
 
-NinePatchFileParser* NinePatchFileParser::m_instance = NULL;
-
 NinePatchFileParser::NinePatchFileParser() {
     m_impl = new NinePatchFileListParserImpl;
 }
@@ -111,10 +109,8 @@ NinePatchFileParser::~NinePatchFileParser() {
 }
 NinePatchFileParser*
 NinePatchFileParser::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new NinePatchFileParser();
-    }
-    return m_instance;
+    static NinePatchFileParser instance;
+    return &instance;
 }
 
 int
index e70eacd..c872c03 100644 (file)
@@ -24,8 +24,6 @@
 
 using namespace xmlresource;
 
-XMLResource* XMLResource::m_instance = NULL;
-
 XMLResource::XMLResource() {
     m_main_entry_parser = NULL;
     m_input_mode_configure_parser = NULL;
@@ -39,45 +37,21 @@ XMLResource::XMLResource() {
 }
 
 XMLResource::~XMLResource() {
-    if (m_main_entry_parser)
-        delete m_main_entry_parser;
     m_main_entry_parser = NULL;
-    if (m_input_mode_configure_parser)
-        delete m_input_mode_configure_parser;
     m_input_mode_configure_parser = NULL;
-    if (m_layout_parser)
-        delete m_layout_parser;
     m_layout_parser = NULL;
-    if (m_modifier_decoration_parser)
-        delete m_modifier_decoration_parser;
     m_modifier_decoration_parser = NULL;
-
-    if (m_label_properties_parser)
-        delete m_label_properties_parser;
     m_label_properties_parser = NULL;
-
-    if (m_default_configure_parser)
-        delete m_default_configure_parser;
     m_default_configure_parser = NULL;
-
-    if (m_autopopup_configure_parser)
-        delete m_autopopup_configure_parser;
     m_autopopup_configure_parser = NULL;
-    if (m_magnifier_configure_parser)
-        delete m_magnifier_configure_parser;
     m_magnifier_configure_parser = NULL;
-
-    if (m_nine_patch_file_list_parser)
-        delete m_nine_patch_file_list_parser;
     m_nine_patch_file_list_parser = NULL;
 }
 
 XMLResource*
 XMLResource::get_instance() {
-    if (m_instance == NULL) {
-        m_instance = new XMLResource();
-    }
-    return m_instance;
+    static XMLResource instance;
+    return &instance;
 }
 
 static void