Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / FUiEffectsEffectManager.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        FUiEffectsEffectManager.cpp
19  * @brief               This is the source file for the EffectManager class
20  */
21
22 #include <locale>
23
24 #include <FBaseSysLog.h>
25 #include <FBaseErrors.h>
26 #include <FUiEffectsEffectManager.h>
27 #include <FUiEffects_EffectErrorMessages.h>
28 #include <FUiEffects_EffectManagerImpl.h>
29
30 namespace Tizen { namespace Ui { namespace Effects
31 {
32
33 EffectManager*
34 EffectManager::GetInstance(void)
35 {
36         return _EffectManagerImpl::GetInstance().first;
37 }
38
39 void
40 EffectManager::DestroyInstance(void)
41 {
42         _EffectManagerImpl::DestroyInstance();
43         return;
44 }
45
46 Effect*
47 EffectManager::CreateEffect(const Tizen::Base::String& filePath)
48 {
49         //Get and store current locale:
50         char* pCurrentLocale = setlocale(LC_ALL, null);
51         char* pCurrentLocaleDuplicated = null;
52         if (pCurrentLocale != null)
53         {
54                 pCurrentLocaleDuplicated = strdup(pCurrentLocale);
55                 //Set minimal "C" locale:
56                 setlocale(LC_ALL,"C");
57         }
58
59         Effect* pEffect = _EffectManagerImpl::GetInstance().second->CreateEffect(filePath);
60
61         if (pCurrentLocaleDuplicated != null)
62         {
63                 //Restore previously saved locale:
64                 setlocale(LC_ALL, pCurrentLocaleDuplicated);
65                 free(pCurrentLocaleDuplicated);
66         }
67
68         return pEffect;
69 }
70
71 void
72 EffectManager::DestroyEffect(Effect& effect)
73 {
74         _EffectManagerImpl::GetInstance().second->DestroyEffect(effect);
75 }
76
77 // This default constructor is intentionally declared as private to implement the Singleton semantic.
78 EffectManager::EffectManager(void)
79         : __pEffectManagerImpl(null)
80 {
81
82 }
83
84 // This destructor is intentionally declared as private to implement the Singleton semantic.
85 EffectManager::~EffectManager(void)
86 {
87
88 }
89
90 }}} // Tizen::Ui::Effects