merge wrt-plugins-tizen_0.2.0-2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Application / JSApplicationEvent.cpp
index 3e452fc..507c307 100755 (executable)
@@ -83,13 +83,14 @@ const JSClassRef JSApplicationEvent::getClassRef()
 }
 
 JSObjectRef JSApplicationEvent::createJSObject(JSContextRef context, 
-       const std::string eventCode,
-       const ApplicationInformationPtr &appinfo)
+                                                                                       const std::string eventCode,
+                                                                                       const ApplicationInformationPtr &appinfo)
 {
        ApplicationEventPtr privateData = ApplicationEventPtr(new ApplicationEvent());
        privateData->setCode(eventCode);
        privateData->setApplicationInformation(appinfo);
        JSApplicationEventPriv *priv = new JSApplicationEventPriv(context, privateData);
+       
        JSObjectRef jsObjRef = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
        if (NULL == jsObjRef) {
                LogError("object creation error");
@@ -100,60 +101,59 @@ JSObjectRef JSApplicationEvent::createJSObject(JSContextRef context,
 
 void JSApplicationEvent::initialize(JSContextRef context,JSObjectRef object)
 {
+       
 }
 
 void JSApplicationEvent::finalize(JSObjectRef object)
 {
+       
 }
 
 JSValueRef JSApplicationEvent::getProperty(JSContextRef context,
-        JSObjectRef object,
-        JSStringRef propertyName,
-        JSValueRef* exception)
+                                                                       JSObjectRef object,
+                                                                       JSStringRef propertyName,
+                                                                       JSValueRef* exception)
 {
     LogDebug("Enter");
-    JSApplicationEventPriv *priv =
-        static_cast<JSApplicationEventPriv*>(JSObjectGetPrivate(object));
+    JSApplicationEventPriv *priv = static_cast<JSApplicationEventPriv*>(JSObjectGetPrivate(object));
     assert(priv && "Private object not set.");
 
-    Try     {
+    Try {
         ApplicationEventPtr appEvent = priv->getObject();
         Converter convert(context);
 
         if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_EVENT_CODE)) {
-            LogDebug(
-                "JSApplicationEvent::getProperty ::code " <<appEvent->getCode());
+            LogDebug("JSApplicationEvent::getProperty ::code " <<appEvent->getCode());
             return convert.toJSValueRef(appEvent->getCode());
-               }else if (JSStringIsEqualToUTF8CString(propertyName,
-                                                                                               APPLICATION_EVENT_APPLICATIONINFORMATION)) {
-                       LogDebug(
-                               "JSApplicationEvent::getProperty ::applicationInformation");
+                       
+               } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_EVENT_APPLICATIONINFORMATION)) {
+                       LogDebug("JSApplicationEvent::getProperty ::applicationInformation");
 
                        ApplicationInformationPtr appinfo = appEvent->getApplicationInformation();
                        ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context);
                        JSValueRef result = converter->toJSValueRef(appinfo);
 
                        return result;
-               }
-               else
-               {
+                       
+               } else {
                        LogError("wrong property");
                }
-    }
-    Catch(WrtDeviceApis::Commons::Exception) {
+    } Catch (WrtDeviceApis::Commons::Exception) {
         LogError("Exception: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, "Unknown error");
     }
+       
     return JSValueMakeUndefined(context);
 }
 
 bool JSApplicationEvent::hasInstance(JSContextRef context,
-        JSObjectRef constructor,
-        JSValueRef possibleInstance,
-        JSValueRef* exception)
+                                                       JSObjectRef constructor,
+                                                       JSValueRef possibleInstance,
+                                                       JSValueRef* exception)
 {
     return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
 }
+
 }
 }
 }