// limitations under the License.
//
-
#include <string>
#include <memory>
-#include <dpl/log/log.h>
#include <cmath>
#include <Commons/Exception.h>
#include <CommonsJavaScript/Utils.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <JSTizenExceptionFactory.h>
#include <JSTizenException.h>
-
#include "JSTimeDuration.h"
#include "TimeUtilConverter.h"
+#include <Logger.h>
namespace DeviceAPI {
namespace Time {
void JSTimeDuration::initialize(JSContextRef context, JSObjectRef object)
{
- LogDebug("entered Nothing to do.");
+ LoggerD("entered Nothing to do.");
}
void JSTimeDuration::finalize(JSObjectRef object)
{
TimeDurationPrivObject* priv = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(object));
JSObjectSetPrivate(object, NULL);
- LogDebug("Deleting TimeDuration");
+ LoggerD("Deleting TimeDuration");
delete priv;
}
JSValueRef JSTimeDuration::getProperty(JSContextRef context, JSObjectRef object,
JSStringRef propertyName, JSValueRef* exception)
{
- LogDebug("Enter");
+ LoggerD("Enter");
Try {
TimeUtilConverter convert(context);
- LogDebug("propertyName : " << convert.toString(propertyName));
+ LoggerD("propertyName : " << convert.toString(propertyName));
if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_LENGTH)) {
return convert.toJSValueRef(static_cast<double>(convert.getDurationLength(object)));
} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_UNIT)) {
return convert.toJSValueRef(strUnit);
}
} Catch (ConversionException) {
- LogError("ConversionException: " << _rethrown_exception.GetMessage());
+ LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSValueMakeUndefined(context);
}
bool JSTimeDuration::setProperty(JSContextRef context, JSObjectRef object,
JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
- LogDebug("Enter");
+ LoggerD("Enter");
Try {
TimeDurationPrivObject* privateObject = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(object));
if (!privateObject) {
- LogError("Private object is not set.");
+ LoggerE("Private object is not set.");
ThrowMsg(NullPointerException, "Private object not initialized");
}
return true;
} Catch (NullPointerException) {
- LogError("NullPointerException: " << _rethrown_exception.GetMessage());
+ LoggerE("NullPointerException: " << _rethrown_exception.GetMessage());
*exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (ConversionException) {
- LogError("ConversionException: " << _rethrown_exception.GetMessage());
+ LoggerE("ConversionException: " << _rethrown_exception.GetMessage());
*exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (InvalidArgumentException) {
- LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage());
+ LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage());
*exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
*exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
}
return false;
}
JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
- LogDebug("entered");
+ LoggerD("entered");
TimeUtilConverter convert(ctx);
Try {
DurationProperties duration;
return timeDuration;
}
} Catch(NullPointerException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
*exception = error;
return error;
} Catch(UnknownException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
*exception = error;
return error;
} Catch(ConversionException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
*exception = error;
return error;
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
*exception = error;
return error;
} Catch (WrtDeviceApis::Commons::Exception) {
- LogWarning("Trying to get incorrect value");
+ LoggerW("Trying to get incorrect value");
}
JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
*exception = error;
}
JSValueRef JSTimeDuration::diffTimeDuration(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception, CompareType type) {
- LogDebug("entered");
+ LoggerD("entered");
TimeDurationPrivObject* privateObject = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(thisObject));
if (!privateObject) {
- LogError("Private object is not set.");
+ LoggerE("Private object is not set.");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
}
JSValueRef JSTimeDuration::difference(JSContextRef context, JSObjectRef function,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
- LogDebug("Entered");
+ LoggerD("Entered");
Try {
return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, DIFFERENCE);
} Catch(ConversionException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
} Catch (UnsupportedException) {
- LogError("JSTimeUtil::hasInstance NotSupportedException");
+ LoggerE("JSTimeUtil::hasInstance NotSupportedException");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support");
} Catch (PlatformException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSTimeDuration::equalsTo(JSContextRef context, JSObjectRef function,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
- LogDebug("Entered");
+ LoggerD("Entered");
Try {
return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, EQUALSTO);
} Catch(ConversionException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
} Catch (UnsupportedException) {
- LogError("JSTimeUtil::hasInstance NotSupportedException");
+ LoggerE("JSTimeUtil::hasInstance NotSupportedException");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support");
} Catch (PlatformException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSTimeDuration::lessThan(JSContextRef context, JSObjectRef function,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
- LogDebug("Entered");
+ LoggerD("Entered");
Try {
return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, LESSTHAN);
} Catch(ConversionException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
} Catch (UnsupportedException) {
- LogError("JSTimeUtil::hasInstance NotSupportedException");
+ LoggerE("JSTimeUtil::hasInstance NotSupportedException");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support");
} Catch (PlatformException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
}
JSValueRef JSTimeDuration::greaterThan(JSContextRef context, JSObjectRef function,
JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) {
- LogDebug("Entered");
+ LoggerD("Entered");
Try {
return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, GREATERTHAN);
} Catch(ConversionException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
} Catch (InvalidArgumentException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");
} Catch (UnsupportedException) {
- LogError("JSTimeUtil::hasInstance NotSupportedException");
+ LoggerE("JSTimeUtil::hasInstance NotSupportedException");
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support");
} Catch (PlatformException) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
} Catch (WrtDeviceApis::Commons::Exception) {
- LogError("Exception: " << _rethrown_exception.GetMessage());
+ LoggerE("Exception: " << _rethrown_exception.GetMessage());
}
return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
}