From 4df699779339dff1e4360c0adbe9666ea343fc1f Mon Sep 17 00:00:00 2001 From: Pawel Sikorski Date: Wed, 6 Feb 2013 16:11:16 +0100 Subject: [PATCH] Source code formating unification [Issue#] N/A [Problem] Source code was not formatted to any rules. In this situation creating new patches or making review may become uncomfortable. [Cause] No formatting rules/tool used. [Solution] To make implementation and review process more comfortable, whole plugins-common repository source code has been formatted with uncrustify tool. The configuration of the tool is located in the repository (./uncrustify.cfg). Command used (stored in uncrustify.sh): uncrustify -c ./uncrustify.cfg --no-backup `find . -regex "\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v "orm.h\|orm_generator.h\|3rdparty"` [Verification] Build the repository Change-Id: Ic3b0427b05183ff0c18c0ee6e56928c9fa3a07ac --- src/Commons/Base64.cpp | 8 +- src/Commons/Base64.h | 4 +- src/Commons/Dimension.h | 9 +- src/Commons/Emitters.h | 10 +- src/Commons/EventListener.h | 8 +- src/Commons/EventReceiver.h | 48 +-- src/Commons/Exception.h | 40 +- src/Commons/FunctionDeclaration.h | 41 +- src/Commons/FunctionDefinition.cpp | 2 - src/Commons/FunctionDefinition.h | 29 +- src/Commons/IEvent.h | 28 +- src/Commons/IExternEventCanceler.h | 5 +- src/Commons/JSObject.h | 3 +- src/Commons/JSObjectDeclaration.cpp | 35 +- src/Commons/JSObjectDeclaration.h | 55 +-- src/Commons/ListenerEvent.h | 11 +- src/Commons/ListenerEventEmitter.h | 14 +- src/Commons/Range.h | 2 - src/Commons/Regex.cpp | 8 +- src/Commons/Regex.h | 19 +- src/Commons/RegexPatterns.h | 2 - src/Commons/RegexUtils.cpp | 8 +- src/Commons/RegexUtils.h | 2 - src/Commons/StaticAssert.h | 8 +- src/Commons/StringBuilder.cpp | 12 +- src/Commons/StringBuilder.h | 2 - src/Commons/StringUtils.cpp | 16 +- src/Commons/StringUtils.h | 5 +- src/Commons/ThreadPool.cpp | 32 +- src/Commons/ThreadPool.h | 10 +- src/Commons/TimeUtils.cpp | 31 +- src/Commons/TimeUtils.h | 2 - src/Commons/TypeTraits.h | 2 - src/Commons/TypesDeclaration.h | 11 +- src/Commons/WrtAccess/WrtAccess.cpp | 63 ++-- src/Commons/WrtAccess/WrtAccess.h | 6 +- src/Commons/plugin_initializer_def.h | 94 +++-- src/CommonsJavaScript/Converter.cpp | 23 +- src/CommonsJavaScript/Converter.h | 96 ++--- src/CommonsJavaScript/DOMExceptionData.cpp | 5 +- src/CommonsJavaScript/DOMExceptionData.h | 4 +- src/CommonsJavaScript/JSCallbackManager.cpp | 34 +- src/CommonsJavaScript/JSCallbackManager.h | 36 +- src/CommonsJavaScript/JSDOMException.cpp | 29 +- src/CommonsJavaScript/JSDOMException.h | 36 +- src/CommonsJavaScript/JSDOMExceptionFactory.cpp | 17 +- src/CommonsJavaScript/JSDOMExceptionFactory.h | 14 +- src/CommonsJavaScript/JSPendingOperation.cpp | 1 - src/CommonsJavaScript/JSPendingOperation.h | 18 +- .../JSPendingOperationPrivateObject.h | 16 +- src/CommonsJavaScript/JSUtils.cpp | 24 +- src/CommonsJavaScript/JSUtils.h | 30 +- src/CommonsJavaScript/PrivateObject.h | 42 +-- src/CommonsJavaScript/ScopedJSStringRef.cpp | 4 +- .../Security/SecurityFunctionDeclaration.cpp | 9 +- .../Security/SecurityFunctionDeclaration.h | 22 +- src/CommonsJavaScript/Security/StaticDeclaration.h | 80 ++-- src/CommonsJavaScript/SecurityExceptions.h | 2 - src/CommonsJavaScript/SupportPendingOperation.h | 15 +- src/CommonsJavaScript/Utils.h | 10 +- src/CommonsJavaScript/Validator.cpp | 18 +- src/CommonsJavaScript/Validator.h | 8 +- .../JSClass/JSSoftKeyboardChangeEvent.cpp | 83 +++-- src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h | 40 +- src/js-overlay/JSClass/JSStorageEvent.cpp | 95 +++-- src/js-overlay/JSClass/JSStorageEvent.h | 50 +-- src/js-overlay/JSClass/JSTizenServiceEvent.cpp | 63 ++-- src/js-overlay/JSClass/JSTizenServiceEvent.h | 26 +- src/js-overlay/js_function_manager.cpp | 129 +++---- src/js-overlay/js_iframe_support.cpp | 23 +- src/js-overlay/js_iframe_support.h | 3 - src/js-overlay/js_overlay_addEventListener.cpp | 70 ++-- src/js-overlay/js_overlay_addEventListener.h | 6 +- src/js-overlay/js_overlay_functions.cpp | 17 +- src/js-overlay/js_overlay_functions.h | 2 +- src/js-overlay/js_overlay_support.cpp | 59 ++- src/js-overlay/js_overlay_support.h | 3 +- src/js-overlay/js_overlay_types.h | 7 +- .../DEPRACATED/AppLauncher/AppLauncherFactory.h | 4 +- .../AppLauncher/EventGetDefaultApplication.h | 7 +- .../AppLauncher/EventGetInstalledApplications.h | 7 +- .../AppLauncher/EventLaunchApplication.h | 10 +- .../DEPRACATED/AppLauncher/IAppLauncherManager.cpp | 12 +- .../DEPRACATED/AppLauncher/IAppLauncherManager.h | 7 +- .../Device/EventClamshellStateChange.cpp | 6 +- src/modules/API/DEPRACATED/Device/IClamshell.cpp | 3 +- src/modules/API/DEPRACATED/Device/IClamshell.h | 4 +- src/modules/API/DEPRACATED/Device/IKeypad.cpp | 3 +- src/modules/API/DEPRACATED/Device/IManager.cpp | 3 +- .../DEPRACATED/Display/EventChangeOrientation.cpp | 6 +- .../API/DEPRACATED/Display/EventChangeState.cpp | 6 +- src/modules/API/DEPRACATED/Display/IManager.cpp | 3 +- src/modules/API/DEPRACATED/Display/IManager.h | 3 +- src/modules/API/DEPRACATED/Display/IScreen.cpp | 3 +- src/modules/API/DEPRACATED/Display/IScreen.h | 4 +- .../DEPRACATED/FeatureLoader/EventLoadFeature.h | 7 +- .../FeatureLoader/FeatureManagerFactory.h | 6 +- .../DEPRACATED/FeatureLoader/IFeatureManager.cpp | 6 +- .../API/DEPRACATED/FeatureLoader/IFeatureManager.h | 1 + src/modules/API/DEPRACATED/Gallery/IEventClose.h | 3 +- .../API/DEPRACATED/Gallery/IEventGetGalleries.h | 6 +- .../DEPRACATED/Gallery/IEventGetMediaItemById.h | 3 +- .../API/DEPRACATED/Gallery/IEventGetMediaItems.h | 5 +- src/modules/API/DEPRACATED/Gallery/IEventOpen.h | 5 +- src/modules/API/DEPRACATED/Gallery/IEventRefresh.h | 3 +- src/modules/API/DEPRACATED/Gallery/IGallery.cpp | 6 +- .../DEPRACATED/Gallery/IGalleryRequestManager.cpp | 2 +- .../DEPRACATED/Gallery/IGalleryRequestManager.h | 10 +- src/modules/API/DEPRACATED/Gallery/IMediaItem.h | 6 +- .../API/DEPRACATED/Gallery/IViewProperties.cpp | 7 +- .../Geolocation/EventGetCurrentPosition.h | 3 +- .../DEPRACATED/Geolocation/EventPositionChanged.h | 3 +- .../DEPRACATED/Geolocation/GeolocationFactory.cpp | 3 +- .../API/DEPRACATED/Geolocation/IGeolocation.cpp | 6 +- .../API/DEPRACATED/Geolocation/IGeolocation.h | 9 +- .../DEPRACATED/Geolocation/PositionProperties.h | 3 +- src/modules/API/DEPRACATED/Memory/IManager.cpp | 3 +- src/modules/API/DEPRACATED/System/IDate.cpp | 3 +- src/modules/API/DEPRACATED/System/IEnvironment.cpp | 3 +- .../API/DEPRACATED/Telephony/IEventClearLogs.h | 10 +- .../DEPRACATED/Telephony/IEventDeleteLogEntry.h | 10 +- .../DEPRACATED/Telephony/IEventFindLogEntries.h | 10 +- .../DEPRACATED/Telephony/IEventGetNumberOfLogs.h | 10 +- .../API/DEPRACATED/Telephony/ILogManager.cpp | 6 +- src/modules/API/DEPRACATED/Telephony/ILogManager.h | 3 +- src/modules/API/DEPRACATED/Telephony/LogEntry.cpp | 6 +- src/modules/API/DEPRACATED/Telephony/LogEntry.h | 3 +- src/modules/API/DEPRACATED/Telephony/LogFilter.cpp | 6 +- .../API/DEPRACATED/Telephony/TelephonyFactory.h | 4 +- src/modules/API/DEPRACATED/UI/IPreferences.h | 15 +- src/modules/API/DEPRACATED/UI/IPreferencesEvents.h | 18 +- src/modules/API/DEPRACATED/UI/UIFactory.h | 4 +- src/modules/API/Filesystem/Enums.h | 48 ++- src/modules/API/Filesystem/EventCopy.cpp | 2 - src/modules/API/Filesystem/EventCopy.h | 7 +- src/modules/API/Filesystem/EventFind.cpp | 7 +- src/modules/API/Filesystem/EventFind.h | 4 +- src/modules/API/Filesystem/EventListNodes.cpp | 2 - src/modules/API/Filesystem/EventListNodes.h | 2 - src/modules/API/Filesystem/EventMove.cpp | 2 - src/modules/API/Filesystem/EventMove.h | 7 +- src/modules/API/Filesystem/EventOpen.cpp | 5 +- src/modules/API/Filesystem/EventOpen.h | 2 - src/modules/API/Filesystem/EventReadText.cpp | 2 - src/modules/API/Filesystem/EventReadText.h | 2 - src/modules/API/Filesystem/EventRemove.cpp | 2 - src/modules/API/Filesystem/EventRemove.h | 5 +- src/modules/API/Filesystem/EventResolve.cpp | 5 +- src/modules/API/Filesystem/EventResolve.h | 2 - src/modules/API/Filesystem/IManager.cpp | 8 +- src/modules/API/Filesystem/IManager.h | 13 +- src/modules/API/Filesystem/INode.cpp | 8 +- src/modules/API/Filesystem/INode.h | 8 +- src/modules/API/Filesystem/INodeTypes.h | 2 - src/modules/API/Filesystem/IPath.cpp | 5 +- src/modules/API/Filesystem/IPath.h | 10 +- src/modules/API/Filesystem/IStream.cpp | 5 +- src/modules/API/Filesystem/IStream.h | 2 - src/modules/API/Filesystem/NodeFilter.cpp | 2 - src/modules/API/Filesystem/NodeFilter.h | 2 - src/modules/API/Filesystem/PathUtils.cpp | 2 - src/modules/API/Filesystem/PathUtils.h | 2 - src/modules/API/LocalStorage/ILocalStorage.h | 14 +- src/modules/API/LocalStorage/LocalStorageMgr.cpp | 2 - src/modules/API/LocalStorage/LocalStorageMgr.h | 2 - src/modules/API/Networking/EventConnected.cpp | 3 +- src/modules/API/Networking/EventDisconnected.cpp | 3 +- src/modules/API/Networking/IAdapter.cpp | 3 +- src/modules/API/Networking/IConnection.cpp | 3 +- src/modules/API/Networking/IManager.cpp | 3 +- src/modules/API/PluginManager/IPluginManager.h | 2 - .../API/PluginManager/PluginManagerFactory.cpp | 15 +- .../API/PluginManager/PluginManagerFactory.h | 7 +- .../ISoftKeyboardChangeEvent.h | 6 +- .../SoftKeyboardChangeEvent.cpp | 10 +- .../SoftKeyboardChangeEvent.h | 12 +- src/modules/API/StorageEvent/IStorageEvent.h | 6 +- src/modules/API/StorageEvent/StorageEvent.cpp | 6 +- src/modules/API/StorageEvent/StorageEvent.h | 10 +- src/modules/API/StorageEvent/StorageEventMgr.cpp | 2 - src/modules/API/StorageEvent/StorageEventMgr.h | 2 - .../API/TizenServiceEvent/ITizenServiceEvent.h | 6 +- .../API/TizenServiceEvent/TizenServiceEvent.cpp | 8 +- .../API/TizenServiceEvent/TizenServiceEvent.h | 6 +- src/modules/API/Widget/IWidget.h | 9 +- src/modules/API/Widget/WidgetFactory.cpp | 2 - src/modules/API/Widget/WidgetFactory.h | 5 +- src/modules/API/WidgetDB/IWidgetDB.h | 16 +- src/modules/API/WidgetDB/IWidgetFeature.h | 7 +- src/modules/API/WidgetDB/WidgetDBMgr.cpp | 2 - src/modules/API/WidgetDB/WidgetDBMgr.h | 2 - .../DEPRACATED/AppLauncher/AppLauncherManager.cpp | 131 ++++--- .../DEPRACATED/AppLauncher/AppLauncherManager.h | 21 +- .../tizen/DEPRACATED/Camera-Webkit/Camera.cpp | 138 +++---- .../tizen/DEPRACATED/Camera-Webkit/Camera.h | 30 +- .../DEPRACATED/Camera-Webkit/CameraManager.cpp | 17 +- .../tizen/DEPRACATED/Camera-Webkit/CameraManager.h | 6 +- src/modules/tizen/DEPRACATED/Device/Manager.cpp | 6 +- src/modules/tizen/DEPRACATED/Display/Manager.cpp | 3 +- src/modules/tizen/DEPRACATED/Display/Screen.cpp | 19 +- src/modules/tizen/DEPRACATED/Display/Screen.h | 17 +- .../DEPRACATED/FeatureLoader/FeatureManager.cpp | 16 +- .../DEPRACATED/FeatureLoader/FeatureManager.h | 20 +- src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp | 19 +- src/modules/tizen/DEPRACATED/Gallery/Gallery.h | 9 +- .../DEPRACATED/Gallery/GalleryRequestManager.cpp | 6 +- .../DEPRACATED/Gallery/GalleryRequestManager.h | 8 +- .../tizen/DEPRACATED/Geolocation/Geolocation.cpp | 24 +- .../tizen/DEPRACATED/Geolocation/Geolocation.h | 20 +- src/modules/tizen/DEPRACATED/Memory/Manager.cpp | 6 +- src/modules/tizen/DEPRACATED/Memory/Manager.h | 9 +- .../tizen/DEPRACATED/System/Environment.cpp | 6 +- .../tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp | 9 +- .../tizen/DEPRACATED/Telephony/LogEntryWrapper.h | 1 + .../tizen/DEPRACATED/Telephony/LogManager.cpp | 6 +- .../tizen/DEPRACATED/Telephony/LogManager.h | 19 +- src/modules/tizen/Filesystem/Manager.cpp | 238 ++++++------ src/modules/tizen/Filesystem/Manager.h | 12 +- src/modules/tizen/Filesystem/Node.cpp | 173 +++++---- src/modules/tizen/Filesystem/Node.h | 6 +- src/modules/tizen/Filesystem/NodeFilterMatcher.cpp | 20 +- src/modules/tizen/Filesystem/NodeFilterMatcher.h | 2 - src/modules/tizen/Filesystem/Path.cpp | 5 +- src/modules/tizen/Filesystem/Path.h | 2 - src/modules/tizen/Filesystem/Stream.cpp | 15 +- src/modules/tizen/Filesystem/Stream.h | 4 +- src/modules/tizen/Filesystem/Utils.cpp | 4 +- src/modules/tizen/Filesystem/Utils.h | 2 - src/modules/tizen/Networking/EthernetAdapter.cpp | 11 +- src/modules/tizen/Networking/EthernetAdapter.h | 9 +- src/modules/tizen/Networking/Manager.cpp | 21 +- src/modules/tizen/Networking/WifiAdapter.cpp | 11 +- src/modules/tizen/Networking/WifiAdapter.h | 9 +- src/modules/tizen/PluginManager/PluginManager.cpp | 39 +- src/modules/tizen/PluginManager/PluginManager.h | 6 +- src/modules/tizen/Widget/Property.h | 8 +- src/modules/tizen/Widget/Widget.cpp | 10 +- src/modules/tizen/Widget/Widget.h | 2 - src/modules/tizen/WidgetDB/WidgetDB.cpp | 98 ++--- src/modules/tizen/WidgetDB/WidgetDB.h | 10 +- src/modules/tizen/WidgetDB/WidgetFeature.cpp | 4 +- src/modules/tizen/WidgetDB/WidgetFeature.h | 8 +- .../WidgetInterfaceDAO/WidgetInterfaceDAO.cpp | 13 +- .../tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.h | 2 - .../widget_interface_db_sql_generator.h | 3 +- src/plugin-loading/explorer.cpp | 206 +++++----- src/plugin-loading/explorer.h | 9 +- src/plugin-loading/javascript_interface.cpp | 198 +++++----- src/plugin-loading/javascript_interface.h | 35 +- src/plugin-loading/js_page_session.cpp | 170 ++++----- src/plugin-loading/js_types.h | 4 +- src/plugin-loading/plugin.cpp | 73 ++-- src/plugin-loading/plugin.h | 14 +- src/plugin-loading/plugin_container_support.cpp | 28 +- src/plugin-loading/plugin_container_support.h | 22 +- src/plugin-loading/plugin_iframe_support.cpp | 15 +- src/plugin-loading/plugin_iframe_support.h | 12 +- src/plugin-loading/plugin_logic.cpp | 76 ++-- src/plugin-loading/plugin_logic.h | 8 +- src/plugin-loading/plugin_model.cpp | 20 +- src/plugin-loading/plugin_model.h | 37 +- src/plugin-loading/plugin_property_support.cpp | 36 +- src/plugin-loading/plugin_property_support.h | 42 +-- src/plugins-api-support/CallbackSupport.h | 30 +- src/plugins-api-support/ExportedApi.h | 133 ++++--- src/plugins-api-support/IObject.h | 11 +- src/plugins-api-support/IObject_cast.h | 5 +- src/plugins-api-support/Object.cpp | 90 ++--- src/plugins-api-support/Object.h | 10 +- src/plugins-api-support/ObjectFactory.cpp | 2 - src/plugins-api-support/ObjectFactory.h | 33 +- src/plugins-api-support/Plugin.cpp | 13 +- src/plugins-api-support/Plugin.h | 9 +- src/plugins-api-support/PluginRegistration.cpp | 9 +- src/plugins-api-support/PluginRegistration.h | 9 +- src/plugins-api-support/PluginRegistrationImpl.h | 15 +- src/plugins-api-support/PluginRegistry.cpp | 52 +-- src/plugins-api-support/PluginRegistry.h | 22 +- src/plugins-api-support/PluginSignals.h | 7 +- src/plugins-api-support/SignalSignature.h | 13 +- src/plugins-api-support/SignalsSupport.h | 51 ++- src/plugins-api-support/SoFeatures.h | 1 - src/plugins-api-support/detail/traits.h | 20 +- src/plugins-api-support/js_types.h | 9 +- src/plugins-api-support/traits.h | 13 +- src/plugins-api-support/tuple.h | 8 +- src/plugins-installer/plugin_installer.cpp | 160 ++++---- src/plugins-installer/plugin_installer.h | 6 +- src/plugins-installer/plugin_installer_errors.h | 2 - src/plugins-installer/plugin_metafile_reader.cpp | 3 +- src/plugins-installer/plugin_objects.cpp | 19 +- src/plugins-installer/plugin_objects.h | 2 +- src/plugins-installer/plugin_utils.cpp | 22 +- src/plugins-installer/plugin_utils.h | 2 - src/standards/W3C/Widget/JSPreferences.cpp | 165 ++++---- src/standards/W3C/Widget/JSPreferences.h | 8 +- src/standards/W3C/Widget/JSWidget.cpp | 173 ++++----- src/standards/W3C/Widget/JSWidget.h | 12 +- src/standards/W3C/Widget/plugin_config.cpp | 15 +- src/standards/W3C/Widget/plugin_config.h | 20 +- src/standards/W3C/Widget/plugin_initializer.cpp | 34 +- src/wrt-popup/ace/popup-bin/Popup.cpp | 184 +++++---- src/wrt-popup/ace/popup-bin/Popup.h | 20 +- src/wrt-popup/ace/popup-runner/popup-runner.cpp | 122 +++--- src/wrt-popup/ace/popup-runner/popup-runner.h | 21 +- src/wrt-popup/wrt/PopupSerializer.cpp | 2 - src/wrt-popup/wrt/PopupSerializer.h | 2 - src/wrt-popup/wrt/popup-bin/InfoPopup.cpp | 2 - src/wrt-popup/wrt/popup-bin/InfoPopup.h | 6 +- src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp | 13 +- src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.h | 14 +- src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp | 5 +- src/wrt-popup/wrt/popup-bin/YesNoPopup.h | 7 +- .../wrt/popup-bin/renderer/evas_object.cpp | 54 ++- src/wrt-popup/wrt/popup-bin/renderer/evas_object.h | 276 +++++++------- src/wrt-popup/wrt/popup-bin/renderer/popup.h | 7 +- .../wrt/popup-bin/renderer/popup_controller.cpp | 13 +- .../wrt/popup-bin/renderer/popup_controller.h | 27 +- .../wrt/popup-bin/renderer/popup_manager.cpp | 2 - .../wrt/popup-bin/renderer/popup_manager.h | 21 +- .../wrt/popup-bin/renderer/popup_object.h | 23 +- .../wrt/popup-bin/renderer/popup_renderer.cpp | 59 ++- .../wrt/popup-bin/renderer/popup_renderer.h | 8 +- src/wrt-popup/wrt/popup-bin/wrt-popup.cpp | 15 +- src/wrt-popup/wrt/popup-bin/wrt-popup.h | 12 +- src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp | 21 +- src/wrt-popup/wrt/popup-runner/PopupInvoker.h | 19 +- tests/dao/TestInit.cpp | 6 +- tests/dao/WidgetDBTest.cpp | 415 +++++++++------------ uncrustify.cfg | 170 +++++++++ uncrustify.sh | 1 + 331 files changed, 3682 insertions(+), 4002 deletions(-) mode change 100755 => 100644 src/Commons/ThreadPool.cpp mode change 100755 => 100644 src/Commons/ThreadPool.h mode change 100755 => 100644 src/Commons/plugin_initializer_def.h mode change 100755 => 100644 src/CommonsJavaScript/SecurityExceptions.h mode change 100755 => 100644 src/modules/tizen/Filesystem/Manager.cpp mode change 100755 => 100644 src/modules/tizen/Filesystem/Node.cpp mode change 100755 => 100644 src/modules/tizen/Filesystem/Stream.cpp mode change 100755 => 100644 src/plugins-installer/plugin_utils.h create mode 100644 uncrustify.cfg create mode 100755 uncrustify.sh diff --git a/src/Commons/Base64.cpp b/src/Commons/Base64.cpp index ec8f937..94ac901 100644 --- a/src/Commons/Base64.cpp +++ b/src/Commons/Base64.cpp @@ -51,10 +51,9 @@ namespace WrtDeviceApis { namespace Commons { - const std::string Base64::chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; bool Base64::is_base64(unsigned char c) { @@ -62,7 +61,7 @@ bool Base64::is_base64(unsigned char c) } std::string Base64::encode(unsigned char* data, - std::size_t num) + std::size_t num) { std::string ret; int i = 0; @@ -179,6 +178,5 @@ bool Base64::is_base64_string(const std::string& str) { return ((str.size() % 4) == 0); } - } } //WrtDeviceApisCommon diff --git a/src/Commons/Base64.h b/src/Commons/Base64.h index 3a9e54f..5f42802 100644 --- a/src/Commons/Base64.h +++ b/src/Commons/Base64.h @@ -21,12 +21,11 @@ namespace WrtDeviceApis { namespace Commons { - class Base64 { public: static std::string encode(unsigned char* data, - std::size_t num); + std::size_t num); static std::string decode(const std::string& str); private: @@ -36,7 +35,6 @@ class Base64 private: static const std::string chars; }; // Base64 - } } // WrtDeviceApisCommon diff --git a/src/Commons/Dimension.h b/src/Commons/Dimension.h index 5c0a362..703e0c0 100644 --- a/src/Commons/Dimension.h +++ b/src/Commons/Dimension.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * Encapsulates width and height of a component. */ @@ -41,11 +40,10 @@ class Dimension * @param height Specified height. */ Dimension(ValueType width, - ValueType height) : + ValueType height) : m_width(width), m_height(height) - { - } + {} ValueType getWidth() const { @@ -58,7 +56,7 @@ class Dimension } void setSize(ValueType width, - ValueType height) + ValueType height) { m_width = width; m_height = height; @@ -68,7 +66,6 @@ class Dimension ValueType m_width; ValueType m_height; }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/Emitters.h b/src/Commons/Emitters.h index b645126..7b1d8c2 100644 --- a/src/Commons/Emitters.h +++ b/src/Commons/Emitters.h @@ -29,7 +29,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * Manages listener events emitters. * Template parameter should be class that derives from @see ListenerEvent. @@ -90,7 +89,8 @@ class Emitters } /** - * Emits event through those emitters that when passed to predicate result in + * Emits event through those emitters that when passed to predicate result + * in * returning true by it. * @param event Event to emit. * @param pred Predicate - a callable object (function, functor) that takes @@ -98,7 +98,7 @@ class Emitters */ template void emitIf(const EventPtrType& event, - Predicate pred) + Predicate pred) { DPL::Mutex::ScopedLock lock(&m_mtx); for (Iterator it = m_emitters.begin(); it != m_emitters.end(); ++it) { @@ -131,7 +131,8 @@ class Emitters /** * Lock this object. - * This lock will be automatically released when out of scope (unless someone + * This lock will be automatically released when out of scope (unless + * someone * copies it). Do not use in the same scope as other API of this class. * @return Lock object. * @remarks Provided to allow locking emitters in scope of some client @@ -151,7 +152,6 @@ class Emitters DPL::Mutex m_mtx; ///< Synchronizes operation on this object. Map m_emitters; ///< Emitters container. }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/EventListener.h b/src/Commons/EventListener.h index 1340396..f059082 100644 --- a/src/Commons/EventListener.h +++ b/src/Commons/EventListener.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * Base class for listeners. * Object that is to act as listener should dervie from this class and implement @@ -34,15 +33,15 @@ class EventListener : private EventReceiver public: EventListener(ThreadEnum::Enumeration threadType) : EventReceiver(threadType) - { - } + {} virtual void onAnswerReceived(const DPL::SharedPtr& event) = 0; void postAnswer(const DPL::SharedPtr& event) { - DPL::Event::ControllerEventHandler >::PostEvent( + DPL::Event::ControllerEventHandler >:: + PostEvent( event); } @@ -52,7 +51,6 @@ class EventListener : private EventReceiver onAnswerReceived(event); } }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/EventReceiver.h b/src/Commons/EventReceiver.h index 0768e05..e3873e2 100644 --- a/src/Commons/EventReceiver.h +++ b/src/Commons/EventReceiver.h @@ -32,16 +32,15 @@ namespace WrtDeviceApis { namespace Commons { - template class SignalEventCall : public DPL::Event::AbstractEventCall { DPL::SharedPtr m_event; + public: SignalEventCall(const DPL::SharedPtr &event) : m_event(event) - { - } + {} virtual void Call() { LogDebug("signaling in SignalEventCall"); @@ -49,13 +48,13 @@ class SignalEventCall : public DPL::Event::AbstractEventCall } }; - template class EventReceiver : protected DPL::Event::Controller< typename DPL::TypeListDecl >::Type> { DPL::Event::ThreadEventDispatcher m_threadDispatcher; + protected: EventReceiver(ThreadEnum::Enumeration threadType) @@ -92,24 +91,23 @@ class EventReceiver : } }; - template class EventRequestReceiver : private EventReceiver { public: EventRequestReceiver(ThreadEnum::Enumeration threadType) : EventReceiver< TemplateEvent>(threadType) - { - } + {} virtual void OnRequestReceived(const DPL::SharedPtr &event) = 0; /* * - * @argument delaySeconds - event will be received not sooner than after delay (in seconds) + * @argument delaySeconds - event will be received not sooner than after + * delay (in seconds) */ void PostRequest(const DPL::SharedPtr &event, - double delaySeconds = 0.0) + double delaySeconds = 0.0) { LogDebug(__FUNCTION__); { @@ -120,15 +118,18 @@ class EventRequestReceiver : private EventReceiver LogDebug("state changed to STATE_REQUEST_SEND. Now posting"); if (TemplateEvent::HANDLING_SYNCHRONOUS == event->getHandlingType() && - !event->m_synchronousEventFlag) { + !event->m_synchronousEventFlag) + { event->m_synchronousEventFlag = new DPL::WaitableEvent(); } if (0.0 == delaySeconds) { - DPL::Event::ControllerEventHandler >:: + DPL::Event::ControllerEventHandler > + :: PostEvent(event); } else { - DPL::Event::ControllerEventHandler >:: + DPL::Event::ControllerEventHandler > + :: PostTimedEvent(event, delaySeconds); } LogDebug("Event posted."); @@ -165,7 +166,8 @@ class EventRequestReceiver : private EventReceiver LogDebug("calling OnRequestReceived"); OnRequestReceived(event); event->signalCancelStatusFlag(); - //After Controller ends processing it should call it to signal that work is done + //After Controller ends processing it should call it to signal that work + // is done { DPL::Mutex::ScopedLock lock(&event->m_stateMutex); @@ -182,7 +184,8 @@ class EventRequestReceiver : private EventReceiver if (TemplateEvent::HANDLING_ASYNCHRONOUS_MANUAL_ANSWER != event->m_handlingType && TemplateEvent::HANDLING_SYNCHRONOUS_MANUAL_ANSWER != - event->m_handlingType) { + event->m_handlingType) + { event->m_state = TemplateEvent::STATE_ANSWER_SEND; } } @@ -203,7 +206,8 @@ class EventRequestReceiver : private EventReceiver //event->Signal(); signalEventByDispatcher(event); break; - //when event is in manual answer mode we do nothing - the answer will be send explicit from the code + //when event is in manual answer mode we do nothing - the answer will be + // send explicit from the code case TemplateEvent::HANDLING_SYNCHRONOUS_MANUAL_ANSWER: case TemplateEvent::HANDLING_ASYNCHRONOUS_MANUAL_ANSWER: LogDebug("Manual answer is set so do nothing."); @@ -251,15 +255,13 @@ class EventRequestReceiver : private EventReceiver } }; - template class EventAnswerReceiver : private EventReceiver { public: EventAnswerReceiver(ThreadEnum::Enumeration threadType) : EventReceiver< TemplateEvent>(threadType) - { - } + {} virtual void OnAnswerReceived(const DPL::SharedPtr &event) = 0; @@ -269,7 +271,8 @@ class EventAnswerReceiver : private EventReceiver { LogDebug(__FUNCTION__); event->signalCancelStatusFlag(); - DPL::Event::ControllerEventHandler >::PostEvent( + DPL::Event::ControllerEventHandler >:: + PostEvent( event); } @@ -281,10 +284,12 @@ class EventAnswerReceiver : private EventReceiver LogDebug("checking the state"); DPL::Mutex::ScopedLock lock(&event->m_stateMutex); - //in case someone changed it to synchronous call, we don't process it + //in case someone changed it to synchronous call, we don't process + // it if (TemplateEvent::STATE_CHANGED_TO_SYNCHRONOUS == event->m_state || TemplateEvent::STATE_ENDED == - event->m_state) { + event->m_state) + { LogDebug( "Handling probably changed to synchronous meanwhile. Will not process it.."); return; @@ -317,7 +322,6 @@ class EventAnswerReceiver : private EventReceiver LogDebug("leaving"); } }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/Exception.h b/src/Commons/Exception.h index aa1f3b6..0f1db99 100644 --- a/src/Commons/Exception.h +++ b/src/Commons/Exception.h @@ -20,7 +20,6 @@ namespace WrtDeviceApis { namespace Commons { - #define PLUGINS_DECLARE_EXCEPTION_TYPE(BaseClass, Class) \ class Class : \ public BaseClass \ @@ -32,23 +31,23 @@ namespace Commons { const char *function, \ int line, \ const std::string & message = std::string()) : \ - BaseClass(path, function, line, message) \ - { \ - BaseClass::m_className = # Class; \ - m_code = ExceptionCodes::Class; \ - } \ + BaseClass(path, function, line, message) \ + { \ + BaseClass::m_className = #Class; \ + m_code = ExceptionCodes::Class; \ + } \ \ - Class(const char *path, \ - const char *function, \ - int line, \ - const DPL::Exception & reason, \ - const std::string & message = std::string()) : \ - BaseClass(path, function, line, reason, message) \ - { \ - BaseClass::m_className = # Class; \ - m_code = ExceptionCodes::Class; \ - } \ - }; + Class(const char *path, \ + const char *function, \ + int line, \ + const DPL::Exception & reason, \ + const std::string & message = std::string()) : \ + BaseClass(path, function, line, reason, message) \ + { \ + BaseClass::m_className = #Class; \ + m_code = ExceptionCodes::Class; \ + } \ + }; class ExceptionCodes { @@ -128,7 +127,8 @@ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, EventWrongStateException) PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, SecurityException) /** - * Thrown when trying to perform action that is not supported by current platform. + * Thrown when trying to perform action that is not supported by current + * platform. */ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, UnsupportedException) @@ -149,7 +149,8 @@ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, PendingOperationException) PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, AlreadyInUseException) /** - * Thrown when unpredicted error occurs while a picture or video is being captured + * Thrown when unpredicted error occurs while a picture or video is being + * captured * or if endRecording is called while no video is currently captured. */ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, CameraCaptureException) @@ -168,7 +169,6 @@ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, LocalStorageValueNoModifableException) * Thrown when object is not found. */ PLUGINS_DECLARE_EXCEPTION_TYPE(Exception, NotFoundException) - } } // WrtDeviceApisCommon diff --git a/src/Commons/FunctionDeclaration.h b/src/Commons/FunctionDeclaration.h index 23d3322..ee0588e 100644 --- a/src/Commons/FunctionDeclaration.h +++ b/src/Commons/FunctionDeclaration.h @@ -26,22 +26,21 @@ #include #define ACE_DECLARE_FUNCTION(function_definition) \ - extern WrtDeviceApis::Commons::AceFunction ace_ ## function_definition + extern WrtDeviceApis::Commons::AceFunction ace_##function_definition #define ACE_DECLARE_PARAM(param_definition) \ - extern WrtDeviceApis::Commons::AceDeviceCapParam ace_param_ ## \ + extern WrtDeviceApis::Commons::AceDeviceCapParam ace_param_## \ param_definition class DevCapFinder { public: explicit DevCapFinder(const std::string& devcap) : m_searchFor(devcap) - { - } + {} explicit DevCapFinder(const char* devcap) : m_searchFor(devcap) - { - } - bool operator()(const WrtDeviceApis::Commons::AceDeviceCapability& dc) const + {} + bool operator()(const WrtDeviceApis::Commons::AceDeviceCapability& dc) + const { return m_searchFor == dc.devCapName; } @@ -72,17 +71,21 @@ class DevCapFinder } while (0) /* - * Macro must be run inside plugin function. Plugin function must follow this declaration: - * plugin_example_function(JScontextRef cotext, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef *exception); - * where context, arguments, argumentsCount, exception are fixed and could not be change. + * Macro must be run inside plugin function. Plugin function must follow this + * declaration: + * plugin_example_function(JScontextRef cotext, JSObjectRef function, + * JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], + * JSValueRef *exception); + * where context, arguments, argumentsCount, exception are fixed and could not + * be change. * */ #define DECLARE_FUNCTION_GETTER(Plugin_Module) \ - WrtDeviceApis::Commons::AceFunction get ## Plugin_Module ## FunctionData( \ + WrtDeviceApis::Commons::AceFunction get##Plugin_Module##FunctionData( \ const std::string & functionId); #define DEFINE_FUNCTION_GETTER(Plugin_Module, FunctionMap) \ - WrtDeviceApis::Commons::AceFunction get ## Plugin_Module ## FunctionData( \ + WrtDeviceApis::Commons::AceFunction get##Plugin_Module##FunctionData( \ const std::string & functionId) \ { \ WrtDeviceApis::Commons::FunctionMapping::const_iterator it = \ @@ -96,11 +99,11 @@ class DevCapFinder return it->second; \ } -typedef WrtDeviceApis::Commons::AceFunction (&AceFunctionGetter)(const std::string&); +typedef WrtDeviceApis::Commons::AceFunction (&AceFunctionGetter)(const std:: + string&); namespace WrtDeviceApis { namespace Commons { - enum class AceSecurityStatus { AccessGranted, @@ -125,17 +128,16 @@ class DefaultArgsVerifier<> { public: void operator()(AceFunction& /*aceFunction*/) const - { - } + {} }; template AceSecurityStatus aceCheckAccess( - const FunctionGetter& f, - const char* functionName, - Args && ... args) + const FunctionGetter& f, + const char* functionName, + Args && ... args) { using namespace WrtDeviceApis::Commons; @@ -152,7 +154,6 @@ AceSecurityStatus aceCheckAccess( return AceSecurityStatus::AccessGranted; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/FunctionDefinition.cpp b/src/Commons/FunctionDefinition.cpp index 76c0c51..4209994 100644 --- a/src/Commons/FunctionDefinition.cpp +++ b/src/Commons/FunctionDefinition.cpp @@ -17,7 +17,6 @@ namespace WrtDeviceApis { namespace Commons { - int aceAddDeviceCap(const AceDeviceCapability& cap, AceDeviceCaps &instance) { @@ -31,6 +30,5 @@ int aceAddApiFeature(const AceFeature& apiFeature, instance.push_back(apiFeature); return 0; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/FunctionDefinition.h b/src/Commons/FunctionDefinition.h index ba9b264..fa8b32c 100644 --- a/src/Commons/FunctionDefinition.h +++ b/src/Commons/FunctionDefinition.h @@ -22,59 +22,59 @@ namespace WrtDeviceApis { namespace Commons { - /** * Creates an empty device cap list. Additional device-caps may be added by * ACE_CREATE_DEVICE_CAP and ACE_ADD_DEVICE_CAP macros */ #define ACE_CREATE_DEVICE_CAPS_LIST(device) \ - WrtDeviceApis::Commons::AceDeviceCaps ace_ ## device + WrtDeviceApis::Commons::AceDeviceCaps ace_##device /** * Creates an empty api features list. Additional api features may be added by * ACE_CREATE_FEATURE and ACE_ADD_API_FEATURE macros */ #define ACE_CREATE_FEATURE_LIST(apifeature) \ - WrtDeviceApis::Commons::AceFeatures ace_ ## apifeature + WrtDeviceApis::Commons::AceFeatures ace_##apifeature /** * Creates a device capability which should be later added to device cap list */ #define ACE_CREATE_DEVICE_CAP(device_cap_id, cap_id) \ - WrtDeviceApis::Commons::AceDeviceCapability ace_ ## device_cap_id = \ + WrtDeviceApis::Commons::AceDeviceCapability ace_##device_cap_id = \ AceDeviceCapability(cap_id, WrtDeviceApis::Commons::AceDeviceCapParams()); /** * Create an api feature which should be later added to api features list */ #define ACE_CREATE_FEATURE(feature_id, feature_api) \ - WrtDeviceApis::Commons::AceFeature ace_ ## feature_id = { feature_api }; + WrtDeviceApis::Commons::AceFeature ace_##feature_id = { feature_api \ + }; /** * Adds an existing device-cap created by ACE_CREATE_DEVICE_CAP macro to * device cap list */ #define ACE_ADD_DEVICE_CAP(device, device_cap_id) \ - WrtDeviceApis::Commons::aceAddDeviceCap(ace_ ## device_cap_id, ace_ ## device) + WrtDeviceApis::Commons::aceAddDeviceCap(ace_##device_cap_id, ace_##device) /** * Adds an existing api feature created by ACE_CREATE_FEATURE macro to * api feature list */ #define ACE_ADD_API_FEATURE(apifeature, feature_id) \ - WrtDeviceApis::Commons::aceAddApiFeature(ace_ ## feature_id, \ - ace_ ## apifeature) + WrtDeviceApis::Commons::aceAddApiFeature(ace_##feature_id, \ + ace_##apifeature) /** * Creates a function definition with given id that uses provided api feature * and device capability lists */ #define ACE_CREATE_FUNCTION(function_id, function_name, feature_id, device) \ - { function_name, ace_ ## feature_id, ace_ ## device } + { function_name, ace_##feature_id, ace_##device } // Support for param:name begin #define ACE_CREATE_PARAM(param_definition, param_name, position) \ - static WrtDeviceApis::Commons::AceDeviceCapParam ace_param_ ## \ + static WrtDeviceApis::Commons::AceDeviceCapParam ace_param_## \ param_definition = \ { std::string(param_name), position }; @@ -82,11 +82,10 @@ namespace Commons { typedef std::map FunctionMapping; -int aceAddDeviceCap(const AceDeviceCapability& cap, - AceDeviceCaps& instance); -int aceAddApiFeature(const AceFeature& apiFeature, - AceFeatures& instance); - +int aceAddDeviceCap(const AceDeviceCapability &cap, + AceDeviceCaps & instance); +int aceAddApiFeature(const AceFeature &apiFeature, + AceFeatures & instance); } } // WrtDeviceApisCommon diff --git a/src/Commons/IEvent.h b/src/Commons/IEvent.h index 6ff743f..af3741a 100644 --- a/src/Commons/IEvent.h +++ b/src/Commons/IEvent.h @@ -31,19 +31,17 @@ namespace WrtDeviceApis { namespace Commons { - class IEventPrivateData { public: virtual ~IEventPrivateData() - { - } + {} }; - class IEventController { DPL::SharedPtr m_privateData; + public: virtual void waitTillProcessed() = 0; virtual void waitForAnswer() = 0; @@ -53,11 +51,10 @@ class IEventController } virtual bool changeCallToSynchronous() = 0; virtual ~IEventController() - { - } + {} void setPrivateData( - const DPL::SharedPtr &privateData) + const DPL::SharedPtr &privateData) { m_privateData = privateData; } @@ -68,7 +65,6 @@ class IEventController }; typedef DPL::SharedPtr IEventControllerPtr; - // CRTP pattern template class IEvent : /*private DPL::WaitableEvent, */ public IEventController @@ -108,6 +104,7 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController //if someone is waiting signalSynchronousEventFlag(); } + protected: DPL::Mutex m_stateMutex; State m_state; @@ -130,8 +127,7 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController m_cancelStatusFlag(NULL), m_cancelled(false), m_cancelAllowed(false) - { - } + {} virtual void waitForAnswer() { @@ -213,8 +209,7 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController } virtual void clearOnCancel() - { - } + {} Commons::ExceptionCodes::Enumeration getExceptionCode() const { @@ -251,7 +246,7 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController } virtual bool setForAsynchronousCall( - EventAnswerReceiver< Super > *remoteController) + EventAnswerReceiver< Super > *remoteController) { DPL::Mutex::ScopedLock lock(&m_stateMutex); if (m_cancelled) { @@ -271,8 +266,10 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController } /* - * Normally, after invoking OnRequestReceived in RequestReceiver, the answer is being send automatically (after flow leaves OnRequestReceived). - * After calling this function, the answer is not being send automatically, you need to call ManualAnswer to send event back. + * Normally, after invoking OnRequestReceived in RequestReceiver, the answer + * is being send automatically (after flow leaves OnRequestReceived). + * After calling this function, the answer is not being send automatically, + * you need to call ManualAnswer to send event back. * It works both in asynchronous and synchronous handling type. */ virtual bool switchToManualAnswer() @@ -367,7 +364,6 @@ class IEvent : /*private DPL::WaitableEvent, */ public IEventController return m_cancelAllowed; } }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/IExternEventCanceler.h b/src/Commons/IExternEventCanceler.h index 913dad4..5a7a7e0 100644 --- a/src/Commons/IExternEventCanceler.h +++ b/src/Commons/IExternEventCanceler.h @@ -26,7 +26,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * This class is related to JSPendingOperation object. * @@ -41,10 +40,8 @@ class IExternEventCanceler virtual void OnCancelEvent(const DPL::SharedPtr& event) = 0; virtual ~IExternEventCanceler() - { - } + {} }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/JSObject.h b/src/Commons/JSObject.h index a5ef354..d52f5a8 100644 --- a/src/Commons/JSObject.h +++ b/src/Commons/JSObject.h @@ -41,8 +41,7 @@ class JSObject : private DPL::Noncopyable virtual RealObject getObject() const; virtual ~JSObject() - { - } + {} private: RealObject m_object; diff --git a/src/Commons/JSObjectDeclaration.cpp b/src/Commons/JSObjectDeclaration.cpp index 46a3da3..2ca8c9e 100644 --- a/src/Commons/JSObjectDeclaration.cpp +++ b/src/Commons/JSObjectDeclaration.cpp @@ -31,24 +31,23 @@ JSObjectDeclaration::JSObjectDeclaration(js_entity_definition_ptr_t classD) : m_classTemplate(NULL), m_constructorCallback(classD->js_class_constructor_cb) { - if (NULL != classD->js_class_template_getter_fun) - { + if (NULL != classD->js_class_template_getter_fun) { m_classTemplate = classD->js_class_template_getter_fun(); } - if(classD->class_options){ + if (classD->class_options) { LogDebug("class options is not a null"); m_options = OptionsPtr(new Options(classD->class_options)); } } JSObjectDeclaration::~JSObjectDeclaration() -{ -} +{} -bool JSObjectDeclaration::checkIframesSupported() const{ +bool JSObjectDeclaration::checkIframesSupported() const +{ LogDebug("Check iframe supported"); - if(!m_options || - m_options->getIframeObject() == Options::IFrameObject::None) + if (!m_options || + m_options->getIframeObject() == Options::IFrameObject::None) { LogDebug("Iframe NOT supported for object: " << getName()); return false; @@ -60,12 +59,12 @@ bool JSObjectDeclaration::checkIframesSupported() const{ } JSObjectDeclaration::Options::ClassType - JSObjectDeclaration::Options::getType() const +JSObjectDeclaration::Options::getType() const { LogDebug("Get type field from declaration's option"); Assert(m_options && "Pointer to options is NULL"); - switch(m_options->type){ + switch (m_options->type) { case JS_CLASS: return ClassType::Class; case JS_FUNCTION: return ClassType::Function; case JS_INTERFACE: return ClassType::Interface; @@ -74,12 +73,12 @@ JSObjectDeclaration::Options::ClassType } JSObjectDeclaration::Options::IFrameObject - JSObjectDeclaration::Options::getIframeObject() const +JSObjectDeclaration::Options::getIframeObject() const { LogDebug("Get Frame Option"); Assert(m_options && "Options object is NULL"); - switch(m_options->iframe_option){ + switch (m_options->iframe_option) { case NONE: return IFrameObject::None; case REFERENCE: return IFrameObject::Reference; case CREATE_INSTANCE: return IFrameObject::CreateInstance; @@ -89,12 +88,12 @@ JSObjectDeclaration::Options::IFrameObject } JSObjectDeclaration::Options::IFrameNotice - JSObjectDeclaration::Options::getIframeNotice() const +JSObjectDeclaration::Options::getIframeNotice() const { LogDebug("Get Frame Option"); Assert(m_options && "Pointer to options is null"); - switch(m_options->iframe_notice){ + switch (m_options->iframe_notice) { case NONE_NOTICE: return IFrameNotice::None; case ALWAYS_NOTICE: return IFrameNotice::AlwaysNotice; default: @@ -103,16 +102,16 @@ JSObjectDeclaration::Options::IFrameNotice } JSObjectDeclaration::Options::IFrameOverlay - JSObjectDeclaration::Options::getIframeOverlay() const +JSObjectDeclaration::Options::getIframeOverlay() const { LogDebug("Get Frame Option"); Assert(m_options && "Pointer to options is null"); - switch(m_options->iframe_overlay){ + switch (m_options->iframe_overlay) { case IGNORED: return IFrameOverlay::Ignored; case USE_OVERLAYED: return IFrameOverlay::UseOverlayed; case OVERLAYED_BEFORE_ORIGINAL: - return IFrameOverlay::OverlayedBeforeOriginal; + return IFrameOverlay::OverlayedBeforeOriginal; default: Assert(0 && "Wrong value of overlay option"); } @@ -134,7 +133,7 @@ void JSObjectDeclaration::Options::invokeCallback(JsContext ctx, } JSObjectDeclaration::Options::PrivateData - JSObjectDeclaration::Options::getPrivateData() const +JSObjectDeclaration::Options::getPrivateData() const { Assert(m_options && m_options->private_data && "empty private data"); return m_options->private_data; diff --git a/src/Commons/JSObjectDeclaration.h b/src/Commons/JSObjectDeclaration.h index fa14dce..699936e 100644 --- a/src/Commons/JSObjectDeclaration.h +++ b/src/Commons/JSObjectDeclaration.h @@ -39,62 +39,65 @@ class JSObjectDeclaration : private DPL::Noncopyable typedef js_class_constructor_cb_t ConstructorCallback; typedef class_definition_options_t ClassOptions; - - class Options : DPL::Noncopyable { + class Options : DPL::Noncopyable + { public: - enum class ClassType{ + enum class ClassType + { Class, Function, Interface }; - enum class IFrameObject{ + enum class IFrameObject + { None, Reference, CreateInstance }; - enum class IFrameNotice{ + enum class IFrameNotice + { None, AlwaysNotice }; //only for function - enum class IFrameOverlay{ - Ignored, - UseOverlayed, - OverlayedBeforeOriginal + enum class IFrameOverlay + { + Ignored, + UseOverlayed, + OverlayedBeforeOriginal }; typedef js_object_instance_t ObjectInstance; typedef java_script_context_t JsContext; typedef void* PrivateData; - public: - ClassType getType() const; + public: + ClassType getType() const; - IFrameObject getIframeObject() const; - IFrameNotice getIframeNotice() const; - IFrameOverlay getIframeOverlay() const; - js_function_impl getFunctionImpl() const; + IFrameObject getIframeObject() const; + IFrameNotice getIframeNotice() const; + IFrameOverlay getIframeOverlay() const; + js_function_impl getFunctionImpl() const; - void invokeCallback(JsContext ctx, - ObjectInstance iframe, - ObjectInstance object) const; + void invokeCallback(JsContext ctx, + ObjectInstance iframe, + ObjectInstance object) const; - PrivateData getPrivateData() const; + PrivateData getPrivateData() const; - private: - const ClassOptions* m_options; + private: + const ClassOptions* m_options; - private: - explicit Options(const ClassOptions* options) : m_options(options) + private: + explicit Options(const ClassOptions* options) : m_options(options) { assert(options && "Dont create empty options"); } friend class JSObjectDeclaration; - }; typedef std::shared_ptr OptionsPtr; @@ -128,8 +131,8 @@ class JSObjectDeclaration : private DPL::Noncopyable return m_constructorCallback; } - - const OptionsPtr getOptions() const{ + const OptionsPtr getOptions() const + { return m_options; } diff --git a/src/Commons/ListenerEvent.h b/src/Commons/ListenerEvent.h index 33338bc..7956ab7 100644 --- a/src/Commons/ListenerEvent.h +++ b/src/Commons/ListenerEvent.h @@ -28,7 +28,6 @@ namespace WrtDeviceApis { namespace Commons { - template class ListenerEventEmitter; @@ -90,15 +89,13 @@ class ListenerEvent ListenerEvent() : m_mtx(new DPL::Mutex()), m_code(Commons::ExceptionCodes::None) - { - } + {} ListenerEvent(const ListenerEvent &ths) : m_mtx(new DPL::Mutex()), m_code(ths.m_code), m_privateData(ths.m_privateData) - { - } + {} ListenerEvent& operator=(const ListenerEvent &other) { @@ -112,7 +109,8 @@ class ListenerEvent /** * Sets event's private data. - * Event's private data object has to implement @see IEventPrivateData interface. + * Event's private data object has to implement @see IEventPrivateData + * interface. * @param data Private data. * @throw EventWrongStateExeption When event has already been emitted. */ @@ -127,7 +125,6 @@ class ListenerEvent Commons::ExceptionCodes::Enumeration m_code; ///< Exception code. PrivateDataTypePtr m_privateData; ///< Private data. }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/ListenerEventEmitter.h b/src/Commons/ListenerEventEmitter.h index 7b52ec9..77bada2 100644 --- a/src/Commons/ListenerEventEmitter.h +++ b/src/Commons/ListenerEventEmitter.h @@ -29,7 +29,6 @@ namespace WrtDeviceApis { namespace Commons { - template class Emitters; @@ -64,19 +63,19 @@ class ListenerEventEmitter : private DPL::Noncopyable public: ListenerEventEmitter() : m_listener(NULL) - { - } + {} public: virtual ~ListenerEventEmitter() - { - } + {} /** * Sets event's private data. - * Event's private data object has to implement @see IEventPrivateData interface. + * Event's private data object has to implement @see IEventPrivateData + * interface. * @param data Private data. - * @remarks Practically private dat should be only set at object creation and + * @remarks Practically private dat should be only set at object creation + * and * not chaged during this object lifetime. */ virtual void setEventPrivateData(const EventPrivateDataTypePtr& data) @@ -142,7 +141,6 @@ class ListenerEventEmitter : private DPL::Noncopyable template const typename ListenerEventEmitter::IdType ListenerEventEmitter< EventClass>::emptyId = 0; - } } // WrtDeviceApisCommon diff --git a/src/Commons/Range.h b/src/Commons/Range.h index 1f905a2..ab731e1 100644 --- a/src/Commons/Range.h +++ b/src/Commons/Range.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * Stores data describing a range of values. */ @@ -44,7 +43,6 @@ struct Range */ ValueType max; }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/Regex.cpp b/src/Commons/Regex.cpp index 1374a14..9284d3f 100644 --- a/src/Commons/Regex.cpp +++ b/src/Commons/Regex.cpp @@ -18,10 +18,9 @@ namespace WrtDeviceApis { namespace Commons { - bool validate(const std::string &pattern, - const std::string &value, - unsigned int options) + const std::string &value, + unsigned int options) { pcrecpp::RE_Options pcreOpt; if (options & VALIDATE_MATCH_CASELESS) { @@ -35,7 +34,7 @@ bool validate(const std::string &pattern, } std::string filter(const std::string &pattern, - const std::string &value) + const std::string &value) { pcrecpp::RE re(pattern); std::string ret = static_cast(value); @@ -50,6 +49,5 @@ std::string toUpper(const std::string &value) re.GlobalReplace(UPPER_P, &ret); return ret; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/Regex.h b/src/Commons/Regex.h index 99d6b0e..f6c046b 100644 --- a/src/Commons/Regex.h +++ b/src/Commons/Regex.h @@ -20,9 +20,12 @@ namespace WrtDeviceApis { namespace Commons { - -const unsigned int VALIDATE_MATCH_CASELESS = 0x0001; //use when you want to make caseless match -const unsigned int VALIDATE_MATCH_FULL = 0x0002; //use when you want supplied text matches a supplied pattern exactly +const unsigned int VALIDATE_MATCH_CASELESS = 0x0001; //use when you want to + // make caseless match +const unsigned int VALIDATE_MATCH_FULL = 0x0002; //use when you want + // supplied text + // matches a supplied + // pattern exactly const std::string LOWER_P = "p"; const std::string UPPER_P = "P"; @@ -34,17 +37,18 @@ const std::string UPPER_P = "P"; * @return True when value is matched against pattern */ bool validate(const std::string &pattern, - const std::string &value, - unsigned int options = 0); + const std::string &value, + unsigned int options = 0); /** - * Filter value against pattern(Any character except "0-9+#*Pp" will be removed from value) + * Filter value against pattern(Any character except "0-9+#*Pp" will be removed + * from value) * @param pattern Regexp pattern * @param value String to be filtered * @return filtered value */ std::string filter(const std::string &pattern, - const std::string &value); + const std::string &value); /** * Replace character "p" in value by "P" @@ -52,7 +56,6 @@ std::string filter(const std::string &pattern, * @return replaced value */ std::string toUpper(const std::string &value); - } } // WrtDeviceApisCommon diff --git a/src/Commons/RegexPatterns.h b/src/Commons/RegexPatterns.h index ffd2f85..3c9ceb6 100644 --- a/src/Commons/RegexPatterns.h +++ b/src/Commons/RegexPatterns.h @@ -20,12 +20,10 @@ namespace WrtDeviceApis { namespace Commons { - const std::string PATTERN_PHONE_NUMBER_FILTER("[^0-9+#*Pp]"); const std::string PATTERN_PHONE_NUMBER("^[0-9#+*]+$"); const std::string PATTERN_PHONE_NUMBER_P("^\\+?[0-9#*Pp]*[0-9][0-9#*Pp]*$"); const std::string PATTERN_PHONE_NUMBER_PW("^[0-9#+*PpWw]+$"); - } } // WrtDeviceApisCommon diff --git a/src/Commons/RegexUtils.cpp b/src/Commons/RegexUtils.cpp index 1d0494a..db749e7 100644 --- a/src/Commons/RegexUtils.cpp +++ b/src/Commons/RegexUtils.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Commons { - std::string addStartPositionMark(const std::string &value) { if (!String::startsWith(value, "^") && !String::startsWith(value, ".*")) { @@ -31,7 +30,8 @@ std::string addStartPositionMark(const std::string &value) std::string addEndPositionMark(const std::string &value) { if ((!String::endsWith(value, "$") || String::endsWith(value, "\\$")) && - !String::endsWith(value, ".*")) { + !String::endsWith(value, ".*")) + { return value + "$"; } return value; @@ -65,10 +65,10 @@ std::string escape(const std::string& str) // Escape standard regular expressions' metacharacters, // i.e.: \, ., -, +, ?, (, ), [, ], ^, $, | const char* metas = "(\\.|\\-|\\+|\\?|\\(|\\)|\\[|\\]|\\^|\\$|\\|" - "|(\\\\[^\\*\\%]|\\\\$))"; // \*, \% won't get additional '\' + "|(\\\\[^\\*\\%]|\\\\$))"; // \*, \% won't get + // additional '\' pcrecpp::RE(metas).GlobalReplace("\\\\\\1", &result); return result; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/RegexUtils.h b/src/Commons/RegexUtils.h index e4bc94f..a06e1cd 100644 --- a/src/Commons/RegexUtils.h +++ b/src/Commons/RegexUtils.h @@ -20,7 +20,6 @@ namespace WrtDeviceApis { namespace Commons { - /** * Adds ^ character at the beginning in proper way * @param value Regexp pattern @@ -66,7 +65,6 @@ std::string prepareAsterisk(const std::string& str); * @return String with regex special characters escaped. */ std::string escape(const std::string& str); - } } // WrtDeviceApisCommon diff --git a/src/Commons/StaticAssert.h b/src/Commons/StaticAssert.h index 2ccafb3..bbd19f2 100644 --- a/src/Commons/StaticAssert.h +++ b/src/Commons/StaticAssert.h @@ -25,7 +25,6 @@ namespace WrtDeviceApis { namespace Commons { - template struct CompileTimeChecker { @@ -37,8 +36,8 @@ struct CompileTimeChecker {}; #define STATIC_CHECK(expr, msg) \ { \ - class ERROR_ ## msg {}; \ - CompileTimeChecker<(expr)!= 0>((ERROR_ ## msg())); \ + class ERROR_##msg {}; \ + CompileTimeChecker<(expr) != 0>((ERROR_##msg())); \ } /** @@ -52,9 +51,8 @@ struct CompileTimeChecker {}; * */ #define STATIC_ERROR(msg, C) \ { \ - C->_ ## msg(); \ + C->_##msg(); \ } - } } // WrtDeviceApisCommon diff --git a/src/Commons/StringBuilder.cpp b/src/Commons/StringBuilder.cpp index 8ebe80c..7fb1cb9 100644 --- a/src/Commons/StringBuilder.cpp +++ b/src/Commons/StringBuilder.cpp @@ -22,13 +22,11 @@ namespace WrtDeviceApis { namespace Commons { - class StringBuilderImpl { public: StringBuilderImpl() : m_counter(1) - { - } + {} void append(const std::string& str) { @@ -83,8 +81,7 @@ class StringBuilderImpl }; StringBuilder::StringBuilder() : m_impl(new StringBuilderImpl()) -{ -} +{} StringBuilder::~StringBuilder() { @@ -99,7 +96,9 @@ StringBuilder::StringBuilder(const StringBuilder& other) StringBuilder & StringBuilder::operator=(const StringBuilder& other) { - if (this == &other) { return *this; } + if (this == &other) { + return *this; + } other.m_impl->addRef(); @@ -127,6 +126,5 @@ std::string StringBuilder::toString() const { return m_impl->toString(); } - } } // WrtDeviceApisCommon diff --git a/src/Commons/StringBuilder.h b/src/Commons/StringBuilder.h index 7e151f0..fa12c37 100644 --- a/src/Commons/StringBuilder.h +++ b/src/Commons/StringBuilder.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Commons { - class StringBuilderImpl; class StringBuilder @@ -43,7 +42,6 @@ class StringBuilder private: StringBuilderImpl* m_impl; }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/StringUtils.cpp b/src/Commons/StringUtils.cpp index 1fe0b7a..0b432b6 100644 --- a/src/Commons/StringUtils.cpp +++ b/src/Commons/StringUtils.cpp @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Commons { namespace String { - std::string lTrim(const std::string& str) { std::string result = str; @@ -47,13 +46,13 @@ std::string trim(const std::string& str) } bool startsWith(const std::string& str, - const std::string& startStr) + const std::string& startStr) { return str.find(startStr) == 0; } bool endsWith(const std::string& str, - const std::string& endStr) + const std::string& endStr) { std::size_t pos = str.rfind(endStr); if (pos == std::string::npos) { @@ -63,7 +62,7 @@ bool endsWith(const std::string& str, } std::string unique(const std::string& str, - const char needle) + const char needle) { std::string result = str; @@ -83,7 +82,7 @@ std::string unique(const std::string& str, } bool inCStringArray(const std::string& needle, - const char* stack[]) + const char* stack[]) { while (*stack) { if (needle == *stack) { @@ -119,7 +118,7 @@ std::string merge(const std::vector& strs, } std::vector split(const std::string& str, - std::string::value_type delim) + std::string::value_type delim) { std::vector result; std::string::size_type begin = 0, end = 0; @@ -130,7 +129,9 @@ std::vector split(const std::string& str, if (!part.empty()) { result.push_back(part); } - if (std::string::npos == end) { break; } + if (std::string::npos == end) { + break; + } begin = end + 1; } return result; @@ -140,7 +141,6 @@ int toInt(const std::string& str) { return convertTo(str); } - } } } diff --git a/src/Commons/StringUtils.h b/src/Commons/StringUtils.h index ee7cbe8..b36071f 100644 --- a/src/Commons/StringUtils.h +++ b/src/Commons/StringUtils.h @@ -31,7 +31,6 @@ namespace WrtDeviceApis { namespace Commons { namespace String { - /** * Removes spaces from begining of the string. * @param str String to remove spaces from. @@ -155,13 +154,11 @@ template std::string parse(const T& data) { std::ostringstream oss; - if (!(oss << data)) - { + if (!(oss << data)) { Throw(ConversionException); } return oss.str(); } - } } } diff --git a/src/Commons/ThreadPool.cpp b/src/Commons/ThreadPool.cpp old mode 100755 new mode 100644 index 5ec65eb..fd5cd3a --- a/src/Commons/ThreadPool.cpp +++ b/src/Commons/ThreadPool.cpp @@ -30,7 +30,6 @@ namespace WrtDeviceApis { namespace Commons { - ThreadPool &ThreadPool::getInstance() { static ThreadPool theInstance; @@ -38,7 +37,7 @@ ThreadPool &ThreadPool::getInstance() } DPL::Event::AbstractEventDispatcher *ThreadPool::getDispatcher( - DPL::Event::ThreadEventDispatcher &callingThreadDispatcher) + DPL::Event::ThreadEventDispatcher &callingThreadDispatcher) { DPL::Thread *currentThread = DPL::Thread::GetCurrentThread(); //if we are in main thread @@ -50,8 +49,7 @@ DPL::Event::AbstractEventDispatcher *ThreadPool::getDispatcher( } ThreadPool::ThreadPool() -{ -} +{} ThreadPool::~ThreadPool() { @@ -63,7 +61,7 @@ ThreadPool::~ThreadPool() } DPL::Thread* ThreadPool::getThreadHandleCreateIfNotExists( - ThreadEnum::Enumeration type) + ThreadEnum::Enumeration type) { DPL::Mutex::ScopedLock lock(&m_threadHandlersMutex); ThreadHandleMap::iterator element = m_threadHandlers.find(type); @@ -73,7 +71,7 @@ DPL::Thread* ThreadPool::getThreadHandleCreateIfNotExists( DPL::Thread* newThread = new DPL::Thread(); m_threadHandlers.insert( m_threadHandlers.begin(), - std::pair(type, newThread)); + std::pair(type, newThread)); newThread->Run(); return newThread; } @@ -88,7 +86,8 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type) } /* we could stay with * getThreadHandleCreateIfNotExists(type); - * but by switch we can attach actually one thread to more than one ThreadEnums + * but by switch we can attach actually one thread to more than one + * ThreadEnums */ switch (type) { case ThreadEnum::NULL_THREAD: @@ -155,13 +154,15 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type) thandle = getThreadHandleCreateIfNotExists(ThreadEnum::POWER_THREAD); break; case ThreadEnum::PLUGIN_TEMPLETE_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::PLUGIN_TEMPLETE_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::PLUGIN_TEMPLETE_THREAD); break; case ThreadEnum::BLUETOOTH_THREAD: thandle = getThreadHandleCreateIfNotExists(ThreadEnum::BLUETOOTH_THREAD); break; case ThreadEnum::APPLICATION_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::APPLICATION_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::APPLICATION_THREAD); break; case ThreadEnum::GYROSCOPE_THREAD: thandle = getThreadHandleCreateIfNotExists(ThreadEnum::GYROSCOPE_THREAD); @@ -170,19 +171,23 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type) thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CLOCK_THREAD); break; case ThreadEnum::SYSTEMINFO_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::SYSTEMINFO_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::SYSTEMINFO_THREAD); break; case ThreadEnum::CALLHISTORY_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CALLHISTORY_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::CALLHISTORY_THREAD); break; case ThreadEnum::ACCOUNT_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CALLHISTORY_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::CALLHISTORY_THREAD); break; case ThreadEnum::NFC_THREAD: thandle = getThreadHandleCreateIfNotExists(ThreadEnum::NFC_THREAD); break; case ThreadEnum::MEDIACONTENT_THREAD: - thandle = getThreadHandleCreateIfNotExists(ThreadEnum::MEDIACONTENT_THREAD); + thandle = getThreadHandleCreateIfNotExists( + ThreadEnum::MEDIACONTENT_THREAD); break; case ThreadEnum::SE_THREAD: thandle = getThreadHandleCreateIfNotExists(ThreadEnum::SE_THREAD); @@ -203,6 +208,5 @@ DPL::Thread *ThreadPool::getThreadRef(ThreadEnum::Enumeration type) } return thandle; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/ThreadPool.h b/src/Commons/ThreadPool.h old mode 100755 new mode 100644 index 7ee9ed6..ada3233 --- a/src/Commons/ThreadPool.h +++ b/src/Commons/ThreadPool.h @@ -31,13 +31,12 @@ namespace WrtDeviceApis { namespace Commons { - class ThreadEnum { private: ThreadEnum() - { - } + {} + public: enum Enumeration { @@ -80,7 +79,6 @@ class ThreadEnum }; }; - class ThreadPool : private DPL::Noncopyable { private: @@ -93,6 +91,7 @@ class ThreadPool : private DPL::Noncopyable //DPL::MainEventDispatcher m_mainEventDispatcher; ThreadPool(); + public: ~ThreadPool(); @@ -105,11 +104,10 @@ class ThreadPool : private DPL::Noncopyable * Get proper dispatcher for current calling thread */ DPL::Event::AbstractEventDispatcher *getDispatcher( - DPL::Event::ThreadEventDispatcher &callingThreadDispatcher); + DPL::Event::ThreadEventDispatcher &callingThreadDispatcher); static ThreadPool& getInstance(); }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/TimeUtils.cpp b/src/Commons/TimeUtils.cpp index 0467c03..ce5cce8 100644 --- a/src/Commons/TimeUtils.cpp +++ b/src/Commons/TimeUtils.cpp @@ -24,48 +24,41 @@ namespace WrtDeviceApis { namespace Commons { namespace Time { - struct tm* localtime_r(long long int* timep, struct tm* result) { UErrorCode status = U_ZERO_ERROR; UCalendar *cal; - if( !result || !timep ) - { + if (!result || !timep) { return NULL; } cal = ucal_open(NULL, 0, NULL, UCAL_DEFAULT, &status); - if(U_FAILURE(status)) - { + if (U_FAILURE(status)) { return NULL; } ucal_setMillis(cal, (*timep * (double)1000.0), &status); - result->tm_sec = ucal_get(cal, UCAL_SECOND, &status); - result->tm_min = ucal_get(cal, UCAL_MINUTE, &status); - result->tm_hour = ucal_get(cal, UCAL_HOUR, &status); + result->tm_sec = ucal_get(cal, UCAL_SECOND, &status); + result->tm_min = ucal_get(cal, UCAL_MINUTE, &status); + result->tm_hour = ucal_get(cal, UCAL_HOUR, &status); result->tm_mday = ucal_get(cal, UCAL_DAY_OF_MONTH, &status); - result->tm_mon = ucal_get(cal, UCAL_MONTH, &status); - result->tm_year = ucal_get(cal, UCAL_YEAR, &status); - result->tm_wday = ucal_get(cal, UCAL_DAY_OF_WEEK, &status); - result->tm_yday = ucal_get(cal, UCAL_DAY_OF_YEAR, &status); - result->tm_isdst= ucal_get(cal, UCAL_DST_OFFSET, &status); + result->tm_mon = ucal_get(cal, UCAL_MONTH, &status); + result->tm_year = ucal_get(cal, UCAL_YEAR, &status); + result->tm_wday = ucal_get(cal, UCAL_DAY_OF_WEEK, &status); + result->tm_yday = ucal_get(cal, UCAL_DAY_OF_YEAR, &status); + result->tm_isdst = ucal_get(cal, UCAL_DST_OFFSET, &status); ucal_close(cal); - if(U_FAILURE(status)) - { + if (U_FAILURE(status)) { return NULL; - } - else - { + } else { return result; } } - } } } diff --git a/src/Commons/TimeUtils.h b/src/Commons/TimeUtils.h index 27e4038..de55e4c 100644 --- a/src/Commons/TimeUtils.h +++ b/src/Commons/TimeUtils.h @@ -26,9 +26,7 @@ namespace WrtDeviceApis { namespace Commons { namespace Time { - struct tm* localtime_r(long long int* timep, struct tm* result); - } } } diff --git a/src/Commons/TypeTraits.h b/src/Commons/TypeTraits.h index 3e7e78f..bcc98f7 100644 --- a/src/Commons/TypeTraits.h +++ b/src/Commons/TypeTraits.h @@ -20,7 +20,6 @@ namespace WrtDeviceApis { namespace Commons { - template struct IsNull { @@ -53,7 +52,6 @@ struct AlwaysFalse { static const bool value = false; }; - } } // WrtDeviceApisCommon diff --git a/src/Commons/TypesDeclaration.h b/src/Commons/TypesDeclaration.h index e903fe9..0f2dca2 100644 --- a/src/Commons/TypesDeclaration.h +++ b/src/Commons/TypesDeclaration.h @@ -21,7 +21,6 @@ namespace WrtDeviceApis { namespace Commons { - struct AceFeature { AceFeature(const std::string& featName) : name(featName) {} @@ -33,10 +32,9 @@ typedef std::vector AceFeatures; struct AceDeviceCapParam { AceDeviceCapParam(const std::string& parName, - const std::string& parVal) : name(parName), + const std::string& parVal) : name(parName), value(parVal) - { - } + {} std::string name; std::string value; @@ -48,11 +46,10 @@ struct AceDeviceCapability { AceDeviceCapability() {} AceDeviceCapability(const std::string& name, - const AceDeviceCapParams& params) : + const AceDeviceCapParams& params) : devCapName(name), devCapParams(params) - { - } + {} std::string devCapName; AceDeviceCapParams devCapParams; diff --git a/src/Commons/WrtAccess/WrtAccess.cpp b/src/Commons/WrtAccess/WrtAccess.cpp index cfda0f1..b81c368 100644 --- a/src/Commons/WrtAccess/WrtAccess.cpp +++ b/src/Commons/WrtAccess/WrtAccess.cpp @@ -38,7 +38,6 @@ IMPLEMENT_SAFE_SINGLETON(WrtDeviceApis::Commons::WrtAccess) namespace { - /** * Helper class - single parameter and its value */ @@ -47,11 +46,11 @@ struct AceParam const char *name; const char *value; - AceParam(): + AceParam() : name(NULL), value(NULL) {} - AceParam(const char *name, const char *value): + AceParam(const char *name, const char *value) : name(name), value(value) {} }; @@ -61,9 +60,9 @@ struct AceParam */ struct AceParamList { - size_t count; + size_t count; AceParam* param; - AceParamList(): + AceParamList() : count(0), param(NULL) {} @@ -92,10 +91,9 @@ class ScopedDeviceCapArray : public DPL::ScopedResource { public: explicit ScopedDeviceCapArray(AceParamList *ptr = - DeviceCapParamPolicy::NullValue()) : + DeviceCapParamPolicy::NullValue()) : DPL::ScopedResource(ptr) - { - } + {} AceParamList & operator [](std::ptrdiff_t k) const { @@ -110,35 +108,31 @@ class ScopedDeviceCapArray : public DPL::ScopedResource namespace WrtDeviceApis { namespace Commons { - WrtAccess::WrtAccess() : - m_sessionId(GenerateSessionId()), - m_pluginOwners(0) -{ -} + m_sessionId(GenerateSessionId()), + m_pluginOwners(0) +{} WrtAccess::~WrtAccess() -{ -} +{} WrtAccess::SessionId WrtAccess::GenerateSessionId() { const size_t SESSION_ID_LENGTH = 32; std::ostringstream pid; - pid << static_cast (getpid()); + pid << static_cast(getpid()); std::string session_id = pid.str(); session_id.reserve(session_id.length() + SESSION_ID_LENGTH); - for (size_t i = 0; i < SESSION_ID_LENGTH; ++i) - { + for (size_t i = 0; i < SESSION_ID_LENGTH; ++i) { int c = random() % 16; - session_id += (c < 10 ? - static_cast('0' + c) : - static_cast('A' + c - 10)); + session_id += (c < 10 ? + static_cast('0' + c) : + static_cast('A' + c - 10)); } return session_id; } @@ -146,8 +140,7 @@ WrtAccess::SessionId WrtAccess::GenerateSessionId() void WrtAccess::initialize(int widgetId) { LogDebug("initialize"); - if (widgetId < 0) - { + if (widgetId < 0) { LogDebug("Invalid widget id"); Throw(Exception); } @@ -176,8 +169,9 @@ int WrtAccess::getWidgetId() const bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const { - Assert(m_pluginOwners && "WrtAccessSingleton needs to be initialized with" - "WidgetId during on_widget_start_callback in each plugin"); + Assert( + m_pluginOwners && "WrtAccessSingleton needs to be initialized with" + "WidgetId during on_widget_start_callback in each plugin"); size_t deviceCount = aceFunction.deviceCapabilities.size(); DPL::ScopedArray deviceScopedArray; @@ -222,10 +216,12 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const LogDebug("constructing ACE request"); ace_request_t aceRequest; - aceRequest.session_id = const_cast(m_sessionId.c_str()); + aceRequest.session_id = + const_cast(m_sessionId.c_str()); aceRequest.widget_handle = getWidgetId(); aceRequest.feature_list.count = featuresCount; - aceRequest.feature_list.items = const_cast(featureScopedArray.Get()); + aceRequest.feature_list.items = + const_cast(featureScopedArray.Get()); aceRequest.dev_cap_list.count = deviceCount; aceRequest.dev_cap_list.items = new ace_dev_cap_t[deviceCount]; @@ -235,16 +231,16 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const unsigned int i; for (i = 0; i < deviceCount; ++i) { aceRequest.dev_cap_list.items[i].name = - const_cast(devCapNames[i]); + const_cast(devCapNames[i]); aceRequest.dev_cap_list.items[i].param_list.count = paramList[i].count; aceRequest.dev_cap_list.items[i].param_list.items = - new ace_param_t[paramList[i].count]; + new ace_param_t[paramList[i].count]; unsigned int j; for (j = 0; j < paramList[i].count; ++j) { aceRequest.dev_cap_list.items[i].param_list.items[j].name = - const_cast(paramList[i].param[j].name); + const_cast(paramList[i].param[j].name); aceRequest.dev_cap_list.items[i].param_list.items[j].value = - const_cast(paramList[i].param[j].value); + const_cast(paramList[i].param[j].value); } } @@ -252,9 +248,9 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const ace_return_t ret = ace_check_access(&aceRequest, &aceCheckResult); for (i = 0; i < deviceCount; ++i) { - delete [] aceRequest.dev_cap_list.items[i].param_list.items; + delete[] aceRequest.dev_cap_list.items[i].param_list.items; } - delete [] aceRequest.dev_cap_list.items; + delete[] aceRequest.dev_cap_list.items; if (ACE_OK != ret) { LogError("Error in ace check: " << static_cast(ret)); @@ -262,6 +258,5 @@ bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const } return ACE_TRUE == aceCheckResult; } - } } // WrtDeviceApisCommon diff --git a/src/Commons/WrtAccess/WrtAccess.h b/src/Commons/WrtAccess/WrtAccess.h index 2011a77..cc89709 100644 --- a/src/Commons/WrtAccess/WrtAccess.h +++ b/src/Commons/WrtAccess/WrtAccess.h @@ -29,16 +29,15 @@ namespace WrtDeviceApis { namespace Commons { - class WrtAccess { -public: + public: void initialize(int widgetId); void deinitialize(int widgetId); int getWidgetId() const; bool checkAccessControl(const AceFunction &aceFunction) const; -private: + private: typedef std::string SessionId; SessionId GenerateSessionId(); @@ -54,7 +53,6 @@ private: }; typedef DPL::Singleton WrtAccessSingleton; - } } // WrtDeviceApisCommon diff --git a/src/Commons/plugin_initializer_def.h b/src/Commons/plugin_initializer_def.h old mode 100755 new mode 100644 index f2429f9..73a6185 --- a/src/Commons/plugin_initializer_def.h +++ b/src/Commons/plugin_initializer_def.h @@ -16,8 +16,10 @@ /* * @author Karol Majewski (k.majewski@samsung.com) * @version 0.1 - * @brief This is a file that you provides interface for wrt-engine while loading and using plugin - * If you are a plugin developer you need to plugin_initializer.cpp in your module and provide implementation for macros below + * @brief This is a file that you provides interface for wrt-engine while + * loading and using plugin + * If you are a plugin developer you need to plugin_initializer.cpp + * in your module and provide implementation for macros below */ #ifndef WRTDEVICEAPIS_COMMONS_PLUGIN_INITIALIZER_DEF_H_ @@ -56,21 +58,22 @@ typedef java_script_context_t JavaScriptContext; * */ #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen" - - - //HAVE TO BE IMPLEMENTED IN EVERY PLUGIN /* - * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while loading each widget (for every loaded widget this function will be called) + * You have to(!) call this macro in your plugin_initializer.cpp(!) file + * providing callback that will be called while loading each widget (for every + * loaded widget this function will be called) * Example: * plugin_initializer.cpp - * void on_widget_start_callback(int widgetId, JSContextRef context, const engine_interface_t *interface) + * void on_widget_start_callback(int widgetId, JSContextRef context, + * const engine_interface_t *interface) * { * //... * } * PLUGIN_ON_WIDGET_START(on_widget_start_callback) */ -#define PLUGIN_ON_WIDGET_START(CALLBACK_NAME) extern "C" const on_widget_start_proc PLUGIN_WIDGET_START_PROC EXPORT_SYMBOL = CALLBACK_NAME; +#define PLUGIN_ON_WIDGET_START(CALLBACK_NAME) extern "C" const \ + on_widget_start_proc PLUGIN_WIDGET_START_PROC EXPORT_SYMBOL = CALLBACK_NAME; /* * You have to(!) call this macro in your plugin_initializer.cpp(!) file @@ -85,10 +88,13 @@ typedef java_script_context_t JavaScriptContext; * PLUGIN_ON_WIDGET_INIT(on_widget_init_callback) */ #define PLUGIN_ON_WIDGET_INIT(CALLBACK_NAME) extern "C" \ -const on_widget_init_proc PLUGIN_WIDGET_INIT_PROC EXPORT_SYMBOL = CALLBACK_NAME; + const on_widget_init_proc PLUGIN_WIDGET_INIT_PROC EXPORT_SYMBOL = \ + CALLBACK_NAME; /* - * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while unloading each widget (for every unloaded widget this function will be called) + * You have to(!) call this macro in your plugin_initializer.cpp(!) file + * providing callback that will be called while unloading each widget (for + * every unloaded widget this function will be called) * Example: * void on_widget_stop_callback(int widgetId) * { @@ -96,10 +102,13 @@ const on_widget_init_proc PLUGIN_WIDGET_INIT_PROC EXPORT_SYMBOL = CALLBACK_NAME; * } * PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback) */ -#define PLUGIN_ON_WIDGET_STOP(CALLBACK_NAME) extern "C" const on_widget_stop_proc PLUGIN_WIDGET_STOP_PROC EXPORT_SYMBOL = CALLBACK_NAME; +#define PLUGIN_ON_WIDGET_STOP(CALLBACK_NAME) extern "C" const \ + on_widget_stop_proc PLUGIN_WIDGET_STOP_PROC EXPORT_SYMBOL = CALLBACK_NAME; /* - * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while unloading each page (for every loaded page, including nested page, this function will be called) + * You have to(!) call this macro in your plugin_initializer.cpp(!) file + * providing callback that will be called while unloading each page (for every + * loaded page, including nested page, this function will be called) * Example: * void on_frame_load_callback(java_script_context_t context) * { @@ -107,10 +116,13 @@ const on_widget_init_proc PLUGIN_WIDGET_INIT_PROC EXPORT_SYMBOL = CALLBACK_NAME; * } * PLUGIN_ON_FRAME_LOAD(on_frame_load_callback) */ -#define PLUGIN_ON_FRAME_LOAD(CALLBACK_NAME) extern "C" const on_frame_load_proc PLUGIN_FRAME_LOAD_PROC EXPORT_SYMBOL = CALLBACK_NAME; +#define PLUGIN_ON_FRAME_LOAD(CALLBACK_NAME) extern "C" const on_frame_load_proc \ + PLUGIN_FRAME_LOAD_PROC EXPORT_SYMBOL = CALLBACK_NAME; /* - * You have to(!) call this macro in your plugin_initializer.cpp(!) file providing callback that will be called while ununloading each page (for every unloaded page, including nested page, this function will be called) + * You have to(!) call this macro in your plugin_initializer.cpp(!) file + * providing callback that will be called while ununloading each page (for + * every unloaded page, including nested page, this function will be called) * Example: * void on_frame_unload_callback(java_script_context_t context) * { @@ -118,42 +130,52 @@ const on_widget_init_proc PLUGIN_WIDGET_INIT_PROC EXPORT_SYMBOL = CALLBACK_NAME; * } * PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback) */ -#define PLUGIN_ON_FRAME_UNLOAD(CALLBACK_NAME) extern "C" const on_frame_unload_proc PLUGIN_FRAME_UNLOAD_PROC EXPORT_SYMBOL = CALLBACK_NAME; +#define PLUGIN_ON_FRAME_UNLOAD(CALLBACK_NAME) extern "C" const \ + on_frame_unload_proc PLUGIN_FRAME_UNLOAD_PROC EXPORT_SYMBOL = CALLBACK_NAME; /* - * You have to(!) define an array of structures in your plugin_initializer.cpp(!) file describing a JS class (class_definition) and it's parent class name (parent_name). + * You have to(!) define an array of structures in your + * plugin_initializer.cpp(!) file describing a JS class (class_definition) and + * it's parent class name (parent_name). * JS class will be bind to a parent class name (parent_name.jsclass_name). * Example: * plugin_initializer.cpp * PLUGIN_CLASS_MAP_BEGIN - * PLUGIN_CLASS_MAP_ADD_CLASS("bondi",WrtPluginBondi::JSICameraManager::getClassInfo()) - * PLUGIN_CLASS_MAP_ADD_CLASS("bondi",WrtPluginBondi::JSICameraAnotherClass::getClassInfo()) + * PLUGIN_CLASS_MAP_ADD_CLASS( + * "bondi", + * WrtPluginBondi::JSICameraManager::getClassInfo()) + * PLUGIN_CLASS_MAP_ADD_CLASS( + * "bondi", + * WrtPluginBondi::JSICameraAnotherClass::getClassInfo()) * PLUGIN_CLASS_MAP_END * */ -#define PLUGIN_CLASS_MAP_BEGIN extern "C" const js_entity_definition_t\ - PLUGIN_CLASS_MAP[] EXPORT_SYMBOL = { +#define PLUGIN_CLASS_MAP_BEGIN extern "C" const js_entity_definition_t \ + PLUGIN_CLASS_MAP[] EXPORT_SYMBOL = { -#define PLUGIN_CLASS_MAP_ADD_INTERFACE(PARENTNAME,INTERFACENAME,\ - JSPRODUCTCLASSTEMPLATE,PRODUCTCONSTRUCTORCB,PRIVDATA) \ - {PARENTNAME,INTERFACENAME,"",JSPRODUCTCLASSTEMPLATE,\ - PRODUCTCONSTRUCTORCB,PRIVDATA}, +#define PLUGIN_CLASS_MAP_ADD_INTERFACE(PARENTNAME, \ + INTERFACENAME, \ + JSPRODUCTCLASSTEMPLATE, \ + PRODUCTCONSTRUCTORCB, \ + PRIVDATA) \ + { PARENTNAME, INTERFACENAME, "", JSPRODUCTCLASSTEMPLATE, \ + PRODUCTCONSTRUCTORCB, PRIVDATA }, -#define PLUGIN_CLASS_MAP_ADD_INTERFACE_PRODUCT(PARENTNAME,OBJECTNAME,\ - INTERFACENAME,PRIVDATA)\ - {PARENTNAME,OBJECTNAME,INTERFACENAME,NULL,NULL,PRIVDATA}, +#define PLUGIN_CLASS_MAP_ADD_INTERFACE_PRODUCT(PARENTNAME, OBJECTNAME, \ + INTERFACENAME, PRIVDATA) \ + { PARENTNAME, OBJECTNAME, INTERFACENAME, NULL, NULL, PRIVDATA }, -#define PLUGIN_CLASS_MAP_ADD_CLASS(PARENTNAME,CLASSNAME,JSCLASSTEMPLATE,\ - PRIVDATA)\ - {PARENTNAME,CLASSNAME,"",JSCLASSTEMPLATE,NULL,PRIVDATA}, +#define PLUGIN_CLASS_MAP_ADD_CLASS(PARENTNAME, CLASSNAME, JSCLASSTEMPLATE, \ + PRIVDATA) \ + { PARENTNAME, CLASSNAME, "", JSCLASSTEMPLATE, NULL, PRIVDATA }, -#define PLUGIN_CLASS_MAP_END {NULL,NULL,NULL,NULL,NULL,NULL} }; +#define PLUGIN_CLASS_MAP_END { NULL, NULL, NULL, NULL, NULL, NULL } }; -#define PLUGIN_CLASS_MAP_BEGIN_STATIC static const js_entity_definition_t\ - PLUGIN_CLASS_MAP[] = { +#define PLUGIN_CLASS_MAP_BEGIN_STATIC static const js_entity_definition_t \ + PLUGIN_CLASS_MAP[] = { -#define PLUGIN_GET_CLASS_MAP(CALLBACK_NAME) extern "C" const\ - get_widget_entity_map_proc\ - PLUGIN_GET_CLASS_PROC_MAP EXPORT_SYMBOL = CALLBACK_NAME; +#define PLUGIN_GET_CLASS_MAP(CALLBACK_NAME) extern "C" const \ + get_widget_entity_map_proc \ + PLUGIN_GET_CLASS_PROC_MAP EXPORT_SYMBOL = CALLBACK_NAME; #endif // WRTDEVICEAPIS_COMMONS_PLUGIN_INITIALIZER_DEF_H_ diff --git a/src/CommonsJavaScript/Converter.cpp b/src/CommonsJavaScript/Converter.cpp index f550032..27183f4 100644 --- a/src/CommonsJavaScript/Converter.cpp +++ b/src/CommonsJavaScript/Converter.cpp @@ -25,14 +25,11 @@ using namespace WrtDeviceApis::Commons; namespace WrtDeviceApis { namespace CommonsJavaScript { - Converter::Converter(JSContextRef context) : m_context(context) -{ -} +{} Converter::~Converter() -{ -} +{} JSObjectRef Converter::toJSObjectRef(const JSValueRef& arg) { @@ -136,7 +133,8 @@ std::string Converter::tryString(const JSValueRef& arg) { if (!JSValueIsString(m_context, arg) && !JSValueIsNumber(m_context, arg) && - !JSValueIsBoolean(m_context, arg)) { + !JSValueIsBoolean(m_context, arg)) + { ThrowMsg(ConversionException, "Argument is not convertable to JS String."); } @@ -222,7 +220,8 @@ std::vector Converter::toVectorOfStrings(const JSValueRef& arg) return toVectorOfT_(arg, &Converter::toString); } -std::vector Converter::toVectorOfTimeT(const JSValueRef& arg) { +std::vector Converter::toVectorOfTimeT(const JSValueRef& arg) +{ return toVectorOfT_(arg, &Converter::toDateTimeT); } @@ -246,7 +245,8 @@ JSValueRef Converter::toJSValueRef(unsigned long arg) return JSValueMakeNumber(m_context, arg); } -JSValueRef Converter::toJSValueRefLong(const long arg) { +JSValueRef Converter::toJSValueRefLong(const long arg) +{ return JSValueMakeNumber(m_context, arg); } @@ -304,11 +304,13 @@ JSValueRef Converter::toJSValueRef(const char* arg) return toJSValueRef(std::string(arg)); } -JSValueRef Converter::toJSValueRef(const std::vector& arg) { +JSValueRef Converter::toJSValueRef(const std::vector& arg) +{ return toJSValueRef_(arg); } -JSValueRef Converter::toJSValueRef(const std::vector& arg) { +JSValueRef Converter::toJSValueRef(const std::vector& arg) +{ return toJSValueRef_(arg); } @@ -379,7 +381,6 @@ bool Converter::isNan(double value) const NOT_IEEE754_REPRESENTATION); return (value != value); } - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/Converter.h b/src/CommonsJavaScript/Converter.h index 302141d..ff196b6 100644 --- a/src/CommonsJavaScript/Converter.h +++ b/src/CommonsJavaScript/Converter.h @@ -29,7 +29,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class Converter : private DPL::Noncopyable { public: @@ -229,14 +228,14 @@ class Converter : private DPL::Noncopyable std::vector toVectorOfStrings(const JSValueRef& arg); /** - * Converts JSValueRef to vector of time_t. - * @param arg JSValueRef to convert. - * @return std::vector - * @throw ConversionException Thrown when conversion fails. - */ - std::vector toVectorOfTimeT(const JSValueRef& arg); + * Converts JSValueRef to vector of time_t. + * @param arg JSValueRef to convert. + * @return std::vector + * @throw ConversionException Thrown when conversion fails. + */ + std::vector toVectorOfTimeT(const JSValueRef& arg); - /** + /** * Converts boolean value to JSValueRef. * @param arg Boolean value to convert. * @return JSValueRef object. @@ -277,12 +276,12 @@ class Converter : private DPL::Noncopyable JSValueRef toJSValueRef(unsigned long arg); /** - * Converts long value to JSValueRef. - * @param arg long value to convert. - * @return JSValueRef object. - * @throw ConversionException Thrown when conversion fails. - */ - JSValueRef toJSValueRefLong(const long arg); + * Converts long value to JSValueRef. + * @param arg long value to convert. + * @return JSValueRef object. + * @throw ConversionException Thrown when conversion fails. + */ + JSValueRef toJSValueRefLong(const long arg); /** * Converts unsigned long value to JSValueRef. @@ -292,7 +291,7 @@ class Converter : private DPL::Noncopyable */ JSValueRef toJSValueRef(long long int arg); - /** + /** * Converts STL string to JSValueRef. * @param arg STL string to convert. * @return JSValueRef object. @@ -325,22 +324,22 @@ class Converter : private DPL::Noncopyable JSValueRef toJSValueRef(const tm& arg); /** - * Converts STL vector of integer to JSValueRef. - * @param arg STL vector of integer to convert. - * @return JSValueRef object. - * @throw ConversionException Thrown when conversion fails. - */ - JSValueRef toJSValueRef(const std::vector& arg); + * Converts STL vector of integer to JSValueRef. + * @param arg STL vector of integer to convert. + * @return JSValueRef object. + * @throw ConversionException Thrown when conversion fails. + */ + JSValueRef toJSValueRef(const std::vector& arg); - /** - * Converts STL vector of time_t to JSValueRef. - * @param arg STL vector of time_t to convert. - * @return JSValueRef object. - * @throw ConversionException Thrown when conversion fails. - */ - JSValueRef toJSValueRef(const std::vector& arg); + /** + * Converts STL vector of time_t to JSValueRef. + * @param arg STL vector of time_t to convert. + * @return JSValueRef object. + * @throw ConversionException Thrown when conversion fails. + */ + JSValueRef toJSValueRef(const std::vector& arg); - /** + /** * Converts STL vector of string to JSStringRef. * @param arg STL string to convert. * @return JSValueRef object. @@ -397,16 +396,18 @@ class Converter : private DPL::Noncopyable template std::vector toVectorOfT_(const JSValueRef& arg, - T (Derived::*f)(const JSValueRef &), - Derived* object) + T (Derived::*f)(const JSValueRef &), + Derived* object) { if (JSValueIsNull(m_context, - arg) || JSValueIsUndefined(m_context, arg)) { + arg) || JSValueIsUndefined(m_context, arg)) + { return std::vector(); } if (!JSIsArrayValue(m_context, arg)) { - ThrowMsg(Commons::ConversionException, "Argument is not an JS array."); + ThrowMsg(Commons::ConversionException, + "Argument is not an JS array."); } std::vector result; @@ -420,15 +421,17 @@ class Converter : private DPL::Noncopyable template std::vector toVectorOfT_(const JSValueRef& arg, - T (Converter::*f)(const JSValueRef &)) + T (Converter::*f)(const JSValueRef &)) { if (JSValueIsNull(m_context, - arg) || JSValueIsUndefined(m_context, arg)) { + arg) || JSValueIsUndefined(m_context, arg)) + { return std::vector(); } if (!JSIsArrayValue(m_context, arg)) { - ThrowMsg(Commons::ConversionException, "Argument is not an JS array."); + ThrowMsg(Commons::ConversionException, + "Argument is not an JS array."); } std::vector result; @@ -442,13 +445,14 @@ class Converter : private DPL::Noncopyable template JSValueRef toJSValueRef_(const std::vector& arg, - JSValueRef (Derived::*f)(const T &), - Derived* object) + JSValueRef (Derived::*f)(const T &), + Derived* object) { JSObjectRef jsResult = JSCreateArrayObject(m_context, 0, NULL); if (NULL == jsResult) { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Could not create js array object"); + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, + "Could not create js array object"); } for (std::size_t i = 0; i < arg.size(); ++i) { @@ -489,7 +493,8 @@ class Converter : private DPL::Noncopyable JSObjectRef jsResult = JSCreateArrayObject(m_context, 0, NULL); if (NULL == jsResult) { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Could not create js array object"); + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, + "Could not create js array object"); } typename std::list::const_iterator it = arg.begin(); @@ -506,13 +511,14 @@ class Converter : private DPL::Noncopyable template JSValueRef toJSValueRef_(const std::list& arg, - JSValueRef (Derived::*f)(const T &), - Derived* object) + JSValueRef (Derived::*f)(const T &), + Derived* object) { JSObjectRef jsResult = JSCreateArrayObject(m_context, 0, NULL); if (NULL == jsResult) { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Could not create js array object"); + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, + "Could not create js array object"); } typename std::list::const_iterator it = arg.begin(); @@ -534,7 +540,8 @@ class Converter : private DPL::Noncopyable { std::stringstream ss; if (!(ss << arg)) { - ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Could not convert to string."); + ThrowMsg(WrtDeviceApis::Commons::ConversionException, + "Could not convert to string."); } return ss.str(); } @@ -572,7 +579,6 @@ class ConverterFactory : private DPL::Noncopyable typedef ConverterFactory BasicConverterFactory; typedef BasicConverterFactory::ConverterType BasicConverter; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/DOMExceptionData.cpp b/src/CommonsJavaScript/DOMExceptionData.cpp index 6625eca..3eb148a 100644 --- a/src/CommonsJavaScript/DOMExceptionData.cpp +++ b/src/CommonsJavaScript/DOMExceptionData.cpp @@ -17,13 +17,11 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - DOMExceptionData::DOMExceptionData(int code, const std::string& message) : m_code(code), m_message(message) -{ -} +{} int DOMExceptionData::getCode() const { @@ -34,6 +32,5 @@ std::string DOMExceptionData::getMessage() const { return m_message; } - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/DOMExceptionData.h b/src/CommonsJavaScript/DOMExceptionData.h index fee0e86..b6cd760 100644 --- a/src/CommonsJavaScript/DOMExceptionData.h +++ b/src/CommonsJavaScript/DOMExceptionData.h @@ -21,12 +21,11 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class DOMExceptionData { public: explicit DOMExceptionData(int code, - const std::string& message = std::string()); + const std::string& message = std::string()); int getCode() const; std::string getMessage() const; @@ -37,7 +36,6 @@ class DOMExceptionData }; typedef DPL::SharedPtr DOMExceptionDataPtr; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSCallbackManager.cpp b/src/CommonsJavaScript/JSCallbackManager.cpp index 21d278a..fd541da 100644 --- a/src/CommonsJavaScript/JSCallbackManager.cpp +++ b/src/CommonsJavaScript/JSCallbackManager.cpp @@ -24,12 +24,13 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - -JSCallbackManagerPtr JSCallbackManager::createObject(JSContextRef context, - JSValueRef onSuccess, - JSValueRef onError, - bool acceptJSNullAsOnSuccess, - bool acceptJSNullAsOnError) +JSCallbackManagerPtr JSCallbackManager::createObject( + JSContextRef context, + JSValueRef onSuccess, + JSValueRef onError, + bool + acceptJSNullAsOnSuccess, + bool acceptJSNullAsOnError) { LogDebug("entered"); JSObjectRef l_onSuccess = NULL; @@ -38,10 +39,12 @@ JSCallbackManagerPtr JSCallbackManager::createObject(JSContextRef context, LogDebug("onSuccessCallback ptr=" << onSuccess); LogDebug("onErrorCallback ptr=" << onError); if (NULL != onSuccess && - (!acceptJSNullAsOnSuccess || !JSValueIsNull(context, onSuccess))) { + (!acceptJSNullAsOnSuccess || !JSValueIsNull(context, onSuccess))) + { l_onSuccess = JSValueToObject(context, onSuccess, NULL); if (!l_onSuccess || - !JSObjectIsFunction(context, l_onSuccess)) { + !JSObjectIsFunction(context, l_onSuccess)) + { ThrowMsg(Commons::InvalidArgumentException, "success callback is not a function"); } @@ -49,10 +52,12 @@ JSCallbackManagerPtr JSCallbackManager::createObject(JSContextRef context, LogWarning("onSuccessCallback is NULL and is not registred"); } if (NULL != onError && - (!acceptJSNullAsOnError || !JSValueIsNull(context, onError))) { + (!acceptJSNullAsOnError || !JSValueIsNull(context, onError))) + { l_onError = JSValueToObject(context, onError, NULL); if (!l_onError || - !JSObjectIsFunction(context, l_onError)) { + !JSObjectIsFunction(context, l_onError)) + { ThrowMsg(Commons::InvalidArgumentException, "error callback is not a function"); } @@ -64,8 +69,8 @@ JSCallbackManagerPtr JSCallbackManager::createObject(JSContextRef context, } JSCallbackManager::JSCallbackManager(JSContextRef context, - JSObjectRef onSuccess, - JSObjectRef onError) : + JSObjectRef onSuccess, + JSObjectRef onError) : m_onSuccess(NULL), m_onError(NULL), m_object(NULL), @@ -190,7 +195,7 @@ void JSCallbackManager::callOnSuccess(JSValueRef obj) } void JSCallbackManager::callOnSuccess(JSValueRef obj[], - int paramCount) + int paramCount) { LogDebug("entered"); if (m_onSuccess == NULL) { @@ -222,7 +227,7 @@ void JSCallbackManager::callOnError(JSValueRef obj) } void JSCallbackManager::callOnError(JSValueRef obj[], - int paramCount) + int paramCount) { LogDebug("entered"); if (m_onError == NULL) { @@ -256,6 +261,5 @@ void JSCallbackManager::makeCallback(JSContextRef context, return; } } - } } diff --git a/src/CommonsJavaScript/JSCallbackManager.h b/src/CommonsJavaScript/JSCallbackManager.h index 9eb7ea5..457fe95 100644 --- a/src/CommonsJavaScript/JSCallbackManager.h +++ b/src/CommonsJavaScript/JSCallbackManager.h @@ -28,7 +28,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class JSCallbackManager; typedef DPL::SharedPtr JSCallbackManagerPtr; @@ -36,37 +35,42 @@ class JSCallbackManager : public WrtDeviceApis::Commons::IEventPrivateData { private: JSCallbackManager() - { - } + {} /** - * Used to create JSCallbackManagerPtr object by factory method createObject + * Used to create JSCallbackManagerPtr object by factory method + * createObject */ JSCallbackManager(JSContextRef context, - JSObjectRef onSuccess, - JSObjectRef onError); + JSObjectRef onSuccess, + JSObjectRef onError); public: - //JSCallbackManager( JSContextRef context, JSValueRef onSuccess, JSValueRef onError ); + //JSCallbackManager( JSContextRef context, JSValueRef onSuccess, JSValueRef + // onError ); /** * Create JSCallbackManagerPtr object witch checking callback parameters - * if callbacks are NULL it was programmer intention to not use callback and no exception will be rised + * if callbacks are NULL it was programmer intention to not use callback and + * no exception will be rised * if callbacks are some object but not a function it will rise exception * @param[in] context - global context * @param[in] onSuccess - success callback (may be NULL if not needed) * @param[in] onError - error callback (may be NULL if not needed) - * @param[in] acceptJSNullAsOnSuccess - converts JSNull on onSuccess to NULL when true - * @param[in] acceptJSNullAsOnError - converts JSNull on onError to NULL when true - * @throw Commons::InvalidArgumentException - if callback is not null and is not a js function + * @param[in] acceptJSNullAsOnSuccess - converts JSNull on onSuccess to NULL + * when true + * @param[in] acceptJSNullAsOnError - converts JSNull on onError to NULL + * when true + * @throw Commons::InvalidArgumentException - if callback is not null and is + * not a js function */ static JSCallbackManagerPtr createObject( - JSContextRef context, - JSValueRef onSuccess = NULL, - JSValueRef onError = NULL, - bool acceptJSNullAsOnSuccess = false, - bool acceptJSNullAsOnError = false); + JSContextRef context, + JSValueRef onSuccess = NULL, + JSValueRef onError = NULL, + bool acceptJSNullAsOnSuccess = false, + bool acceptJSNullAsOnError = false); virtual ~JSCallbackManager(); diff --git a/src/CommonsJavaScript/JSDOMException.cpp b/src/CommonsJavaScript/JSDOMException.cpp index e1e476a..ffee065 100644 --- a/src/CommonsJavaScript/JSDOMException.cpp +++ b/src/CommonsJavaScript/JSDOMException.cpp @@ -77,14 +77,14 @@ const Error PROPERTY_ERROR[] = { WrtDeviceApis::CommonsJavaScript::JSDOMException::SECURITY_ERR }, { "NETWORK_ERR", WrtDeviceApis::CommonsJavaScript::JSDOMException::NETWORK_ERR }, - { "ABORT_ERR", + { "ABORT_ERR", WrtDeviceApis::CommonsJavaScript::JSDOMException::ABORT_ERR }, { "TIMEOUT_ERR", WrtDeviceApis::CommonsJavaScript::JSDOMException::TIMEOUT_ERR }, { "INVALID_VALUES_ERR", WrtDeviceApis::CommonsJavaScript::JSDOMException::INVALID_VALUES_ERR }, - { "IO_ERR", - WrtDeviceApis::CommonsJavaScript::JSDOMException::IO_ERR }, + { "IO_ERR", + WrtDeviceApis::CommonsJavaScript::JSDOMException::IO_ERR }, { "QUOTA_EXCEEDED_ERR", WrtDeviceApis::CommonsJavaScript::JSDOMException::QUOTA_EXCEEDED_ERR } }; @@ -92,7 +92,6 @@ const Error PROPERTY_ERROR[] = { namespace WrtDeviceApis { namespace CommonsJavaScript { - JSClassRef JSDOMException::m_classRef = NULL; JSClassDefinition JSDOMException::m_classInfo = { @@ -136,8 +135,7 @@ JSClassRef JSDOMException::getClassRef() void JSDOMException::initialize(JSContextRef /*context*/, JSObjectRef /*object*/) -{ -} +{} void JSDOMException::finalize(JSObjectRef object) { @@ -156,7 +154,8 @@ bool JSDOMException::hasProperty(JSContextRef /*context*/, const size_t size = sizeof(PROPERTY_ERROR) / sizeof(PROPERTY_ERROR[0]); for (size_t i = 0; i < size; ++i) { if (JSStringIsEqualToUTF8CString(propertyName, - PROPERTY_ERROR[i].name)) { + PROPERTY_ERROR[i].name)) + { return true; } } @@ -180,12 +179,12 @@ JSValueRef JSDOMException::getStaticProperty(JSContextRef context, if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_CODE)) { return converter.toJSValueRef(privateObject->getObject()->getCode()); } else if (JSStringIsEqualToUTF8CString(propertyName, - PROPERTY_MESSAGE)) { + PROPERTY_MESSAGE)) + { return converter.toJSValueRef( privateObject->getObject()->getMessage()); } - } - catch (const Commons::ConversionException& ex) { + } catch (const Commons::ConversionException& ex) { LogError("Exception: " << ex.GetMessage()); } @@ -207,8 +206,7 @@ JSValueRef JSDOMException::getProperty(JSContextRef context, return converter.toJSValueRef(PROPERTY_ERROR[i].value); } } - } - catch (const Commons::ConversionException& ex) { + } catch (const Commons::ConversionException& ex) { LogError("Exception: " << ex.GetMessage()); } @@ -216,9 +214,9 @@ JSValueRef JSDOMException::getProperty(JSContextRef context, } void JSDOMException::getPropertyNames( - JSContextRef /*context*/, - JSObjectRef /*object*/, - JSPropertyNameAccumulatorRef accumulator) + JSContextRef /*context*/, + JSObjectRef /*object*/, + JSPropertyNameAccumulatorRef accumulator) { const size_t size = sizeof(PROPERTY_ERROR) / sizeof(PROPERTY_ERROR[0]); for (size_t i = 0; i < size; ++i) { @@ -235,7 +233,6 @@ bool JSDOMException::hasInstance(JSContextRef context, { return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); } - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSDOMException.h b/src/CommonsJavaScript/JSDOMException.h index e7e97c5..dcea1e4 100644 --- a/src/CommonsJavaScript/JSDOMException.h +++ b/src/CommonsJavaScript/JSDOMException.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class JSDOMException { public: @@ -69,7 +68,7 @@ class JSDOMException * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -80,39 +79,41 @@ class JSDOMException * The callback invoked when getting a property's value. */ static bool hasProperty(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName); + JSObjectRef object, + JSStringRef propertyName); /** * The callback invoked when getting a property's value. */ static JSValueRef getProperty(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); /** * The callback invoked when getting a property's value. */ static JSValueRef getStaticProperty(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static void getPropertyNames(JSContextRef context, - JSObjectRef object, - JSPropertyNameAccumulatorRef accumulator); + JSObjectRef object, + JSPropertyNameAccumulatorRef accumulator); /** - * The callback invoked when an object is used as the target of an 'instanceof' expression. + * The callback invoked when an object is used as the target of an + * 'instanceof' expression. */ static bool hasInstance(JSContextRef context, - JSObjectRef constructor, - JSValueRef possibleInstance, - JSValueRef* exception); + JSObjectRef constructor, + JSValueRef possibleInstance, + JSValueRef* exception); /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -123,7 +124,6 @@ class JSDOMException static JSClassRef m_classRef; }; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSDOMExceptionFactory.cpp b/src/CommonsJavaScript/JSDOMExceptionFactory.cpp index 398dfa3..94c1797 100644 --- a/src/CommonsJavaScript/JSDOMExceptionFactory.cpp +++ b/src/CommonsJavaScript/JSDOMExceptionFactory.cpp @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - #define DEFINE_JS_EXCEPTION_FACTORY(Class, Code) \ JSDOMExceptionFactory JSDOMExceptionFactory::Class(Code) @@ -69,30 +68,28 @@ DEFINE_JS_EXCEPTION_FACTORY(QuotaExceededException, JSDOMException::QUOTA_EXCEEDED_ERR); JSDOMExceptionFactory::JSDOMExceptionFactory(int code) : m_code(code) -{ -} +{} JSValueRef JSDOMExceptionFactory::make(JSContextRef context, - JSValueRef* exception, - const std::string& message) + JSValueRef* exception, + const std::string& message) { Assert(exception && "Exception object can't be NULL."); JSDOMException::PrivateObject::ObjectType data(new DOMExceptionData(m_code, message)); *exception = JSUtils::makeObject(context, - JSDOMException::getClassRef(), - data); + JSDOMException::getClassRef(), + data); return JSValueMakeUndefined(context); } JSObjectRef JSDOMExceptionFactory::make(JSContextRef context, - const std::string& message) + const std::string& message) { JSDOMException::PrivateObject::ObjectType data(new DOMExceptionData(m_code, message)); return JSUtils::makeObject(context, - JSDOMException::getClassRef(), data); + JSDOMException::getClassRef(), data); } - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSDOMExceptionFactory.h b/src/CommonsJavaScript/JSDOMExceptionFactory.h index 84f79ba..2bf8329 100644 --- a/src/CommonsJavaScript/JSDOMExceptionFactory.h +++ b/src/CommonsJavaScript/JSDOMExceptionFactory.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - #define DECLARE_JS_EXCEPTION_FACTORY(Class) static JSDOMExceptionFactory Class class JSDOMExceptionFactory : public DPL::Noncopyable @@ -69,30 +68,31 @@ class JSDOMExceptionFactory : public DPL::Noncopyable * JSValueRef* exception) * { * ... - * return JSExceptionFactory::InvalidArgumentException.make(context, exception); + * return JSExceptionFactory::InvalidArgumentException.make(context, + * exception); * ... * } * @endcode */ JSValueRef make(JSContextRef context, - JSValueRef* exception, - const std::string& message = std::string()); + JSValueRef* exception, + const std::string& message = std::string()); /** * Creates exception object. * @param context JS context of the exception. * @return JS exception object. * @code - * JSObjectRef jsError = JSExceptionFactory::InvalidArgumentException.make(context); + * JSObjectRef jsError = + * JSExceptionFactory::InvalidArgumentException.make(context); * @endcode */ JSObjectRef make(JSContextRef context, - const std::string& message = std::string()); + const std::string& message = std::string()); private: int m_code; }; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSPendingOperation.cpp b/src/CommonsJavaScript/JSPendingOperation.cpp index 23c841e..1891361 100644 --- a/src/CommonsJavaScript/JSPendingOperation.cpp +++ b/src/CommonsJavaScript/JSPendingOperation.cpp @@ -28,7 +28,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - namespace { const char* PLUGIN_NAME = "PendingOperation"; } diff --git a/src/CommonsJavaScript/JSPendingOperation.h b/src/CommonsJavaScript/JSPendingOperation.h index 0f75970..1a67d89 100644 --- a/src/CommonsJavaScript/JSPendingOperation.h +++ b/src/CommonsJavaScript/JSPendingOperation.h @@ -32,7 +32,8 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { -//typedef Commons::PrivateObjectT::Type PendingOperationPrivateObject; +//typedef Commons::PrivateObjectT::Type +// PendingOperationPrivateObject; class JSPendingOperation { @@ -47,7 +48,7 @@ class JSPendingOperation * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -55,7 +56,8 @@ class JSPendingOperation static void finalize(JSObjectRef object); /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -70,11 +72,11 @@ class JSPendingOperation * Cancel the pending operation, if it has yet not completed. */ static JSValueRef cancel(JSContextRef context, - JSObjectRef object, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception); + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); }; } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/JSPendingOperationPrivateObject.h b/src/CommonsJavaScript/JSPendingOperationPrivateObject.h index 745d284..3f41bf2 100644 --- a/src/CommonsJavaScript/JSPendingOperationPrivateObject.h +++ b/src/CommonsJavaScript/JSPendingOperationPrivateObject.h @@ -35,8 +35,8 @@ class IJSPendingOperationPrivateObject { public: explicit IJSPendingOperationPrivateObject( - const DPL::SharedPtr - &event) : + const DPL::SharedPtr + &event) : m_event(event) { assert(NULL != m_event); @@ -49,8 +49,7 @@ class IJSPendingOperationPrivateObject } virtual ~IJSPendingOperationPrivateObject() - { - } + {} protected: DPL::SharedPtr m_event; @@ -77,9 +76,9 @@ class IJSExtCancelPendingOperationPrivateObject : { public: IJSExtCancelPendingOperationPrivateObject( - const DPL::SharedPtr< TemplateEvent> &event, - const DPL::SharedPtr< - Commons::IExternEventCanceler > & cancel) : + const DPL::SharedPtr< TemplateEvent> &event, + const DPL::SharedPtr< + Commons::IExternEventCanceler > & cancel) : IJSPendingOperationPrivateObject( DPL::StaticPointerCast(event)), m_canceler(cancel) @@ -106,8 +105,7 @@ class IJSExtCancelPendingOperationPrivateObject : } virtual ~IJSExtCancelPendingOperationPrivateObject() - { - } + {} protected: DPL::SharedPtr< Commons::IExternEventCanceler > m_canceler; diff --git a/src/CommonsJavaScript/JSUtils.cpp b/src/CommonsJavaScript/JSUtils.cpp index f3248a3..f4c9c95 100644 --- a/src/CommonsJavaScript/JSUtils.cpp +++ b/src/CommonsJavaScript/JSUtils.cpp @@ -19,12 +19,10 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - using namespace WrtDeviceApis::Commons; - bool JSUtils::hasProperty(JSStaticValue* properties, - JSStringRef name) + JSStringRef name) { JSStaticValue* property = properties; while (property->name) { @@ -37,9 +35,9 @@ bool JSUtils::hasProperty(JSStaticValue* properties, } JSValueRef JSUtils::getJSProperty(JSContextRef context, - JSValueRef jsValue, - const std::string &name, - JSValueRef *exception) + JSValueRef jsValue, + const std::string &name, + JSValueRef *exception) { ScopedJSStringRef jsPropName(JSStringCreateWithUTF8CString(name.c_str())); Converter converter(context); @@ -52,8 +50,8 @@ JSValueRef JSUtils::getJSProperty(JSContextRef context, } JSValueRef JSUtils::getJSProperty(JSContextRef context, - JSObjectRef object, - const std::string& name) + JSObjectRef object, + const std::string& name) { Converter converter(context); Try { @@ -68,14 +66,13 @@ JSValueRef JSUtils::getJSProperty(JSContextRef context, } } } - Catch(ConversionException) { - } + Catch(ConversionException) {} return NULL; } JSValueRef JSUtils::getJSPropertyOrUndefined(JSContextRef context, - JSObjectRef object, - const std::string& name) + JSObjectRef object, + const std::string& name) { Converter converter(context); Try { @@ -84,8 +81,7 @@ JSValueRef JSUtils::getJSPropertyOrUndefined(JSContextRef context, return JSObjectGetProperty(context, object, propName.get(), NULL); } } - Catch(ConversionException) { - } + Catch(ConversionException) {} return JSValueMakeUndefined(context); } } // CommonsJavaScript diff --git a/src/CommonsJavaScript/JSUtils.h b/src/CommonsJavaScript/JSUtils.h index c55f8db..5d835a1 100644 --- a/src/CommonsJavaScript/JSUtils.h +++ b/src/CommonsJavaScript/JSUtils.h @@ -24,61 +24,61 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class JSUtils { public: static bool hasProperty(JSStaticValue* properties, - JSStringRef name); + JSStringRef name); /** * Gets a property from JSObject if exists * @return JSValueRef if property exists, NULL if not */ static JSValueRef getJSProperty(JSContextRef context, - JSValueRef jsValue, - const std::string &name, - JSValueRef* exception = NULL); + JSValueRef jsValue, + const std::string &name, + JSValueRef* exception = NULL); static JSValueRef getJSProperty(JSContextRef context, - JSObjectRef object, - const std::string& name); + JSObjectRef object, + const std::string& name); static JSValueRef getJSPropertyOrUndefined(JSContextRef context, - JSObjectRef object, - const std::string& name); + JSObjectRef object, + const std::string& name); template static JSObjectRef makeObject(JSContextRef context, - JSClassRef classRef, - C data) + JSClassRef classRef, + C data) { typedef typename PrivateObjectT::Type Private; Private* priv = new Private(context, data); JSObjectRef object = JSObjectMake(context, classRef, priv); if (!object) { - ThrowMsg(Commons::NullPointerException, "Could not create JS object."); + ThrowMsg(Commons::NullPointerException, + "Could not create JS object."); } return object; } static JSObjectRef makeObject(JSContextRef context, - JSClassRef classRef) + JSClassRef classRef) { typedef PrivateObjectT::Type Private; Private* priv = new Private(context); JSObjectRef object = JSObjectMake(context, classRef, priv); if (!object) { - ThrowMsg(Commons::NullPointerException, "Could not create JS object."); + ThrowMsg(Commons::NullPointerException, + "Could not create JS object."); } return object; } }; // JSUtils - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/PrivateObject.h b/src/CommonsJavaScript/PrivateObject.h index d303d7a..e73a210 100644 --- a/src/CommonsJavaScript/PrivateObject.h +++ b/src/CommonsJavaScript/PrivateObject.h @@ -24,17 +24,15 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - template struct NoAcquire { void acquire(T*) - { - } + {} + protected: ~NoAcquire() - { - } + {} }; template @@ -45,10 +43,10 @@ struct AcquireByProtect Assert(object && "Object passed to protect can't be NULL."); JSValueProtect(object->getContext(), object->getObject()); } + protected: ~AcquireByProtect() - { - } + {} }; template @@ -58,10 +56,10 @@ struct NoRelease { (void)object; } + protected: ~NoRelease() - { - } + {} }; template @@ -71,10 +69,10 @@ struct ReleaseByDelete { delete object->getObject(); } + protected: ~ReleaseByDelete() - { - } + {} }; template @@ -85,10 +83,10 @@ struct ReleaseByUnprotect Assert(object && "Object passed to unprotect can't be NULL."); JSValueUnprotect(object->getContext(), object->getObject()); } + protected: ~ReleaseByUnprotect() - { - } + {} }; template @@ -97,8 +95,7 @@ struct NoOwnership : protected NoAcquire, { protected: ~NoOwnership() - { - } + {} }; template @@ -107,8 +104,7 @@ struct OwnershipByAcquisition : protected NoAcquire, { protected: ~OwnershipByAcquisition() - { - } + {} }; template @@ -117,8 +113,7 @@ struct OwnershipByProtection : protected AcquireByProtect, { protected: ~OwnershipByProtection() - { - } + {} }; template::value(object) && "Object is NULL."); + Assert(!Commons::IsNull::value( + object) && "Object is NULL."); acquire(this); } @@ -198,8 +194,7 @@ class PrivateObject : private DPL::Noncopyable * Destroys instance of the object. */ virtual ~PrivateObject() - { - } + {} /** * Gets stored JS context. @@ -237,7 +232,6 @@ struct PrivateObjectT { typedef PrivateObject Type; }; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/ScopedJSStringRef.cpp b/src/CommonsJavaScript/ScopedJSStringRef.cpp index a16bbcb..2f0c17f 100644 --- a/src/CommonsJavaScript/ScopedJSStringRef.cpp +++ b/src/CommonsJavaScript/ScopedJSStringRef.cpp @@ -17,10 +17,8 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - ScopedJSStringRef::ScopedJSStringRef(JSStringRef ref) : m_ref(ref) -{ -} +{} ScopedJSStringRef::~ScopedJSStringRef() { diff --git a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp index fe20f9c..87111fd 100644 --- a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp +++ b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp @@ -17,16 +17,11 @@ #include namespace WrtDeviceApis { - namespace CommonsJavaScript { - - AceSecurityStatus aceCheckAccessSimple( - WrtDeviceApis::Commons::AceFunction aceFunction) + WrtDeviceApis::Commons::AceFunction aceFunction) { - return aceCheckAccess2>(aceFunction); + return aceCheckAccess2 >(aceFunction); } - } - } diff --git a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h index ad93dd8..dcdd452 100644 --- a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h +++ b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h @@ -26,7 +26,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - enum class AceSecurityStatus { AccessGranted, @@ -39,7 +38,7 @@ class DefaultArgsVerifier { public: void operator()(WrtDeviceApis::Commons::AceFunction& aceFunction, - Args && ... args) const + Args && ... args) const { static_assert( WrtDeviceApis::Commons::AlwaysFalse::value, @@ -52,15 +51,14 @@ class DefaultArgsVerifier<> { public: void operator()(WrtDeviceApis::Commons::AceFunction& /*aceFunction*/) const - { - } + {} }; template AceSecurityStatus aceCheckAccess2( - WrtDeviceApis::Commons::AceFunction aceFunction, - Args && ... args) + WrtDeviceApis::Commons::AceFunction aceFunction, + Args && ... args) { using namespace WrtDeviceApis::Commons; @@ -68,9 +66,10 @@ AceSecurityStatus aceCheckAccess2( argsVerify(aceFunction, args ...); Try { - if (!(WrtAccessSingleton::Instance().checkAccessControl(aceFunction))) { - LogDebug("Function is not allowed to run"); - return AceSecurityStatus::AccessDenied; + if (!(WrtAccessSingleton::Instance().checkAccessControl(aceFunction))) + { + LogDebug("Function is not allowed to run"); + return AceSecurityStatus::AccessDenied; } } Catch(WrtDeviceApis::Commons::OutOfRangeException) { @@ -83,12 +82,9 @@ AceSecurityStatus aceCheckAccess2( return AceSecurityStatus::AccessGranted; } - - //The simplest version AceSecurityStatus aceCheckAccessSimple( - WrtDeviceApis::Commons::AceFunction aceFunction); - + WrtDeviceApis::Commons::AceFunction aceFunction); } } diff --git a/src/CommonsJavaScript/Security/StaticDeclaration.h b/src/CommonsJavaScript/Security/StaticDeclaration.h index 736b14a..c089d50 100644 --- a/src/CommonsJavaScript/Security/StaticDeclaration.h +++ b/src/CommonsJavaScript/Security/StaticDeclaration.h @@ -29,30 +29,29 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - template -class StaticDeclarations : public DPL::Noncopyable +class StaticDeclarations : public DPL::Noncopyable { struct FunctionTriplet { const char* name; std::vector devCaps; std::vector features; }; - public: + public: typedef typename std::map ParamsMap; typedef std::map > > DeviceCapsMaps; + std::pair > > DeviceCapsMaps; typedef std::map FunctionsMap; typedef std::map - AceFunctionsMap; + AceFunctionsMap; typedef std::map > FeaturesMap; @@ -70,7 +69,7 @@ class StaticDeclarations : public DPL::Noncopyable * for given device capability id * */ static WrtDeviceApis::Commons::AceDeviceCapability - getDeviceCapabilityWithoutParams(const DeviceCapType& devCapsId) + getDeviceCapabilityWithoutParams(const DeviceCapType& devCapsId) { WrtDeviceApis::Commons::AceDeviceCapability deviceCap; auto it = m_deviceCaps.find(devCapsId); @@ -87,7 +86,7 @@ class StaticDeclarations : public DPL::Noncopyable * for given device capability id * */ static WrtDeviceApis::Commons::AceDeviceCapability - getDeviceCapability(const DeviceCapType& devCapsId) + getDeviceCapability(const DeviceCapType& devCapsId) { auto it = m_deviceCaps.find(devCapsId); @@ -109,11 +108,11 @@ class StaticDeclarations : public DPL::Noncopyable } static void addDeviceCapabilty( - const DeviceCapType& devCapsId, - WrtDeviceApis::Commons::AceFunction& aceFunction) + const DeviceCapType& devCapsId, + WrtDeviceApis::Commons::AceFunction& aceFunction) { aceFunction.deviceCapabilities.push_back( - getDeviceCapability(devCapsId)); + getDeviceCapability(devCapsId)); } /** @@ -135,16 +134,16 @@ class StaticDeclarations : public DPL::Noncopyable const std::string& value) { //get name of the deviceCaps - std::string devCapName = getDevCapNameById(devCapId) ; + std::string devCapName = getDevCapNameById(devCapId); std::string paramName = getParamName(paramId); //search throw all the device capabilities FOREACH(devCapIt, function.deviceCapabilities) { - if(devCapIt->devCapName == devCapName) { + if (devCapIt->devCapName == devCapName) { //device capability has been found //check params FOREACH(devParamIt, devCapIt->devCapParams) { - if(devParamIt->name == paramName) { + if (devParamIt->name == paramName) { devParamIt->value = value; return true; } @@ -160,7 +159,7 @@ class StaticDeclarations : public DPL::Noncopyable * To set param value function you may use setParamValue Function * */ static WrtDeviceApis::Commons::AceFunction getEmptyFunction( - const FunctionType& functionId) + const FunctionType& functionId) { WrtDeviceApis::Commons::AceFunction function; auto it = m_functions.find(functionId); @@ -168,7 +167,7 @@ class StaticDeclarations : public DPL::Noncopyable function.name = it->second.first; return function; - }; + } /** * The most useful Function @@ -178,7 +177,7 @@ class StaticDeclarations : public DPL::Noncopyable * To set param value function you may use setParamValue function * */ static WrtDeviceApis::Commons::AceFunction getSecurityFunction( - const FunctionType& functionId) + const FunctionType& functionId) { WrtDeviceApis::Commons::AceFunction function; auto it = m_functions.find(functionId); @@ -186,15 +185,15 @@ class StaticDeclarations : public DPL::Noncopyable function.name = it->second.name; - FOREACH (featIt, it->second.features) - function.features.push_back(std::string(*featIt)); + FOREACH(featIt, it->second.features) + function.features.push_back(std::string(*featIt)); FOREACH(devCapIt, it->second.devCaps) { function.deviceCapabilities.push_back( - getDeviceCapability(*devCapIt)); + getDeviceCapability(*devCapIt)); } return function; - }; + } /** * To create static map @@ -204,7 +203,7 @@ class StaticDeclarations : public DPL::Noncopyable FOREACH(functionIt, m_functions) { m_aceFunctions[functionIt->first] = - getSecurityFunction(functionIt->first); + getSecurityFunction(functionIt->first); } } @@ -223,10 +222,10 @@ class StaticDeclarations : public DPL::Noncopyable strndup(featureIt->first.c_str(), featureIt->first.size() + 1); mapping->features[i].devCaps.devCapsCount = - featureIt->second.size(); + featureIt->second.size(); mapping->features[i].devCaps.deviceCaps = - new char*[mapping->features[i].devCaps.devCapsCount]; + new char*[mapping->features[i].devCaps.devCapsCount]; for (size_t j = 0; j < mapping->features[i].devCaps.devCapsCount; @@ -253,16 +252,14 @@ class StaticDeclarations : public DPL::Noncopyable devcaps_t* ret = NULL; - for (size_t i = 0; i < feats->featuresCount ; ++i) - { + for (size_t i = 0; i < feats->featuresCount; ++i) { Assert(feats->features && feats->features[i].feature_name && "NULL api feature in feature mapping"); std::string feat(feats->features[i].feature_name); - if (feature == feat) - { + if (feature == feat) { ret = &(feats->features[i].devCaps); break; } @@ -273,27 +270,22 @@ class StaticDeclarations : public DPL::Noncopyable static void featuresDeinitializer(feature_mapping_t* mapping) { - if (mapping) - { - if (mapping->features) - { - for (size_t i = 0; i < mapping->featuresCount; ++i) - { + if (mapping) { + if (mapping->features) { + for (size_t i = 0; i < mapping->featuresCount; ++i) { free(mapping->features[i].feature_name); devcaps_t& dc = mapping->features[i].devCaps; - if (dc.deviceCaps) - { - for (size_t j = 0; j < dc.devCapsCount; ++j) - { + if (dc.deviceCaps) { + for (size_t j = 0; j < dc.devCapsCount; ++j) { free(dc.deviceCaps[j]); } - delete []dc.deviceCaps; + delete[] dc.deviceCaps; } } - delete []mapping->features; + delete[] mapping->features; } delete mapping; } @@ -301,16 +293,15 @@ class StaticDeclarations : public DPL::Noncopyable static void getMappingInterface(feature_mapping_interface_t *mapping) { - if (mapping) - { + if (mapping) { mapping->featGetter = - StaticDeclarations::getFeaturesToDevCapMapping; + StaticDeclarations::getFeaturesToDevCapMapping; mapping->dcGetter = StaticDeclarations::devcapsGetter; mapping->release = StaticDeclarations::featuresDeinitializer; } } -private: + private: static ParamsMap m_params; static DeviceCapsMaps m_deviceCaps; static FunctionsMap m_functions; @@ -318,7 +309,6 @@ private: static FeaturesMap m_features; }; - } } diff --git a/src/CommonsJavaScript/SecurityExceptions.h b/src/CommonsJavaScript/SecurityExceptions.h old mode 100755 new mode 100644 index 47a06b0..ffc111b --- a/src/CommonsJavaScript/SecurityExceptions.h +++ b/src/CommonsJavaScript/SecurityExceptions.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - /** * synchronously checks access status and throws JS Security exception if * necessary @@ -68,7 +67,6 @@ namespace CommonsJavaScript { break; \ } \ } while (0) - } } #endif /*WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_SECURITYEXCEPTIONS_H_ */ diff --git a/src/CommonsJavaScript/SupportPendingOperation.h b/src/CommonsJavaScript/SupportPendingOperation.h index 59c1987..05567e6 100644 --- a/src/CommonsJavaScript/SupportPendingOperation.h +++ b/src/CommonsJavaScript/SupportPendingOperation.h @@ -26,29 +26,30 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - template class SupportPendingOperation { -public: - virtual T getPendingOperation() const { + public: + virtual T getPendingOperation() const + { return *m_operation; } - virtual void setPendingOperation(const T& operation){ + virtual void setPendingOperation(const T& operation) + { m_operation = operation; } - bool checkPendingOperation() const{ + bool checkPendingOperation() const + { return !m_operation.IsNull(); } virtual ~SupportPendingOperation(){} -protected: + protected: DPL::Optional m_operation; }; - } } diff --git a/src/CommonsJavaScript/Utils.h b/src/CommonsJavaScript/Utils.h index ae59476..d8b8f95 100644 --- a/src/CommonsJavaScript/Utils.h +++ b/src/CommonsJavaScript/Utils.h @@ -36,7 +36,7 @@ namespace CommonsJavaScript { */ template JSObjectRef makePendingOperation(JSContextRef context, - const DPL::SharedPtr& event) + const DPL::SharedPtr& event) { Commons::IEventControllerPtr eventController = DPL::StaticPointerCast(event); @@ -48,10 +48,10 @@ JSObjectRef makePendingOperation(JSContextRef context, template JSObjectRef makeExtCancelSupportedPendingOperation( - JSContextRef context, - const DPL::SharedPtr& event, - const DPL::SharedPtr >& - cancel) + JSContextRef context, + const DPL::SharedPtr& event, + const DPL::SharedPtr >& + cancel) { IJSPendingOperationPrivateObject* pendingOperation = new IJSExtCancelPendingOperationPrivateObject(event, cancel); diff --git a/src/CommonsJavaScript/Validator.cpp b/src/CommonsJavaScript/Validator.cpp index 43b2c84..ef664e0 100644 --- a/src/CommonsJavaScript/Validator.cpp +++ b/src/CommonsJavaScript/Validator.cpp @@ -21,9 +21,8 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - Validator::Validator(JSContextRef context, - JSValueRef* exception) : + JSValueRef* exception) : m_context(context), m_exception(exception) { @@ -31,15 +30,15 @@ Validator::Validator(JSContextRef context, } Validator::~Validator() -{ -} +{} bool Validator::isDate(const JSValueRef& arg) { if (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, - arg) || !JSValueIsObject(m_context, arg)) { + arg) || !JSValueIsObject(m_context, arg)) + { return false; } Converter converter(m_context); @@ -65,7 +64,7 @@ Validator::isCallback(const JSValueRef& arg) bool Validator::checkArrayKeys(const std::vector &allowed, - JSValueRef argument) + JSValueRef argument) { if (argument == NULL) { return true; @@ -95,10 +94,12 @@ Validator::checkArrayKeys(const std::vector &allowed, found = false; for (std::list::const_iterator it = allowedJS.begin(); it != allowedJS.end(); - it++) { + it++) + { if (JSStringIsEqual(*it, JSPropertyNameArrayGetNameAtIndex(jsProps, - i))) { + i))) + { found = true; break; } @@ -126,6 +127,5 @@ bool Validator::isNullOrUndefined(const JSValueRef& arg) return (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, arg)); } - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/CommonsJavaScript/Validator.h b/src/CommonsJavaScript/Validator.h index c015fba..6a89550 100644 --- a/src/CommonsJavaScript/Validator.h +++ b/src/CommonsJavaScript/Validator.h @@ -26,12 +26,11 @@ namespace WrtDeviceApis { namespace CommonsJavaScript { - class Validator : private DPL::Noncopyable { public: explicit Validator(JSContextRef context, - JSValueRef* exception = NULL); + JSValueRef* exception = NULL); virtual ~Validator(); /** @@ -55,7 +54,7 @@ class Validator : private DPL::Noncopyable * @return true when object's properties are subset of allowed */ bool checkArrayKeys(const std::vector &allowed, - JSValueRef argument); + JSValueRef argument); bool isNullOrUndefined(const JSValueRef& arg); @@ -81,7 +80,7 @@ class ValidatorFactory : private DPL::Noncopyable * @return Converter object. */ static ValidatorType getValidator(JSContextRef context, - JSValueRef* exception = NULL) + JSValueRef* exception = NULL) { C* convert = new C(context, exception); return ValidatorType(convert); @@ -93,7 +92,6 @@ class ValidatorFactory : private DPL::Noncopyable typedef ValidatorFactory BasicValidatorFactory; typedef BasicValidatorFactory::ValidatorType BasicValidator; - } // CommonsJavaScript } // WrtDeviceApis diff --git a/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.cpp b/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.cpp index 048c149..fe6bf89 100644 --- a/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.cpp +++ b/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.cpp @@ -38,24 +38,24 @@ using namespace WrtDeviceApis::SoftKeyboardChangeEvent::Api; #define SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_HEIGHT "height" #define CATCH_EXCEPTION_CONVERSION \ - Catch(Commons::ConversionException) {\ - LogError("Error on conversion");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::ConversionException) { \ + LogError("Error on conversion"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_NULL_PTR \ - Catch(Commons::NullPointerException) {\ - LogError("Error on pointer, null value");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::NullPointerException) { \ + LogError("Error on pointer, null value"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_PLATFORM_ERROR \ - Catch(Commons::PlatformException){\ - LogError("PlatformException occured");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::PlatformException){ \ + LogError("PlatformException occured"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } namespace WrtPlugins { @@ -81,11 +81,14 @@ JSClassDefinition JSSoftKeyboardChangeEvent::m_classInfo = { }; JSStaticValue JSSoftKeyboardChangeEvent::m_property[] = { - { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_STATE, JSSoftKeyboardChangeEvent::getState, + { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_STATE, + JSSoftKeyboardChangeEvent::getState, 0, kJSPropertyAttributeReadOnly }, - { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_WIDTH, JSSoftKeyboardChangeEvent::getWidth, + { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_WIDTH, + JSSoftKeyboardChangeEvent::getWidth, 0, kJSPropertyAttributeReadOnly }, - { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_HEIGHT, JSSoftKeyboardChangeEvent::getHeight, + { SOFTKEYBOARD_CHANGE_EVENT_PROPERTY_HEIGHT, + JSSoftKeyboardChangeEvent::getHeight, 0, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -103,14 +106,17 @@ const JSClassDefinition* JSSoftKeyboardChangeEvent::getClassInfo() return &m_classInfo; } -JSClassRef JSSoftKeyboardChangeEvent::m_jsClassRef = JSClassCreate(JSSoftKeyboardChangeEvent::getClassInfo()); +JSClassRef JSSoftKeyboardChangeEvent::m_jsClassRef = JSClassCreate( + JSSoftKeyboardChangeEvent::getClassInfo()); -void JSSoftKeyboardChangeEvent::initialize(JSContextRef context, JSObjectRef object) +void JSSoftKeyboardChangeEvent::initialize(JSContextRef context, + JSObjectRef object) { LogDebug("entered"); JSSoftKeyboardChangeEventPrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate( + object)); Assert(priv && "Missing private object"); } @@ -119,18 +125,18 @@ void JSSoftKeyboardChangeEvent::finalize(JSObjectRef object) { LogDebug("entered"); JSSoftKeyboardChangeEventPrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate( + object)); delete priv; LogDebug("private object is realised"); - } JSValueRef JSSoftKeyboardChangeEvent::getState( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered!"); @@ -141,14 +147,14 @@ JSValueRef JSSoftKeyboardChangeEvent::getState( } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSSoftKeyboardChangeEvent::getWidth( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered!"); @@ -159,14 +165,14 @@ JSValueRef JSSoftKeyboardChangeEvent::getWidth( } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSSoftKeyboardChangeEvent::getHeight( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -177,13 +183,15 @@ JSValueRef JSSoftKeyboardChangeEvent::getHeight( } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } -ISoftKeyboardChangeEventPtr JSSoftKeyboardChangeEvent::getPrivateObject(JSObjectRef arg) +ISoftKeyboardChangeEventPtr JSSoftKeyboardChangeEvent::getPrivateObject( + JSObjectRef arg) { JSSoftKeyboardChangeEventPrivateObject* priv = - static_cast(JSObjectGetPrivate(arg)); + static_cast(JSObjectGetPrivate( + arg)); if (!priv) { LogError("Private object not initialized"); @@ -197,6 +205,5 @@ ISoftKeyboardChangeEventPtr JSSoftKeyboardChangeEvent::getPrivateObject(JSObject #undef CATCH_EXCEPTION_CONVERSION #undef CATCH_EXCEPTION_NULL_PTR #undef CATCH_EXCEPTION_PLATFORM_ERROR - } } diff --git a/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h b/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h index f9dce7f..7471abf 100644 --- a/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h +++ b/src/js-overlay/JSClass/JSSoftKeyboardChangeEvent.h @@ -30,10 +30,10 @@ namespace WrtPlugins { namespace Tizen { - typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< - WrtDeviceApis::SoftKeyboardChangeEvent::Api::ISoftKeyboardChangeEventPtr>::Type - JSSoftKeyboardChangeEventPrivateObject; + WrtDeviceApis::SoftKeyboardChangeEvent::Api::ISoftKeyboardChangeEventPtr>:: + Type +JSSoftKeyboardChangeEventPrivateObject; class JSSoftKeyboardChangeEvent { @@ -65,7 +65,8 @@ class JSSoftKeyboardChangeEvent static JSStaticValue m_property[]; /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -73,25 +74,26 @@ class JSSoftKeyboardChangeEvent // getters for properties static JSValueRef getState( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getWidth( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getHeight( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); - - static WrtDeviceApis::SoftKeyboardChangeEvent::Api::ISoftKeyboardChangeEventPtr - getPrivateObject(JSObjectRef arg); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static WrtDeviceApis::SoftKeyboardChangeEvent::Api:: + ISoftKeyboardChangeEventPtr + getPrivateObject(JSObjectRef arg); }; } // Tizen } // WrtPlugins diff --git a/src/js-overlay/JSClass/JSStorageEvent.cpp b/src/js-overlay/JSClass/JSStorageEvent.cpp index 09c49ce..05444e5 100644 --- a/src/js-overlay/JSClass/JSStorageEvent.cpp +++ b/src/js-overlay/JSClass/JSStorageEvent.cpp @@ -41,31 +41,31 @@ using namespace WrtDeviceApis::StorageEvent::Api; #define WRT_STORAGE_EVENT_PROPERTY_STORAGE_AREA "storageArea" #define CATCH_EXCEPTION_CONVERSION \ - Catch(Commons::ConversionException) {\ - LogError("Error on conversion");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::ConversionException) { \ + LogError("Error on conversion"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_NULL_PTR \ - Catch(Commons::NullPointerException) {\ - LogError("Error on pointer, null value");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::NullPointerException) { \ + LogError("Error on pointer, null value"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_PLATFORM_ERROR \ - Catch(Commons::PlatformException){\ - LogError("PlatformException occured");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::PlatformException){ \ + LogError("PlatformException occured"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_SECURITY \ - Catch(Commons::SecurityException){\ - LogError("Security exception occured");\ - return JSDOMExceptionFactory::\ - SecurityException.make(context, exception);\ + Catch(Commons::SecurityException){ \ + LogError("Security exception occured"); \ + return JSDOMExceptionFactory:: \ + SecurityException.make(context, exception); \ } namespace WrtPlugins { @@ -117,7 +117,8 @@ const JSClassDefinition* JSStorageEvent::getClassInfo() return &m_classInfo; } -JSClassRef JSStorageEvent::m_jsClassRef = JSClassCreate(JSStorageEvent::getClassInfo()); +JSClassRef JSStorageEvent::m_jsClassRef = JSClassCreate( + JSStorageEvent::getClassInfo()); void JSStorageEvent::initialize(JSContextRef context, JSObjectRef object) @@ -138,14 +139,13 @@ void JSStorageEvent::finalize(JSObjectRef object) delete priv; LogDebug("private object is realised"); - } JSValueRef JSStorageEvent::getKey( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -154,19 +154,18 @@ JSValueRef JSStorageEvent::getKey( Converter converter(context); return converter.toJSValueRef(getPrivateObject(object)->getKey()); - } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSStorageEvent::getOldValue( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -176,24 +175,23 @@ JSValueRef JSStorageEvent::getOldValue( DPL::OptionalString oldValue = getPrivateObject(object)->getOldValue(); - if(!oldValue) { + if (!oldValue) { return JSValueMakeNull(context); } else { return converter.toJSValueRef(DPL::ToUTF8String(*oldValue)); } - } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSStorageEvent::getNewValue( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -203,24 +201,23 @@ JSValueRef JSStorageEvent::getNewValue( DPL::OptionalString newValue = getPrivateObject(object)->getNewValue(); - if(!newValue) { + if (!newValue) { return JSValueMakeNull(context); } else { return converter.toJSValueRef(DPL::ToUTF8String(*newValue)); } - } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSStorageEvent::getUrl( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -229,17 +226,16 @@ JSValueRef JSStorageEvent::getUrl( Converter converter(context); return converter.toJSValueRef(getPrivateObject(object)->getUrl()); - } CATCH_EXCEPTION_CONVERSION - CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_NULL_PTR } JSValueRef JSStorageEvent::getStorageArea( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -251,7 +247,7 @@ JSValueRef JSStorageEvent::getStorageArea( CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } IStorageEventPtr JSStorageEvent::getPrivateObject(JSObjectRef arg) @@ -272,6 +268,5 @@ IStorageEventPtr JSStorageEvent::getPrivateObject(JSObjectRef arg) #undef CATCH_EXCEPTION_NULL_PTR #undef CATCH_EXCEPTION_PLATFORM_ERROR #undef CATCH_EXCEPTION_SECURITY - } } diff --git a/src/js-overlay/JSClass/JSStorageEvent.h b/src/js-overlay/JSClass/JSStorageEvent.h index 67bde4d..e1bb899 100644 --- a/src/js-overlay/JSClass/JSStorageEvent.h +++ b/src/js-overlay/JSClass/JSStorageEvent.h @@ -30,10 +30,9 @@ namespace WrtPlugins { namespace W3C { - typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< WrtDeviceApis::StorageEvent::Api::IStorageEventPtr>::Type - JSStorageEventPrivateObject; +JSStorageEventPrivateObject; class JSStorageEvent { @@ -53,7 +52,7 @@ class JSStorageEvent * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -66,7 +65,8 @@ class JSStorageEvent static JSStaticValue m_property[]; /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -74,33 +74,33 @@ class JSStorageEvent // getters for properties static JSValueRef getKey( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getOldValue( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getNewValue( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getUrl( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getStorageArea( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static WrtDeviceApis::StorageEvent::Api::IStorageEventPtr - getPrivateObject(JSObjectRef arg); + getPrivateObject(JSObjectRef arg); }; } // W3C } // WrtPlugins diff --git a/src/js-overlay/JSClass/JSTizenServiceEvent.cpp b/src/js-overlay/JSClass/JSTizenServiceEvent.cpp index ac4c5ad..77be7eb 100644 --- a/src/js-overlay/JSClass/JSTizenServiceEvent.cpp +++ b/src/js-overlay/JSClass/JSTizenServiceEvent.cpp @@ -38,31 +38,31 @@ using namespace WrtDeviceApis::TizenServiceEvent::Api; #define TIZEN_SERVICE_EVENT_PROPERTY_BUNDLE "__bundle" #define CATCH_EXCEPTION_CONVERSION \ - Catch(Commons::ConversionException) {\ - LogError("Error on conversion");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::ConversionException) { \ + LogError("Error on conversion"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_NULL_PTR \ - Catch(Commons::NullPointerException) {\ - LogError("Error on pointer, null value");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::NullPointerException) { \ + LogError("Error on pointer, null value"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_PLATFORM_ERROR \ - Catch(Commons::PlatformException){\ - LogError("PlatformException occured");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::PlatformException){ \ + LogError("PlatformException occured"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_SECURITY \ - Catch(Commons::SecurityException){\ - LogError("Security exception occured");\ - return JSDOMExceptionFactory::\ - SecurityException.make(context, exception);\ + Catch(Commons::SecurityException){ \ + LogError("Security exception occured"); \ + return JSDOMExceptionFactory:: \ + SecurityException.make(context, exception); \ } namespace WrtPlugins { @@ -108,7 +108,8 @@ const JSClassDefinition* JSTizenServiceEvent::getClassInfo() return &m_classInfo; } -JSClassRef JSTizenServiceEvent::m_jsClassRef = JSClassCreate(JSTizenServiceEvent::getClassInfo()); +JSClassRef JSTizenServiceEvent::m_jsClassRef = JSClassCreate( + JSTizenServiceEvent::getClassInfo()); void JSTizenServiceEvent::initialize(JSContextRef context, JSObjectRef object) @@ -116,7 +117,8 @@ void JSTizenServiceEvent::initialize(JSContextRef context, LogDebug("entered"); JSTizenServiceEventPrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate( + object)); Assert(priv && "Missing private object"); } @@ -125,18 +127,18 @@ void JSTizenServiceEvent::finalize(JSObjectRef object) { LogDebug("entered"); JSTizenServiceEventPrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate( + object)); delete priv; LogDebug("private object is realised"); - } JSValueRef JSTizenServiceEvent::getScale( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -148,14 +150,14 @@ JSValueRef JSTizenServiceEvent::getScale( CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSTizenServiceEvent::getBundle( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -167,7 +169,7 @@ JSValueRef JSTizenServiceEvent::getBundle( CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } ITizenServiceEventPtr JSTizenServiceEvent::getPrivateObject(JSObjectRef arg) @@ -188,6 +190,5 @@ ITizenServiceEventPtr JSTizenServiceEvent::getPrivateObject(JSObjectRef arg) #undef CATCH_EXCEPTION_NULL_PTR #undef CATCH_EXCEPTION_PLATFORM_ERROR #undef CATCH_EXCEPTION_SECURITY - } } diff --git a/src/js-overlay/JSClass/JSTizenServiceEvent.h b/src/js-overlay/JSClass/JSTizenServiceEvent.h index cb7fbb3..1c34075 100644 --- a/src/js-overlay/JSClass/JSTizenServiceEvent.h +++ b/src/js-overlay/JSClass/JSTizenServiceEvent.h @@ -30,10 +30,9 @@ namespace WrtPlugins { namespace Tizen { - typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< WrtDeviceApis::TizenServiceEvent::Api::ITizenServiceEventPtr>::Type - JSTizenServiceEventPrivateObject; +JSTizenServiceEventPrivateObject; class JSTizenServiceEvent { @@ -53,7 +52,7 @@ class JSTizenServiceEvent * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -66,7 +65,8 @@ class JSTizenServiceEvent static JSStaticValue m_property[]; /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -74,19 +74,19 @@ class JSTizenServiceEvent // getters for properties static JSValueRef getScale( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static JSValueRef getBundle( - JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); static WrtDeviceApis::TizenServiceEvent::Api::ITizenServiceEventPtr - getPrivateObject(JSObjectRef arg); + getPrivateObject(JSObjectRef arg); }; } // Tizen } // WrtPlugins diff --git a/src/js-overlay/js_function_manager.cpp b/src/js-overlay/js_function_manager.cpp index d1be598..dfa55b2 100644 --- a/src/js-overlay/js_function_manager.cpp +++ b/src/js-overlay/js_function_manager.cpp @@ -39,77 +39,70 @@ const char* JSHOOK_NAME = "jsHook"; const char* ADD_EVENT_LISTENER_NAME = "addEventListener"; } -namespace JavaScriptFunctions -{ +namespace JavaScriptFunctions { //options - class_definition_options_t jsHookfunctionsOptions = - { - JS_FUNCTION, - CREATE_INSTANCE, - NONE_NOTICE, - USE_OVERLAYED, //ignored - NULL, - NULL, - reinterpret_cast(JSCFunctions::JavaScriptHookProc) - }; - - class_definition_options_t jsPrintfunctionsOptions = - { - JS_FUNCTION, - CREATE_INSTANCE, - NONE_NOTICE, - USE_OVERLAYED, //ignored - NULL, - NULL, - reinterpret_cast(JSCFunctions::JavaScriptPrintProc) - }; - - class_definition_options_t addEventListenerOptions = - { - JS_FUNCTION, - CREATE_INSTANCE, - ALWAYS_NOTICE, - OVERLAYED_BEFORE_ORIGINAL, - IFrameSupport::RegisterAddEventListener, - NULL, - reinterpret_cast(AddEventListenerSupport::AddEventListener) - }; - - js_entity_definition_t jsPrint = - { - JSGLOBAL_OBJECT, - JSPRINT_NAME, - "", - NULL, - NULL, - &jsPrintfunctionsOptions - }; - - js_entity_definition_t jsHook = - { - JSGLOBAL_OBJECT, - JSHOOK_NAME, - "", - NULL, - NULL, - &jsHookfunctionsOptions - }; - - js_entity_definition_t addEventListener = - { - JSGLOBAL_OBJECT, - ADD_EVENT_LISTENER_NAME, - "", - NULL, - NULL, - &addEventListenerOptions - }; - const js_entity_definition_ptr_t jsPrintPtr = &jsPrint; - const js_entity_definition_ptr_t jsHookPtr = &jsHook; - const js_entity_definition_ptr_t addEventListenerPtr = &addEventListener; +class_definition_options_t jsHookfunctionsOptions = { + JS_FUNCTION, + CREATE_INSTANCE, + NONE_NOTICE, + USE_OVERLAYED, //ignored + NULL, + NULL, + reinterpret_cast(JSCFunctions::JavaScriptHookProc) +}; + +class_definition_options_t jsPrintfunctionsOptions = { + JS_FUNCTION, + CREATE_INSTANCE, + NONE_NOTICE, + USE_OVERLAYED, //ignored + NULL, + NULL, + reinterpret_cast(JSCFunctions::JavaScriptPrintProc) +}; + +class_definition_options_t addEventListenerOptions = { + JS_FUNCTION, + CREATE_INSTANCE, + ALWAYS_NOTICE, + OVERLAYED_BEFORE_ORIGINAL, + IFrameSupport::RegisterAddEventListener, + NULL, + reinterpret_cast(AddEventListenerSupport:: + AddEventListener) +}; + +js_entity_definition_t jsPrint = { + JSGLOBAL_OBJECT, + JSPRINT_NAME, + "", + NULL, + NULL, + &jsPrintfunctionsOptions +}; + +js_entity_definition_t jsHook = { + JSGLOBAL_OBJECT, + JSHOOK_NAME, + "", + NULL, + NULL, + &jsHookfunctionsOptions +}; + +js_entity_definition_t addEventListener = { + JSGLOBAL_OBJECT, + ADD_EVENT_LISTENER_NAME, + "", + NULL, + NULL, + &addEventListenerOptions +}; +const js_entity_definition_ptr_t jsPrintPtr = &jsPrint; +const js_entity_definition_ptr_t jsHookPtr = &jsHook; +const js_entity_definition_ptr_t addEventListenerPtr = &addEventListener; } - bool JsFunctionManager::initialize() { LogInfo("JSObjectDeclaration for js functions are intialized"); diff --git a/src/js-overlay/js_iframe_support.cpp b/src/js-overlay/js_iframe_support.cpp index 782fc0e..e8ae4b1 100644 --- a/src/js-overlay/js_iframe_support.cpp +++ b/src/js-overlay/js_iframe_support.cpp @@ -28,29 +28,28 @@ namespace WrtPlugins { namespace W3C { - IFrameSupport::IFramesContainer IFrameSupport::m_iframesObject = IFrameSupport::IFramesContainer(); - void IFrameSupport::RegisterWidget(java_script_context_t global_context, js_object_instance_t iframe, js_object_instance_t object) { LogDebug("New widget instance registered"); - LogDebug("iframe: " << iframe ); - LogDebug("object: " << object ); + LogDebug("iframe: " << iframe); + LogDebug("object: " << object); getIFrameData(static_cast(iframe))->widget = static_cast(object); } -void IFrameSupport::RegisterAddEventListener(java_script_context_t global_context, - js_object_instance_t iframe, - js_object_instance_t object) +void IFrameSupport::RegisterAddEventListener( + java_script_context_t global_context, + js_object_instance_t iframe, + js_object_instance_t object) { LogDebug("New addEventListener instance registered"); - LogDebug("iframe: " << iframe ); - LogDebug("object: " << object ); + LogDebug("iframe: " << iframe); + LogDebug("object: " << object); getIFrameData(static_cast(iframe))->addEventListener = static_cast(object); } @@ -59,8 +58,7 @@ JSObjectRef IFrameSupport::getIFrameObjectForWidget(JSObjectRef widgetObject) { FOREACH(it, m_iframesObject) { - if(it->second->widget == widgetObject) - { + if (it->second->widget == widgetObject) { LogDebug("iframe found"); return it->first; } @@ -72,12 +70,11 @@ JSObjectRef IFrameSupport::getIFrameObjectForWidget(JSObjectRef widgetObject) IFrameDataPtr IFrameSupport::getIFrameData(JSObjectRef iframe) { auto it = m_iframesObject.find(iframe); - if(it != m_iframesObject.end()){ + if (it != m_iframesObject.end()) { return it->second; } return m_iframesObject[iframe] = IFrameDataPtr(new IFrameData()); } - } } diff --git a/src/js-overlay/js_iframe_support.h b/src/js-overlay/js_iframe_support.h index 92f58f8..de07932 100644 --- a/src/js-overlay/js_iframe_support.h +++ b/src/js-overlay/js_iframe_support.h @@ -31,7 +31,6 @@ namespace WrtPlugins { namespace W3C { - struct IFrameData { IFrameData() : widget(0), addEventListener(0){} @@ -41,7 +40,6 @@ struct IFrameData }; typedef std::shared_ptr IFrameDataPtr; - class IFrameSupport { public: @@ -64,7 +62,6 @@ class IFrameSupport private: static IFrameDataPtr getIFrameData(JSObjectRef iframe); }; - } } diff --git a/src/js-overlay/js_overlay_addEventListener.cpp b/src/js-overlay/js_overlay_addEventListener.cpp index c14fe5f..a97d60d 100644 --- a/src/js-overlay/js_overlay_addEventListener.cpp +++ b/src/js-overlay/js_overlay_addEventListener.cpp @@ -22,7 +22,6 @@ * @brief */ - #include #include #include @@ -33,25 +32,26 @@ namespace WrtPlugins { namespace W3C { - const std::string storageEventName = "storage"; const std::string appServiceEventName = "appservice"; const std::string softKeyboardChangeEventName = "softkeyboardchange"; AddEventListenerSupport::IFramesListeners - AddEventListenerSupport::m_listeners = - AddEventListenerSupport::IFramesListeners(); +AddEventListenerSupport::m_listeners = + AddEventListenerSupport::IFramesListeners(); JSContextRef AddEventListenerSupport::m_context = NULL; void AddEventListenerSupport::initialize(JSContextRef context) { - if(!m_context) m_context = context; + if (!m_context) { + m_context = context; + } } void AddEventListenerSupport::deinitialize() { - if(!m_context) { + if (!m_context) { LogDebug("Not yet initialized"); } @@ -59,18 +59,18 @@ void AddEventListenerSupport::deinitialize() m_context = NULL; } -bool AddEventListenerSupport::isInitialized() +bool AddEventListenerSupport::isInitialized() { - return m_context!=NULL; + return m_context != NULL; } JSValueRef AddEventListenerSupport:: -AddEventListener(JSContextRef context, - JSObjectRef object, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) + AddEventListener(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) { LogDebug("Add event listener invoked"); LogDebug("This(iframe?):" << thisObject); @@ -82,12 +82,13 @@ AddEventListener(JSContextRef context, } std::string eventName = WrtDeviceApis::CommonsJavaScript:: - Converter(context).toString(arguments[0]); + Converter(context).toString(arguments[0]); LogDebug("Event name: " << eventName); - if(eventName != storageEventName && - eventName != appServiceEventName && - eventName != softKeyboardChangeEventName) { + if (eventName != storageEventName && + eventName != appServiceEventName && + eventName != softKeyboardChangeEventName) + { LogDebug("Event type not supported"); return JSValueMakeUndefined(context); } @@ -97,8 +98,7 @@ AddEventListener(JSContextRef context, JSValueToObject(m_context, arguments[1], NULL); - if(!JSObjectIsFunction(m_context, objectCb)) - { + if (!JSObjectIsFunction(m_context, objectCb)) { LogError("JS object is not a function"); return JSValueMakeUndefined(context); } @@ -108,7 +108,7 @@ AddEventListener(JSContextRef context, data.object = objectCb; data.thisObject = thisObject; - if(eventName == storageEventName) { + if (eventName == storageEventName) { data.eventType = StorageCustomEvent; } else if (eventName == appServiceEventName) { data.eventType = ServiceCustomEvent; @@ -122,7 +122,7 @@ AddEventListener(JSContextRef context, } void AddEventListenerSupport:: -CallStorageListenersFromDifferentIFrames( + CallStorageListenersFromDifferentIFrames( JSObjectRef iframe, const WrtDeviceApis::StorageEvent::Api::IStorageEventPtr& event) { @@ -131,7 +131,7 @@ CallStorageListenersFromDifferentIFrames( FOREACH(it, m_listeners) { - if(it->first == iframe){ + if (it->first == iframe) { continue; } @@ -141,7 +141,7 @@ CallStorageListenersFromDifferentIFrames( JSObjectRef eventObject = JSObjectMake(m_context, JSStorageEvent::getClassRef(), eventPriv); const size_t argc = 1; - JSValueRef argv[argc] = {eventObject}; + JSValueRef argv[argc] = { eventObject }; JSValueProtect(m_context, eventObject); @@ -150,7 +150,7 @@ CallStorageListenersFromDifferentIFrames( LogDebug("Call"); if (listener->eventType == - StorageCustomEvent) + StorageCustomEvent) { JSObjectCallAsFunction( m_context, @@ -166,13 +166,13 @@ CallStorageListenersFromDifferentIFrames( } LogDebug("Done"); -}; +} void AddEventListenerSupport:: -CallCustomEventListenersFromIFrame( - JSObjectRef iframe, - CustomEventType eventType, - JSObjectRef eventObject) + CallCustomEventListenersFromIFrame( + JSObjectRef iframe, + CustomEventType eventType, + JSObjectRef eventObject) { LogDebug("Invoked callbacks"); @@ -183,7 +183,7 @@ CallCustomEventListenersFromIFrame( } const size_t argc = 1; - JSValueRef argv[argc] = {eventObject}; + JSValueRef argv[argc] = { eventObject }; JSValueProtect(m_context, eventObject); FOREACH(listener, *it->second) @@ -201,17 +201,17 @@ CallCustomEventListenersFromIFrame( } JSValueUnprotect(m_context, eventObject); LogDebug("Done"); -}; +} AddEventListenerSupport::ListenersPtr -AddEventListenerSupport::getIFrameListeners(JSObjectRef iframe){ +AddEventListenerSupport::getIFrameListeners(JSObjectRef iframe) +{ auto it = m_listeners.find(iframe); - if(it != m_listeners.end()){ + if (it != m_listeners.end()) { return it->second; } return m_listeners[iframe] = ListenersPtr(new Listeners()); } - } } diff --git a/src/js-overlay/js_overlay_addEventListener.h b/src/js-overlay/js_overlay_addEventListener.h index d8ea74a..bfbd0b0 100644 --- a/src/js-overlay/js_overlay_addEventListener.h +++ b/src/js-overlay/js_overlay_addEventListener.h @@ -35,7 +35,6 @@ namespace WrtPlugins { namespace W3C { - class AddEventListenerSupport { public: @@ -62,8 +61,8 @@ class AddEventListenerSupport private: - struct CallbackData{ - CustomEventType eventType; + struct CallbackData { + CustomEventType eventType; JSObjectRef object; JSObjectRef thisObject; }; @@ -80,7 +79,6 @@ class AddEventListenerSupport private: static ListenersPtr getIFrameListeners(JSObjectRef iframe); }; - } } diff --git a/src/js-overlay/js_overlay_functions.cpp b/src/js-overlay/js_overlay_functions.cpp index 69b1263..8097d20 100644 --- a/src/js-overlay/js_overlay_functions.cpp +++ b/src/js-overlay/js_overlay_functions.cpp @@ -25,7 +25,6 @@ #include namespace JSCFunctions { - std::string ConvertJSStringToStdString(JSStringRef value) { int nSize = JSStringGetLength(value) + 1; @@ -60,19 +59,19 @@ JSValueRef JavaScriptPrintProc(JSContextRef context, } JSValueRef JavaScriptHookProc( - JSContextRef context, - JSObjectRef /*object*/, - JSObjectRef /*thisObject*/, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) + JSContextRef context, + JSObjectRef /*object*/, + JSObjectRef /*thisObject*/, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) { bool inError = false; if (argumentCount < 2 || argumentCount > 3 || !JSValueIsString(context, arguments[0]) || - !JSValueIsString(context, arguments[1])) { - + !JSValueIsString(context, arguments[1])) + { inError = true; } diff --git a/src/js-overlay/js_overlay_functions.h b/src/js-overlay/js_overlay_functions.h index 7dbad59..3c7f86a 100644 --- a/src/js-overlay/js_overlay_functions.h +++ b/src/js-overlay/js_overlay_functions.h @@ -39,7 +39,7 @@ JSValueRef JavaScriptHookProc( JSObjectRef /*thisObject*/, size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception); + JSValueRef * exception); } #endif diff --git a/src/js-overlay/js_overlay_support.cpp b/src/js-overlay/js_overlay_support.cpp index 7e2ca84..9bd809e 100644 --- a/src/js-overlay/js_overlay_support.cpp +++ b/src/js-overlay/js_overlay_support.cpp @@ -26,9 +26,7 @@ #include -namespace JSOverlaySupport -{ - +namespace JSOverlaySupport { class JSFunctionDispatcher { public: @@ -58,8 +56,6 @@ class JSFunctionDispatcher JSValueRef* exception); }; - - JSObjectPtr createWrappedFunction( JSGlobalContextRef ctx, const JSObjectPtr& originalFunction, @@ -92,8 +88,6 @@ JSObjectPtr createWrappedFunction( return JSObjectPtr(new JSObject(fun)); } - - JSClassDefinition JSFunctionDispatcher::m_classInfo = { 0, kJSClassAttributeNone, @@ -120,7 +114,6 @@ JSClassRef JSFunctionDispatcher::getClassRef() return classRef; } - void JSFunctionDispatcher::initialize(JSContextRef /*context*/, JSObjectRef /*object*/) { @@ -131,9 +124,8 @@ void JSFunctionDispatcher::finalize(JSObjectRef object) { LogDebug("finalize"); - PrivateData* priv = static_cast (JSObjectGetPrivate(object)); - if(priv) - { + PrivateData* priv = static_cast(JSObjectGetPrivate(object)); + if (priv) { JSValueUnprotect(priv->context, static_cast( priv->overlayFunction->getObject())); @@ -141,8 +133,6 @@ void JSFunctionDispatcher::finalize(JSObjectRef object) } } - - JSValueRef JSFunctionDispatcher::callAsFunction( JSContextRef context, JSObjectRef object, @@ -157,47 +147,40 @@ JSValueRef JSFunctionDispatcher::callAsFunction( JSFunctionDispatcher::PrivateData* priv = static_cast - (JSObjectGetPrivate(object)); + (JSObjectGetPrivate(object)); - if(!priv) - { + if (!priv) { LogError("Private object is NULL"); return result; } //call overlayed function - if (priv->overlayFunction->getObject()) - { + if (priv->overlayFunction->getObject()) { LogDebug("Overlayed function will be invoked..."); result = JSObjectCallAsFunction( - context, - static_cast( - priv->overlayFunction->getObject()), - thisObject, - argumentCount, - arguments, - exception); + context, + static_cast( + priv->overlayFunction->getObject()), + thisObject, + argumentCount, + arguments, + exception); } //call original function - if (priv->originalFunction->getObject()) - { + if (priv->originalFunction->getObject()) { LogDebug("Original function will be invoked.."); result = JSObjectCallAsFunction( - context, - static_cast( - priv->originalFunction->getObject()), - thisObject, - argumentCount, - arguments, - exception); + context, + static_cast( + priv->originalFunction->getObject()), + thisObject, + argumentCount, + arguments, + exception); } LogDebug("Done"); return result; } - - - - } diff --git a/src/js-overlay/js_overlay_support.h b/src/js-overlay/js_overlay_support.h index 3d7cd04..0cfb19b 100644 --- a/src/js-overlay/js_overlay_support.h +++ b/src/js-overlay/js_overlay_support.h @@ -29,8 +29,7 @@ #include #include -namespace JSOverlaySupport -{ +namespace JSOverlaySupport { JSObjectPtr createWrappedFunction( JSGlobalContextRef ctx, const JSObjectPtr& originalFunction, diff --git a/src/js-overlay/js_overlay_types.h b/src/js-overlay/js_overlay_types.h index c913f62..e47634f 100644 --- a/src/js-overlay/js_overlay_types.h +++ b/src/js-overlay/js_overlay_types.h @@ -28,7 +28,6 @@ namespace WrtPlugins { namespace W3C { - // If needed, enum for new custom event should be defined here enum CustomEventType { StorageCustomEvent, @@ -41,15 +40,13 @@ typedef struct SoftKeyboardChangeArgs { std::string state; // value is 'on' or 'off' int width; int height; - SoftKeyboardChangeArgs(): + SoftKeyboardChangeArgs() : width(0), height(0) - { - } + {} } SoftKeyboardChangeArgs; // If needed, argument structure of other custom events should be defined here - } // W3C } // WrtPlugins #endif // _WRT_PLUGINS_JS_OVERLAY_TYPES_H_ diff --git a/src/modules/API/DEPRACATED/AppLauncher/AppLauncherFactory.h b/src/modules/API/DEPRACATED/AppLauncher/AppLauncherFactory.h index 79db286..40874d3 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/AppLauncherFactory.h +++ b/src/modules/API/DEPRACATED/AppLauncher/AppLauncherFactory.h @@ -32,8 +32,8 @@ class AppLauncherFactory : private DPL::Noncopyable { private: AppLauncherFactory() - { - } + {} + public: static AppLauncherFactory& getInstance(); IAppLauncherManagerPtr createAppLauncherManagerObject(); diff --git a/src/modules/API/DEPRACATED/AppLauncher/EventGetDefaultApplication.h b/src/modules/API/DEPRACATED/AppLauncher/EventGetDefaultApplication.h index dbd4ef7..e55f865 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/EventGetDefaultApplication.h +++ b/src/modules/API/DEPRACATED/AppLauncher/EventGetDefaultApplication.h @@ -38,6 +38,7 @@ class EventGetDefaultApplication : public WrtPlugins::Platform::IEvent< std::string m_applicationFullPath; std::string m_applicationName; std::string m_mime; + public: void setMime(const std::string &value) { @@ -64,11 +65,9 @@ class EventGetDefaultApplication : public WrtPlugins::Platform::IEvent< return m_applicationName; } virtual void clearOnCancel() - { - } + {} EventGetDefaultApplication() - { - } + {} }; typedef DPL::SharedPtr diff --git a/src/modules/API/DEPRACATED/AppLauncher/EventGetInstalledApplications.h b/src/modules/API/DEPRACATED/AppLauncher/EventGetInstalledApplications.h index 2f2b343..65b89f6 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/EventGetInstalledApplications.h +++ b/src/modules/API/DEPRACATED/AppLauncher/EventGetInstalledApplications.h @@ -42,6 +42,7 @@ class EventGetInstalledApplications : public WrtPlugins::Platform::IEvent< std::vector m_applicationNames; std::map m_applicationTypesPath; std::map m_applicationTypesName; + public: void addApplicationTypeByName(const std::pair &value) @@ -80,11 +81,9 @@ class EventGetInstalledApplications : public WrtPlugins::Platform::IEvent< return m_applicationNames; } virtual void clearOnCancel() - { - } + {} EventGetInstalledApplications() - { - } + {} }; typedef DPL::SharedPtr diff --git a/src/modules/API/DEPRACATED/AppLauncher/EventLaunchApplication.h b/src/modules/API/DEPRACATED/AppLauncher/EventLaunchApplication.h index 021ff0b..62a799f 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/EventLaunchApplication.h +++ b/src/modules/API/DEPRACATED/AppLauncher/EventLaunchApplication.h @@ -38,10 +38,12 @@ class EventLaunchApplication : public WrtPlugins::Platform::IEvent< { //Uri type. http://, file://, sms:, mailto: etc ApplicationUriType m_applicationUriType; - // used as param to uriType, for example http address, path to file, phone number, etc + // used as param to uriType, for example http address, path to file, phone + // number, etc std::string m_applicationUriParam; //optional parameters for file:// std::vector m_applicationParameters; + public: void addApplicationParameter(const std::string &value) { @@ -68,12 +70,10 @@ class EventLaunchApplication : public WrtPlugins::Platform::IEvent< return m_applicationUriParam; } virtual void clearOnCancel() - { - } + {} EventLaunchApplication() : m_applicationUriType( APPLICATION_URI_TYPE_UNDEFINED) - { - } + {} }; typedef DPL::SharedPtr EventLaunchApplicationPtr; diff --git a/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.cpp b/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.cpp index 525d749..92324a2 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.cpp +++ b/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.cpp @@ -32,27 +32,25 @@ IAppLauncherManager::IAppLauncherManager() : APPLAUNCHER_THREAD), EventRequestReceiverLaunchApplication(Platform::ThreadEnum:: APPLAUNCHER_THREAD) -{ -} +{} IAppLauncherManager::~IAppLauncherManager() -{ -} +{} void IAppLauncherManager::getDefaultApplication( - const EventGetDefaultApplicationPtr &event) + const EventGetDefaultApplicationPtr &event) { EventRequestReceiverGetDefaultApplication::PostRequest(event); } void IAppLauncherManager::getInstalledApplications( - const EventGetInstalledApplicationsPtr &event) + const EventGetInstalledApplicationsPtr &event) { EventRequestReceiverGetInstalledApplications::PostRequest(event); } void IAppLauncherManager::launchApplication( - const EventLaunchApplicationPtr &event) + const EventLaunchApplicationPtr &event) { EventRequestReceiverLaunchApplication::PostRequest(event); } diff --git a/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.h b/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.h index bb07021..3939e83 100644 --- a/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.h +++ b/src/modules/API/DEPRACATED/AppLauncher/IAppLauncherManager.h @@ -47,15 +47,16 @@ class IAppLauncherManager : public EventRequestReceiverGetDefaultApplication, IAppLauncherManager(); virtual ~IAppLauncherManager(); virtual void getDefaultApplication( - const EventGetDefaultApplicationPtr &event); + const EventGetDefaultApplicationPtr &event); virtual void getInstalledApplications( - const EventGetInstalledApplicationsPtr &event); + const EventGetInstalledApplicationsPtr &event); virtual void launchApplication(const EventLaunchApplicationPtr &event); + protected: virtual void OnRequestReceived(const EventGetDefaultApplicationPtr &event) = 0; virtual void OnRequestReceived( - const EventGetInstalledApplicationsPtr &event) = 0; + const EventGetInstalledApplicationsPtr &event) = 0; virtual void OnRequestReceived(const EventLaunchApplicationPtr &event) = 0; }; diff --git a/src/modules/API/DEPRACATED/Device/EventClamshellStateChange.cpp b/src/modules/API/DEPRACATED/Device/EventClamshellStateChange.cpp index d3af2c3..3bea5a9 100644 --- a/src/modules/API/DEPRACATED/Device/EventClamshellStateChange.cpp +++ b/src/modules/API/DEPRACATED/Device/EventClamshellStateChange.cpp @@ -19,12 +19,10 @@ namespace WrtPlugins { namespace Api { namespace Device { EventClamshellStateChange::EventClamshellStateChange() : m_state(CSS_CLOSE) -{ -} +{} EventClamshellStateChange::~EventClamshellStateChange() -{ -} +{} ClamshellState EventClamshellStateChange::getState() const { diff --git a/src/modules/API/DEPRACATED/Device/IClamshell.cpp b/src/modules/API/DEPRACATED/Device/IClamshell.cpp index 0413fc0..f58af1d 100644 --- a/src/modules/API/DEPRACATED/Device/IClamshell.cpp +++ b/src/modules/API/DEPRACATED/Device/IClamshell.cpp @@ -19,8 +19,7 @@ namespace WrtPlugins { namespace Api { namespace Device { IClamshell::~IClamshell() -{ -} +{} } // Device } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Device/IClamshell.h b/src/modules/API/DEPRACATED/Device/IClamshell.h index 232df18..8abba64 100644 --- a/src/modules/API/DEPRACATED/Device/IClamshell.h +++ b/src/modules/API/DEPRACATED/Device/IClamshell.h @@ -38,7 +38,7 @@ class IClamshell : private DPL::Noncopyable * @throw PlatformException If error in platform occurs. */ virtual void addOnStateChange( - const EventClamshellStateChangeEmitterPtr& emitter) = 0; + const EventClamshellStateChangeEmitterPtr& emitter) = 0; /** * Removes on change state emitter. @@ -47,7 +47,7 @@ class IClamshell : private DPL::Noncopyable * @throw PlatformException If error in platform occurs. */ virtual void removeOnStateChange( - EventClamshellStateChangeEmitter::IdType id) = 0; + EventClamshellStateChangeEmitter::IdType id) = 0; }; } // Device } // Api diff --git a/src/modules/API/DEPRACATED/Device/IKeypad.cpp b/src/modules/API/DEPRACATED/Device/IKeypad.cpp index 78a6de9..9f3f9a8 100644 --- a/src/modules/API/DEPRACATED/Device/IKeypad.cpp +++ b/src/modules/API/DEPRACATED/Device/IKeypad.cpp @@ -19,8 +19,7 @@ namespace WrtPlugins { namespace Api { namespace Device { IKeypad::~IKeypad() -{ -} +{} } // Device } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Device/IManager.cpp b/src/modules/API/DEPRACATED/Device/IManager.cpp index fdb4ac5..86ab212 100644 --- a/src/modules/API/DEPRACATED/Device/IManager.cpp +++ b/src/modules/API/DEPRACATED/Device/IManager.cpp @@ -25,8 +25,7 @@ IManager& IManager::getInstance() } IManager::~IManager() -{ -} +{} } // Device } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Display/EventChangeOrientation.cpp b/src/modules/API/DEPRACATED/Display/EventChangeOrientation.cpp index 6c58e09..fa0fa6f 100644 --- a/src/modules/API/DEPRACATED/Display/EventChangeOrientation.cpp +++ b/src/modules/API/DEPRACATED/Display/EventChangeOrientation.cpp @@ -19,12 +19,10 @@ namespace WrtPlugins { namespace Api { namespace Display { EventChangeOrientation::EventChangeOrientation() : m_orientation(O_PORTRAIT) -{ -} +{} EventChangeOrientation::~EventChangeOrientation() -{ -} +{} Orientation EventChangeOrientation::getOrientation() const { diff --git a/src/modules/API/DEPRACATED/Display/EventChangeState.cpp b/src/modules/API/DEPRACATED/Display/EventChangeState.cpp index 39060f7..e94bb4b 100644 --- a/src/modules/API/DEPRACATED/Display/EventChangeState.cpp +++ b/src/modules/API/DEPRACATED/Display/EventChangeState.cpp @@ -19,12 +19,10 @@ namespace WrtPlugins { namespace Api { namespace Display { EventChangeState::EventChangeState() : m_state(ST_OFF) -{ -} +{} EventChangeState::~EventChangeState() -{ -} +{} State EventChangeState::getState() const { diff --git a/src/modules/API/DEPRACATED/Display/IManager.cpp b/src/modules/API/DEPRACATED/Display/IManager.cpp index 5f94d11..2ccbeb4 100644 --- a/src/modules/API/DEPRACATED/Display/IManager.cpp +++ b/src/modules/API/DEPRACATED/Display/IManager.cpp @@ -25,8 +25,7 @@ IManager& IManager::getInstance() } IManager::~IManager() -{ -} +{} } // Display } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Display/IManager.h b/src/modules/API/DEPRACATED/Display/IManager.h index b9811af..45cfa84 100644 --- a/src/modules/API/DEPRACATED/Display/IManager.h +++ b/src/modules/API/DEPRACATED/Display/IManager.h @@ -42,7 +42,8 @@ class IManager * @throw UnsupportedException If current platform doesn't support it. * @throw OutOfRangeException If specified screen doesn't exist. * @throw PlatformException If error in platform occurs. - * @remarks On some platforms passing 0 as screen index may result in returning + * @remarks On some platforms passing 0 as screen index may result in + * returning * some global screen interface. Other may return default screen. * @remarks Ownership is NOT passed to the caller. */ diff --git a/src/modules/API/DEPRACATED/Display/IScreen.cpp b/src/modules/API/DEPRACATED/Display/IScreen.cpp index fbc6e59..9fd76af 100644 --- a/src/modules/API/DEPRACATED/Display/IScreen.cpp +++ b/src/modules/API/DEPRACATED/Display/IScreen.cpp @@ -19,8 +19,7 @@ namespace WrtPlugins { namespace Api { namespace Display { IScreen::~IScreen() -{ -} +{} } // Display } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Display/IScreen.h b/src/modules/API/DEPRACATED/Display/IScreen.h index 035ff61..95e5cd5 100644 --- a/src/modules/API/DEPRACATED/Display/IScreen.h +++ b/src/modules/API/DEPRACATED/Display/IScreen.h @@ -84,7 +84,7 @@ class IScreen : private DPL::Noncopyable * @throw PlatformException If error in platform occurs. */ virtual void addOnChangeOrientation( - const EventChangeOrientationEmitterPtr& emitter) = 0; + const EventChangeOrientationEmitterPtr& emitter) = 0; /** * Removes on change size emitter. @@ -93,7 +93,7 @@ class IScreen : private DPL::Noncopyable * @throw PlatformException If error in platform occurs. */ virtual void removeOnChangeOrientation( - EventChangeOrientationEmitter::IdType id) = 0; + EventChangeOrientationEmitter::IdType id) = 0; /** * Adds on change state event emitter. diff --git a/src/modules/API/DEPRACATED/FeatureLoader/EventLoadFeature.h b/src/modules/API/DEPRACATED/FeatureLoader/EventLoadFeature.h index f1590f3..9b1c931 100644 --- a/src/modules/API/DEPRACATED/FeatureLoader/EventLoadFeature.h +++ b/src/modules/API/DEPRACATED/FeatureLoader/EventLoadFeature.h @@ -32,8 +32,7 @@ class EventLoadFeature : public WrtPlugins::Platform::IEvent m_success(false), m_feature(feature), m_object(0) - { - } + {} ~EventLoadFeature() { @@ -66,8 +65,8 @@ class EventLoadFeature : public WrtPlugins::Platform::IEvent } virtual void clearOnCancel() - { - } + {} + private: bool m_success; std::string m_feature; diff --git a/src/modules/API/DEPRACATED/FeatureLoader/FeatureManagerFactory.h b/src/modules/API/DEPRACATED/FeatureLoader/FeatureManagerFactory.h index 831cfae..485e6e1 100644 --- a/src/modules/API/DEPRACATED/FeatureLoader/FeatureManagerFactory.h +++ b/src/modules/API/DEPRACATED/FeatureLoader/FeatureManagerFactory.h @@ -38,11 +38,9 @@ class FeatureManagerFactory : private: FeatureManagerFactory() - { - } + {} ~FeatureManagerFactory() - { - } + {} }; } // namespace Api } // namespace WrtPlugins diff --git a/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.cpp b/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.cpp index 7ab099e..19ac1ef 100644 --- a/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.cpp +++ b/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.cpp @@ -25,12 +25,10 @@ namespace Api { IFeatureManager::IFeatureManager() : Platform::EventRequestReceiver(Platform::ThreadEnum:: BONDI_THREAD) -{ -} +{} IFeatureManager::~IFeatureManager() -{ -} +{} void IFeatureManager::loadFeature(const EventLoadFeaturePtr &event) { diff --git a/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.h b/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.h index 6a14c6b..471c736 100644 --- a/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.h +++ b/src/modules/API/DEPRACATED/FeatureLoader/IFeatureManager.h @@ -33,6 +33,7 @@ class IFeatureManager : */ virtual void loadFeature(const EventLoadFeaturePtr &event); + protected: virtual void OnRequestReceived(const EventLoadFeaturePtr &event) = 0; }; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventClose.h b/src/modules/API/DEPRACATED/Gallery/IEventClose.h index b5ffc60..b0bacc1 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventClose.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventClose.h @@ -53,8 +53,7 @@ class IEventClose : public WrtPlugins::Platform::IEvent } IEventClose() : m_result(Commons::ExceptionCodes::None) - { - } + {} }; typedef DPL::SharedPtr IEventClosePtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventGetGalleries.h b/src/modules/API/DEPRACATED/Gallery/IEventGetGalleries.h index a1a9fce..95f0520 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventGetGalleries.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventGetGalleries.h @@ -34,9 +34,10 @@ class IEventGetGalleries : public WrtPlugins::Platform::IEvent< { Commons::ExceptionCodes::Enumeration m_result; IGallerySetPtr m_galleries; + public: void setResult( - const Commons::ExceptionCodes::Enumeration &value) + const Commons::ExceptionCodes::Enumeration &value) { m_result = value; } @@ -55,8 +56,7 @@ class IEventGetGalleries : public WrtPlugins::Platform::IEvent< IEventGetGalleries() : m_result(Commons::ExceptionCodes::None), m_galleries(NULL) - { - } + {} }; typedef DPL::SharedPtr IEventGetGalleriesPtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItemById.h b/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItemById.h index 4454bf7..f651078 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItemById.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItemById.h @@ -74,8 +74,7 @@ class IEventGetMediaItemById : public WrtPlugins::Platform::IEvent< IEventGetMediaItemById() : m_result(Commons::ExceptionCodes::None), m_id(0) - { - } + {} }; typedef DPL::SharedPtr IEventGetMediaItemByIdPtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItems.h b/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItems.h index b3597dc..4dc5ce0 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItems.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventGetMediaItems.h @@ -38,7 +38,7 @@ class IEventGetMediaItems : public WrtPlugins::Platform::IEvent< public: void setResult( - const Commons::ExceptionCodes::Enumeration &value) + const Commons::ExceptionCodes::Enumeration &value) { m_result = value; } @@ -64,8 +64,7 @@ class IEventGetMediaItems : public WrtPlugins::Platform::IEvent< } IEventGetMediaItems() : m_result(Commons::ExceptionCodes::None) - { - } + {} }; typedef DPL::SharedPtr IEventGetMediaItemsPtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventOpen.h b/src/modules/API/DEPRACATED/Gallery/IEventOpen.h index fc02c3a..81c3f28 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventOpen.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventOpen.h @@ -36,7 +36,7 @@ class IEventOpen : public WrtPlugins::Platform::IEvent public: void setResult( - const Commons::ExceptionCodes::Enumeration &value) + const Commons::ExceptionCodes::Enumeration &value) { m_result = value; } @@ -54,8 +54,7 @@ class IEventOpen : public WrtPlugins::Platform::IEvent } IEventOpen() : m_result(Commons::ExceptionCodes::None) - { - } + {} }; typedef DPL::SharedPtr IEventOpenPtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IEventRefresh.h b/src/modules/API/DEPRACATED/Gallery/IEventRefresh.h index 19b66aa..05bf525 100644 --- a/src/modules/API/DEPRACATED/Gallery/IEventRefresh.h +++ b/src/modules/API/DEPRACATED/Gallery/IEventRefresh.h @@ -53,8 +53,7 @@ class IEventRefresh : public WrtPlugins::Platform::IEvent } IEventRefresh() : m_result(Commons::ExceptionCodes::None) - { - } + {} }; typedef DPL::SharedPtr IEventRefreshPtr; diff --git a/src/modules/API/DEPRACATED/Gallery/IGallery.cpp b/src/modules/API/DEPRACATED/Gallery/IGallery.cpp index 7db716d..c746dce 100644 --- a/src/modules/API/DEPRACATED/Gallery/IGallery.cpp +++ b/src/modules/API/DEPRACATED/Gallery/IGallery.cpp @@ -19,12 +19,10 @@ namespace WrtPlugins { namespace Api { namespace Gallery { IGallery::IGallery() -{ -} +{} IGallery::~IGallery() -{ -} +{} } // Gallery } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.cpp b/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.cpp index e0424dd..60e856a 100644 --- a/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.cpp +++ b/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.cpp @@ -58,7 +58,7 @@ void IGalleryRequestManager::getMediaItems(const IEventGetMediaItemsPtr &event) } void IGalleryRequestManager::getMediaItemById( - const IEventGetMediaItemByIdPtr &event) + const IEventGetMediaItemByIdPtr &event) { EventRequestReceiver< IEventGetMediaItemById >::PostRequest(event); } diff --git a/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.h b/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.h index e7e64f0..a21d52a 100644 --- a/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.h +++ b/src/modules/API/DEPRACATED/Gallery/IGalleryRequestManager.h @@ -61,12 +61,10 @@ class IGalleryRequestManager : ERRChangeView(Platform::ThreadEnum::GALLERY_THREAD), ERRGetMediaItems(Platform::ThreadEnum::GALLERY_THREAD), ERRGetMediaItemById(Platform::ThreadEnum::GALLERY_THREAD) - { - } + {} virtual ~IGalleryRequestManager() - { - } + {} virtual void getGalleries(const IEventGetGalleriesPtr &event); virtual void open(const IEventOpenPtr &event); @@ -92,8 +90,8 @@ class GalleryFactory : private DPL::Noncopyable { protected: GalleryFactory() - { - } + {} + public: static GalleryFactory& getInstance(); IGalleryRequestManagerPtr getGalleryManager(); diff --git a/src/modules/API/DEPRACATED/Gallery/IMediaItem.h b/src/modules/API/DEPRACATED/Gallery/IMediaItem.h index 1dc8e40..7367c1d 100644 --- a/src/modules/API/DEPRACATED/Gallery/IMediaItem.h +++ b/src/modules/API/DEPRACATED/Gallery/IMediaItem.h @@ -52,11 +52,9 @@ class IMediaItem IMediaItem() : m_id(0), m_type(UNDEFINED), m_date(0) - { - } + {} virtual ~IMediaItem() - { - } + {} virtual const std::string &getFileName() const { diff --git a/src/modules/API/DEPRACATED/Gallery/IViewProperties.cpp b/src/modules/API/DEPRACATED/Gallery/IViewProperties.cpp index 68aca66..3865181 100644 --- a/src/modules/API/DEPRACATED/Gallery/IViewProperties.cpp +++ b/src/modules/API/DEPRACATED/Gallery/IViewProperties.cpp @@ -63,7 +63,7 @@ void IViewProperties::setMetaTag(const std::string &metaTag) } void IViewProperties::setPrimarySortOrder( - IViewProperties::SortOrder primarySortOrder) + IViewProperties::SortOrder primarySortOrder) { if (primarySortOrder < NONE || primarySortOrder > BY_TYPE) { Throw(Commons::InvalidArgumentException); @@ -72,7 +72,7 @@ void IViewProperties::setPrimarySortOrder( } void IViewProperties::setSecondarySortOrder( - IViewProperties::SortOrder secondarySortOrder) + IViewProperties::SortOrder secondarySortOrder) { if (secondarySortOrder < NONE || secondarySortOrder > BY_TYPE) { Throw(Commons::InvalidArgumentException); @@ -96,8 +96,7 @@ IViewProperties::IViewProperties() : m_secondarySortOrder(NONE), m_startDate(0), m_endDate(0) -{ -} +{} } // Gallery } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Geolocation/EventGetCurrentPosition.h b/src/modules/API/DEPRACATED/Geolocation/EventGetCurrentPosition.h index b6ad34d..622d5b5 100644 --- a/src/modules/API/DEPRACATED/Geolocation/EventGetCurrentPosition.h +++ b/src/modules/API/DEPRACATED/Geolocation/EventGetCurrentPosition.h @@ -124,8 +124,7 @@ class EventGetCurrentPosition : public WrtPlugins::Platform::IEvent< } EventGetCurrentPosition() - { - } + {} }; typedef DPL::SharedPtr EventGetCurrentPositionPtr; diff --git a/src/modules/API/DEPRACATED/Geolocation/EventPositionChanged.h b/src/modules/API/DEPRACATED/Geolocation/EventPositionChanged.h index d3f1946..77ad5ef 100644 --- a/src/modules/API/DEPRACATED/Geolocation/EventPositionChanged.h +++ b/src/modules/API/DEPRACATED/Geolocation/EventPositionChanged.h @@ -46,8 +46,7 @@ class EventPositionChanged : public Platform::ListenerEvent< } EventPositionChanged() - { - } + {} }; typedef DPL::SharedPtr EventPositionChangedPtr; diff --git a/src/modules/API/DEPRACATED/Geolocation/GeolocationFactory.cpp b/src/modules/API/DEPRACATED/Geolocation/GeolocationFactory.cpp index 735af94..7f679b8 100644 --- a/src/modules/API/DEPRACATED/Geolocation/GeolocationFactory.cpp +++ b/src/modules/API/DEPRACATED/Geolocation/GeolocationFactory.cpp @@ -35,8 +35,7 @@ GeolocationFactory& GeolocationFactory::getInstance() } GeolocationFactory::GeolocationFactory() -{ -} +{} } } } diff --git a/src/modules/API/DEPRACATED/Geolocation/IGeolocation.cpp b/src/modules/API/DEPRACATED/Geolocation/IGeolocation.cpp index e67d96a..7d1f96d 100644 --- a/src/modules/API/DEPRACATED/Geolocation/IGeolocation.cpp +++ b/src/modules/API/DEPRACATED/Geolocation/IGeolocation.cpp @@ -28,12 +28,10 @@ using namespace Platform; IGeolocation::IGeolocation() : EventRequestReceiver(ThreadEnum:: GEOLOCATION_THREAD) -{ -} +{} IGeolocation::~IGeolocation() -{ -} +{} } } } diff --git a/src/modules/API/DEPRACATED/Geolocation/IGeolocation.h b/src/modules/API/DEPRACATED/Geolocation/IGeolocation.h index 4da7a31..67f250e 100644 --- a/src/modules/API/DEPRACATED/Geolocation/IGeolocation.h +++ b/src/modules/API/DEPRACATED/Geolocation/IGeolocation.h @@ -66,9 +66,9 @@ class IGeolocation : * @exception Commons::PlatformException when platform error occurs */ virtual long watchPosition(const EventPositionChangedEmitterPtr& emitter, - long timeout, - long maximumAge, - bool highAccuracy) = 0; + long timeout, + long maximumAge, + bool highAccuracy) = 0; /** * Stopping periodic location updates started with watchPosition @@ -81,7 +81,8 @@ class IGeolocation : * Choses location method * @param method A location method * @exception Commons::PlatformException when platform error occurs - * @remarks does nothing when executed with the same method as currently used + * @remarks does nothing when executed with the same method as currently + * used */ virtual void changeLocationMethod(ApiLocationMethod method) = 0; diff --git a/src/modules/API/DEPRACATED/Geolocation/PositionProperties.h b/src/modules/API/DEPRACATED/Geolocation/PositionProperties.h index 31fe3fe..82e5ce8 100644 --- a/src/modules/API/DEPRACATED/Geolocation/PositionProperties.h +++ b/src/modules/API/DEPRACATED/Geolocation/PositionProperties.h @@ -47,8 +47,7 @@ struct PositionProperties speed(0.0), direction(0.0), altitudeSpeed(0.0) - { - } + {} }; typedef DPL::SharedPtr PositionPropertiesPtr; diff --git a/src/modules/API/DEPRACATED/Memory/IManager.cpp b/src/modules/API/DEPRACATED/Memory/IManager.cpp index cd25798..2347b42 100644 --- a/src/modules/API/DEPRACATED/Memory/IManager.cpp +++ b/src/modules/API/DEPRACATED/Memory/IManager.cpp @@ -25,8 +25,7 @@ IManager& IManager::getInstance() } IManager::~IManager() -{ -} +{} } // Memory } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/System/IDate.cpp b/src/modules/API/DEPRACATED/System/IDate.cpp index a5e9567..9d939f6 100644 --- a/src/modules/API/DEPRACATED/System/IDate.cpp +++ b/src/modules/API/DEPRACATED/System/IDate.cpp @@ -19,8 +19,7 @@ namespace WrtPlugins { namespace Api { namespace System { IDate::~IDate() -{ -} +{} } // System } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/System/IEnvironment.cpp b/src/modules/API/DEPRACATED/System/IEnvironment.cpp index 2ad4f24..abf2b09 100644 --- a/src/modules/API/DEPRACATED/System/IEnvironment.cpp +++ b/src/modules/API/DEPRACATED/System/IEnvironment.cpp @@ -25,8 +25,7 @@ IEnvironment& IEnvironment::getInstance() } IEnvironment::~IEnvironment() -{ -} +{} } // System } // Api } // WrtPlugins diff --git a/src/modules/API/DEPRACATED/Telephony/IEventClearLogs.h b/src/modules/API/DEPRACATED/Telephony/IEventClearLogs.h index 7d70cc2..7a13ec9 100644 --- a/src/modules/API/DEPRACATED/Telephony/IEventClearLogs.h +++ b/src/modules/API/DEPRACATED/Telephony/IEventClearLogs.h @@ -33,6 +33,7 @@ class IEventClearLog : public WrtPlugins::Platform::IEvent { bool m_result; LogFilterPtr m_filter; + public: void setFilter(LogFilterPtr value) { @@ -51,14 +52,11 @@ class IEventClearLog : public WrtPlugins::Platform::IEvent return m_result; } virtual void clearOnCancel() - { - } + {} IEventClearLog() : m_result(false) - { - } + {} ~IEventClearLog() - { - } + {} }; typedef DPL::SharedPtr IEventClearLogPtr; diff --git a/src/modules/API/DEPRACATED/Telephony/IEventDeleteLogEntry.h b/src/modules/API/DEPRACATED/Telephony/IEventDeleteLogEntry.h index d9dd2f1..40ffd88 100644 --- a/src/modules/API/DEPRACATED/Telephony/IEventDeleteLogEntry.h +++ b/src/modules/API/DEPRACATED/Telephony/IEventDeleteLogEntry.h @@ -34,6 +34,7 @@ class IEventDeleteLogEntry : public WrtPlugins::Platform::IEvent< { bool m_result; LogFilterPtr m_filter; + public: void setFilter(LogFilterPtr value) { @@ -52,14 +53,11 @@ class IEventDeleteLogEntry : public WrtPlugins::Platform::IEvent< return m_result; } virtual void clearOnCancel() - { - } + {} IEventDeleteLogEntry() : m_result(false) - { - } + {} ~IEventDeleteLogEntry() - { - } + {} }; typedef DPL::SharedPtr IEventDeleteLogEntryPtr; diff --git a/src/modules/API/DEPRACATED/Telephony/IEventFindLogEntries.h b/src/modules/API/DEPRACATED/Telephony/IEventFindLogEntries.h index 9be97ce..c8b8111 100644 --- a/src/modules/API/DEPRACATED/Telephony/IEventFindLogEntries.h +++ b/src/modules/API/DEPRACATED/Telephony/IEventFindLogEntries.h @@ -38,6 +38,7 @@ class IEventFindLogEntries : public WrtPlugins::Platform::IEvent< LogFilterPtr m_filter; int m_firstCall; int m_lastCall; + public: void setFirstCall(int value) { @@ -80,16 +81,13 @@ class IEventFindLogEntries : public WrtPlugins::Platform::IEvent< return m_result; } virtual void clearOnCancel() - { - } + {} IEventFindLogEntries() : m_result(false), m_firstCall(0), m_lastCall(-1) - { - } + {} ~IEventFindLogEntries() - { - } + {} }; typedef DPL::SharedPtr IEventFindLogEntriesPtr; diff --git a/src/modules/API/DEPRACATED/Telephony/IEventGetNumberOfLogs.h b/src/modules/API/DEPRACATED/Telephony/IEventGetNumberOfLogs.h index 8f6831c..c89b9fc 100644 --- a/src/modules/API/DEPRACATED/Telephony/IEventGetNumberOfLogs.h +++ b/src/modules/API/DEPRACATED/Telephony/IEventGetNumberOfLogs.h @@ -35,6 +35,7 @@ class IEventGetNumberOfLogs : public WrtPlugins::Platform::IEvent< bool m_result; int m_numberOfLogs; LogFilterPtr m_filter; + public: void setFilter(LogFilterPtr value) { @@ -61,15 +62,12 @@ class IEventGetNumberOfLogs : public WrtPlugins::Platform::IEvent< return m_result; } virtual void clearOnCancel() - { - } + {} IEventGetNumberOfLogs() : m_result(false), m_numberOfLogs(0) - { - } + {} ~IEventGetNumberOfLogs() - { - } + {} }; typedef DPL::SharedPtr IEventGetNumberOfLogsPtr; diff --git a/src/modules/API/DEPRACATED/Telephony/ILogManager.cpp b/src/modules/API/DEPRACATED/Telephony/ILogManager.cpp index ebce9a4..d8a58f3 100644 --- a/src/modules/API/DEPRACATED/Telephony/ILogManager.cpp +++ b/src/modules/API/DEPRACATED/Telephony/ILogManager.cpp @@ -29,12 +29,10 @@ ILogManager::ILogManager() : EventRequestReceiverFindLogEntries(Platform::ThreadEnum::TELEPHONY_THREAD), EventRequestReceiverDeleteLogEntry(Platform::ThreadEnum::TELEPHONY_THREAD), EventRequestReceiverClearLogs(Platform::ThreadEnum::TELEPHONY_THREAD) -{ -} +{} ILogManager::~ILogManager() -{ -} +{} void ILogManager::getNumberOfLogs(const IEventGetNumberOfLogsPtr &event) { diff --git a/src/modules/API/DEPRACATED/Telephony/ILogManager.h b/src/modules/API/DEPRACATED/Telephony/ILogManager.h index ac0a01e..88c9e78 100644 --- a/src/modules/API/DEPRACATED/Telephony/ILogManager.h +++ b/src/modules/API/DEPRACATED/Telephony/ILogManager.h @@ -52,9 +52,10 @@ class ILogManager : public EventRequestReceiverGetNumberOfLogs, virtual void findLogEntries(const IEventFindLogEntriesPtr &event); virtual void deleteLogEntry(const IEventDeleteLogEntryPtr &event); virtual void clearLogs(const IEventClearLogPtr &event); + protected: virtual void OnRequestReceived( - const IEventGetNumberOfLogsPtr &event) = 0; + const IEventGetNumberOfLogsPtr &event) = 0; virtual void OnRequestReceived(const IEventFindLogEntriesPtr &event) = 0; virtual void OnRequestReceived(const IEventDeleteLogEntryPtr &event) diff --git a/src/modules/API/DEPRACATED/Telephony/LogEntry.cpp b/src/modules/API/DEPRACATED/Telephony/LogEntry.cpp index fe62d1f..cc6ecdd 100644 --- a/src/modules/API/DEPRACATED/Telephony/LogEntry.cpp +++ b/src/modules/API/DEPRACATED/Telephony/LogEntry.cpp @@ -29,12 +29,10 @@ LogEntry::LogEntry() : m_startTime(0), m_duration(0), m_folder(LogEntry::INVALID_FOLDER) -{ -} +{} LogEntry::~LogEntry() -{ -} +{} int LogEntry::getId() const { diff --git a/src/modules/API/DEPRACATED/Telephony/LogEntry.h b/src/modules/API/DEPRACATED/Telephony/LogEntry.h index 6f13cc1..9f6ca15 100644 --- a/src/modules/API/DEPRACATED/Telephony/LogEntry.h +++ b/src/modules/API/DEPRACATED/Telephony/LogEntry.h @@ -41,7 +41,8 @@ class LogEntry MISSED_CALLS_FOLDER, INITIATED_CALLS_FOLDER, INVALID_FOLDER = 10000, - UNDEFINED_FOLDER /* should be used only to mark a fact filter is not set */ + UNDEFINED_FOLDER /* should be used only to mark a fact filter + *is not set */ } LogFolder; LogEntry(); diff --git a/src/modules/API/DEPRACATED/Telephony/LogFilter.cpp b/src/modules/API/DEPRACATED/Telephony/LogFilter.cpp index 954723b..842caef 100644 --- a/src/modules/API/DEPRACATED/Telephony/LogFilter.cpp +++ b/src/modules/API/DEPRACATED/Telephony/LogFilter.cpp @@ -36,12 +36,10 @@ LogFilter::LogFilter() : m_durationMax(LOG_FILTER_UNDEFINED_DURATION), m_phoneNumberIsSet(false), m_descriptionIsSet(false) -{ -} +{} LogFilter::~LogFilter() -{ -} +{} int LogFilter::getIdFilter() const diff --git a/src/modules/API/DEPRACATED/Telephony/TelephonyFactory.h b/src/modules/API/DEPRACATED/Telephony/TelephonyFactory.h index f3bc338..d859c1e 100644 --- a/src/modules/API/DEPRACATED/Telephony/TelephonyFactory.h +++ b/src/modules/API/DEPRACATED/Telephony/TelephonyFactory.h @@ -31,8 +31,8 @@ class TelephonyFactory : private DPL::Noncopyable { private: TelephonyFactory() - { - } + {} + public: static TelephonyFactory& getInstance(); ILogManagerPtr createLogManagerObject(); diff --git a/src/modules/API/DEPRACATED/UI/IPreferences.h b/src/modules/API/DEPRACATED/UI/IPreferences.h index 7fe7d22..094bd1d 100644 --- a/src/modules/API/DEPRACATED/UI/IPreferences.h +++ b/src/modules/API/DEPRACATED/UI/IPreferences.h @@ -44,15 +44,15 @@ class IPreferences : public Platform::EventRequestReceiver< IEventSetWallpaper > ThreadEnum :: UI_THREAD) - { - } + {} virtual void OnRequestReceived( - const DPL::SharedPtr &event) = 0; + const DPL::SharedPtr &event) = 0; virtual void OnRequestReceived( - const DPL::SharedPtr &event) = 0; + const DPL::SharedPtr &event) = 0; virtual void OnRequestReceived( - const DPL::SharedPtr &event) = 0; + const DPL::SharedPtr &event) = 0; + public: virtual void setWallpaper(DPL::SharedPtr &event) { @@ -63,14 +63,13 @@ class IPreferences : public Platform::EventRequestReceiver< IEventSetWallpaper > PostRequest(event); } virtual void setMessageRingtone( - DPL::SharedPtr &event) + DPL::SharedPtr &event) { PostRequest(event); } virtual ~IPreferences() - { - } + {} }; //============================================================ } //namespace diff --git a/src/modules/API/DEPRACATED/UI/IPreferencesEvents.h b/src/modules/API/DEPRACATED/UI/IPreferencesEvents.h index 99d4d23..f27d406 100644 --- a/src/modules/API/DEPRACATED/UI/IPreferencesEvents.h +++ b/src/modules/API/DEPRACATED/UI/IPreferencesEvents.h @@ -33,12 +33,10 @@ class IEventSetWallpaper : public WrtPlugins::Platform::IEvent< { public: IEventSetWallpaper() - { - } + {} virtual ~IEventSetWallpaper() - { - } + {} }; typedef DPL::SharedPtr IEventSetWallpaperPtr; //========================================================================= @@ -47,12 +45,10 @@ class IEventSetCallRingtone : public WrtPlugins::Platform::IEvent< { public: IEventSetCallRingtone() - { - } + {} virtual ~IEventSetCallRingtone() - { - } + {} }; typedef DPL::SharedPtr IEventSetCallRingtonePtr; //========================================================================= @@ -61,12 +57,10 @@ class IEventSetMessageRingtone : public WrtPlugins::Platform::IEvent< { public: IEventSetMessageRingtone() - { - } + {} virtual ~IEventSetMessageRingtone() - { - } + {} }; typedef DPL::SharedPtr IEventSetMessageRingtonePtr; //========================================================================= diff --git a/src/modules/API/DEPRACATED/UI/UIFactory.h b/src/modules/API/DEPRACATED/UI/UIFactory.h index 59d5c8e..1a8dc1f 100644 --- a/src/modules/API/DEPRACATED/UI/UIFactory.h +++ b/src/modules/API/DEPRACATED/UI/UIFactory.h @@ -31,8 +31,8 @@ class UIFactory : private DPL::Noncopyable { private: UIFactory() - { - } + {} + public: static UIFactory& getInstance(); }; diff --git a/src/modules/API/Filesystem/Enums.h b/src/modules/API/Filesystem/Enums.h index 29359eb..81e7d0d 100644 --- a/src/modules/API/Filesystem/Enums.h +++ b/src/modules/API/Filesystem/Enums.h @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - enum LocationType { LT_APPS, @@ -46,9 +45,9 @@ enum NodeType enum AccessMode { - AM_READ = 0x0001, - AM_WRITE = 0x0002, - AM_APPEND = 0x0004 + AM_READ = 0x0001, + AM_WRITE = 0x0002, + AM_APPEND = 0x0004 }; /** @@ -56,38 +55,38 @@ enum AccessMode */ enum AccessType { - AT_READ = 0x0001, //!< AT_READ - checks for read access - AT_WRITE = 0x0002, //!< AT_WRITE - checks for write access - AT_EXEC = 0x0004, //!< AT_EXEC - checks for execution access - AT_EXISTS = 0x0008 //!< AT_EXISTS - checks for existence + AT_READ = 0x0001, //!< AT_READ - checks for read access + AT_WRITE = 0x0002, //!< AT_WRITE - checks for write access + AT_EXEC = 0x0004, //!< AT_EXEC - checks for execution access + AT_EXISTS = 0x0008 //!< AT_EXISTS - checks for existence }; enum Permissions { - PERM_NONE = 0x0000, - PERM_READ = 0x0001, - PERM_WRITE = 0x0002 + PERM_NONE = 0x0000, + PERM_READ = 0x0001, + PERM_WRITE = 0x0002 }; enum PlatformMode { - PM_USER_READ = 0x0100, - PM_USER_WRITE = 0x0080, - PM_USER_EXEC = 0x0040, - PM_GROUP_READ = 0x0020, - PM_GROUP_WRITE = 0x0010, - PM_GROUP_EXEC = 0x0008, - PM_OTHER_READ = 0x0004, - PM_OTHER_WRITE = 0x0002, - PM_OTHER_EXEC = 0x0001, - PM_NONE = 0x0000 + PM_USER_READ = 0x0100, + PM_USER_WRITE = 0x0080, + PM_USER_EXEC = 0x0040, + PM_GROUP_READ = 0x0020, + PM_GROUP_WRITE = 0x0010, + PM_GROUP_EXEC = 0x0008, + PM_OTHER_READ = 0x0004, + PM_OTHER_WRITE = 0x0002, + PM_OTHER_EXEC = 0x0001, + PM_NONE = 0x0000 }; enum Options { - OPT_NONE = 0x0000, - OPT_OVERWRITE = 0x0001, - OPT_RECURSIVE = 0x0002 + OPT_NONE = 0x0000, + OPT_OVERWRITE = 0x0001, + OPT_RECURSIVE = 0x0002 }; enum FindFilter @@ -98,7 +97,6 @@ enum FindFilter FF_SIZE }; typedef std::map FiltersMap; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventCopy.cpp b/src/modules/API/Filesystem/EventCopy.cpp index c54ade5..cd4efa1 100644 --- a/src/modules/API/Filesystem/EventCopy.cpp +++ b/src/modules/API/Filesystem/EventCopy.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventCopy::EventCopy(const IPathPtr& src, const IPathPtr& dest) : m_src(src), @@ -59,7 +58,6 @@ void EventCopy::setOptions(int options) { m_options = options; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventCopy.h b/src/modules/API/Filesystem/EventCopy.h index a587015..62bef44 100644 --- a/src/modules/API/Filesystem/EventCopy.h +++ b/src/modules/API/Filesystem/EventCopy.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventCopy : public Commons::IEvent { public: @@ -35,7 +34,7 @@ class EventCopy : public Commons::IEvent * @return New object. */ EventCopy(const IPathPtr& src, - const IPathPtr& dest); + const IPathPtr& dest); /** * Gets destination path. @@ -77,11 +76,11 @@ class EventCopy : public Commons::IEvent IPathPtr m_src; ///< Source path. IPathPtr m_dest; ///< Destination path. INodePtr m_result; ///< Result node. - int m_options; ///< Options for copy action @see WrtDeviceApis::Api::Filesystem::Options. + int m_options; ///< Options for copy action @see + // WrtDeviceApis::Api::Filesystem::Options. }; typedef DPL::SharedPtr EventCopyPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventFind.cpp b/src/modules/API/Filesystem/EventFind.cpp index 4e9cf48..c8c01a9 100644 --- a/src/modules/API/Filesystem/EventFind.cpp +++ b/src/modules/API/Filesystem/EventFind.cpp @@ -21,10 +21,8 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventFind::EventFind(const IPathPtr& path) : m_path(path) -{ -} +{} IPathPtr EventFind::getPath() const { @@ -47,7 +45,7 @@ void EventFind::setResult(const NodeList& nodes) } void EventFind::addFilter(FindFilter name, - const std::string& value) + const std::string& value) { m_filters.insert(std::pair(name, value)); } @@ -56,7 +54,6 @@ FiltersMap EventFind::getFilters() const { return m_filters; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventFind.h b/src/modules/API/Filesystem/EventFind.h index 531ff2e..47d6e50 100644 --- a/src/modules/API/Filesystem/EventFind.h +++ b/src/modules/API/Filesystem/EventFind.h @@ -26,7 +26,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventFind : public Commons::IEvent { public: @@ -67,7 +66,7 @@ class EventFind : public Commons::IEvent * @param value Filter value. */ void addFilter(FindFilter name, - const std::string& value); + const std::string& value); /** * Gets all filters. @@ -82,7 +81,6 @@ class EventFind : public Commons::IEvent }; typedef DPL::SharedPtr EventFindPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventListNodes.cpp b/src/modules/API/Filesystem/EventListNodes.cpp index 6802d4d..3fed54f 100644 --- a/src/modules/API/Filesystem/EventListNodes.cpp +++ b/src/modules/API/Filesystem/EventListNodes.cpp @@ -20,7 +20,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventListNodes::EventListNodes(const INodePtr& node) : m_node(node) { Assert(m_node && "Node can't be NULL."); @@ -50,7 +49,6 @@ void EventListNodes::setResult(const NodeList& list) { m_list = list; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventListNodes.h b/src/modules/API/Filesystem/EventListNodes.h index f86165e..a856546 100644 --- a/src/modules/API/Filesystem/EventListNodes.h +++ b/src/modules/API/Filesystem/EventListNodes.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventListNodes : public Commons::IEvent { public: @@ -72,7 +71,6 @@ class EventListNodes : public Commons::IEvent }; typedef DPL::SharedPtr EventListNodesPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventMove.cpp b/src/modules/API/Filesystem/EventMove.cpp index 2f4f652..0164856 100644 --- a/src/modules/API/Filesystem/EventMove.cpp +++ b/src/modules/API/Filesystem/EventMove.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventMove::EventMove(const IPathPtr& src, const IPathPtr& dest) : m_src(src), @@ -59,7 +58,6 @@ void EventMove::setOptions(int options) { m_options = options; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventMove.h b/src/modules/API/Filesystem/EventMove.h index a0e7ba5..d9716f0 100644 --- a/src/modules/API/Filesystem/EventMove.h +++ b/src/modules/API/Filesystem/EventMove.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventMove : public Commons::IEvent { public: @@ -35,7 +34,7 @@ class EventMove : public Commons::IEvent * @return New object. */ EventMove(const IPathPtr& src, - const IPathPtr& dest); + const IPathPtr& dest); /** * Gets destination path. @@ -77,11 +76,11 @@ class EventMove : public Commons::IEvent IPathPtr m_src; ///< Source path. IPathPtr m_dest; ///< Destination path. INodePtr m_result; ///< Result node. - int m_options; ///< Options for copy action @see WrtDeviceApis::Api::Filesystem::Options. + int m_options; ///< Options for copy action @see + // WrtDeviceApis::Api::Filesystem::Options. }; typedef DPL::SharedPtr EventMovePtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventOpen.cpp b/src/modules/API/Filesystem/EventOpen.cpp index df29464..274e963 100644 --- a/src/modules/API/Filesystem/EventOpen.cpp +++ b/src/modules/API/Filesystem/EventOpen.cpp @@ -18,10 +18,8 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventOpen::EventOpen(int mode) : m_mode(mode) -{ -} +{} int EventOpen::getMode() const { @@ -37,7 +35,6 @@ void EventOpen::setResult(const IStreamPtr& stream) { m_stream = stream; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventOpen.h b/src/modules/API/Filesystem/EventOpen.h index 9d61ad1..5ab5662 100644 --- a/src/modules/API/Filesystem/EventOpen.h +++ b/src/modules/API/Filesystem/EventOpen.h @@ -23,7 +23,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventOpen : public Commons::IEvent { public: @@ -58,7 +57,6 @@ class EventOpen : public Commons::IEvent }; typedef DPL::SharedPtr EventOpenPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventReadText.cpp b/src/modules/API/Filesystem/EventReadText.cpp index fd81957..560687e 100644 --- a/src/modules/API/Filesystem/EventReadText.cpp +++ b/src/modules/API/Filesystem/EventReadText.cpp @@ -18,7 +18,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - std::string EventReadText::getResult() const { return m_result; @@ -28,7 +27,6 @@ void EventReadText::setResult(const std::string& result) { m_result = result; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventReadText.h b/src/modules/API/Filesystem/EventReadText.h index c61c5c8..986b565 100644 --- a/src/modules/API/Filesystem/EventReadText.h +++ b/src/modules/API/Filesystem/EventReadText.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventReadText : public Commons::IEvent { public: @@ -45,7 +44,6 @@ class EventReadText : public Commons::IEvent }; typedef DPL::SharedPtr EventReadTextPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventRemove.cpp b/src/modules/API/Filesystem/EventRemove.cpp index 42352da..6be8f41 100644 --- a/src/modules/API/Filesystem/EventRemove.cpp +++ b/src/modules/API/Filesystem/EventRemove.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventRemove::EventRemove(const IPathPtr& path) : m_path(path), m_options(OPT_NONE) @@ -41,7 +40,6 @@ void EventRemove::setOptions(int options) { m_options = options; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventRemove.h b/src/modules/API/Filesystem/EventRemove.h index 51ee50e..be3aecd 100644 --- a/src/modules/API/Filesystem/EventRemove.h +++ b/src/modules/API/Filesystem/EventRemove.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventRemove : public Commons::IEvent { public: @@ -55,11 +54,11 @@ class EventRemove : public Commons::IEvent private: IPathPtr m_path; ///< Source path. - int m_options; ///< Options for remove action @see WrtDeviceApis::Api::Filesystem::Options. + int m_options; ///< Options for remove action @see + // WrtDeviceApis::Api::Filesystem::Options. }; typedef DPL::SharedPtr EventRemovePtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventResolve.cpp b/src/modules/API/Filesystem/EventResolve.cpp index 61f0971..2473795 100644 --- a/src/modules/API/Filesystem/EventResolve.cpp +++ b/src/modules/API/Filesystem/EventResolve.cpp @@ -18,10 +18,8 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - EventResolve::EventResolve(const IPathPtr& path) : m_path(path) -{ -} +{} IPathPtr EventResolve::getPath() const { @@ -37,7 +35,6 @@ void EventResolve::setResult(const INodePtr& node) { m_node = node; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/EventResolve.h b/src/modules/API/Filesystem/EventResolve.h index 7ceefc0..1d50258 100644 --- a/src/modules/API/Filesystem/EventResolve.h +++ b/src/modules/API/Filesystem/EventResolve.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class EventResolve : public Commons::IEvent { public: @@ -60,7 +59,6 @@ class EventResolve : public Commons::IEvent }; typedef DPL::SharedPtr EventResolvePtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IManager.cpp b/src/modules/API/Filesystem/IManager.cpp index 7644767..92219f5 100644 --- a/src/modules/API/Filesystem/IManager.cpp +++ b/src/modules/API/Filesystem/IManager.cpp @@ -20,7 +20,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - IManager& IManager::getInstance() { static Manager instance; @@ -43,13 +42,10 @@ IManager::IManager() : Commons::ThreadEnum::FILESYSTEM_THREAD), Commons::EventRequestReceiver( Commons::ThreadEnum::FILESYSTEM_THREAD) -{ -} +{} IManager::~IManager() -{ -} - +{} } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IManager.h b/src/modules/API/Filesystem/IManager.h index 0f13dcf..bc3cf0d 100644 --- a/src/modules/API/Filesystem/IManager.h +++ b/src/modules/API/Filesystem/IManager.h @@ -33,7 +33,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - typedef std::vector LocationPaths; typedef std::vector LocationTypes; @@ -58,7 +57,8 @@ class IManager : /** * Gets path for specified location type. - * @param type Location type @see WrtDeviceApis::Api::Filesystem::LocationType. + * @param type Location type @see + * WrtDeviceApis::Api::Filesystem::LocationType. * @return Valid path or empty shared pointer. */ virtual IPathPtr getLocationPath(LocationType type) const = 0; @@ -119,12 +119,14 @@ class IManager : /** * Checks if node at specified path has supplied access rights. * @param path Path to the node. - * @param accessType Access right(s) to check @see AccessType. Multiple values + * @param accessType Access right(s) to check @see AccessType. Multiple + * values * can be passed using OR operator. - * @return True if specified node has supplied access rights, false otherwise. + * @return True if specified node has supplied access rights, false + * otherwise. */ virtual bool access(const IPathPtr& path, - int accessType) const = 0; + int accessType) const = 0; virtual void addOpenedNode(const INodePtr& node) = 0; virtual void removeOpenedNode(const INodePtr& node) = 0; @@ -139,7 +141,6 @@ class IManager : virtual void OnRequestReceived(const EventRemovePtr& event) = 0; virtual void OnRequestReceived(const EventFindPtr& event) = 0; }; // IManager - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/INode.cpp b/src/modules/API/Filesystem/INode.cpp index 6294148..cd30a04 100644 --- a/src/modules/API/Filesystem/INode.cpp +++ b/src/modules/API/Filesystem/INode.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - INode::INode() : Commons::EventRequestReceiver( Commons::ThreadEnum::FILESYSTEM_THREAD), @@ -27,13 +26,10 @@ INode::INode() : Commons::ThreadEnum::FILESYSTEM_THREAD), Commons::EventRequestReceiver( Commons::ThreadEnum::FILESYSTEM_THREAD) -{ -} +{} INode::~INode() -{ -} - +{} } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/INode.h b/src/modules/API/Filesystem/INode.h index f9cb8d1..c227aa9 100644 --- a/src/modules/API/Filesystem/INode.h +++ b/src/modules/API/Filesystem/INode.h @@ -34,7 +34,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class INode : public Commons::EventRequestReceiver, public Commons::EventRequestReceiver, @@ -92,7 +91,7 @@ class INode : * @deprecated */ virtual NodeList getChildNodes(const NodeFilterPtr& filter = - NodeFilterPtr()) const /* WRT_PLUGINS_DEPRECATED */ = 0; + NodeFilterPtr()) const /*DEPREC*/ = 0; /** * Gets list of direct descendant nodes. @@ -135,8 +134,8 @@ class INode : * - OPT_RECURSIVE - attempt to create all necessary sub-directories */ virtual INodePtr createChild(const IPathPtr& path, - NodeType type, - int options = OPT_NONE) = 0; + NodeType type, + int options = OPT_NONE) = 0; /** * Gets size of this node. @@ -179,7 +178,6 @@ class INode : protected: INode(); }; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/INodeTypes.h b/src/modules/API/Filesystem/INodeTypes.h index abd6b39..c1c49f7 100644 --- a/src/modules/API/Filesystem/INodeTypes.h +++ b/src/modules/API/Filesystem/INodeTypes.h @@ -26,14 +26,12 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class INode; typedef DPL::SharedPtr INodePtr; typedef std::vector NodeList; typedef NodeList::iterator NodeListIterator; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IPath.cpp b/src/modules/API/Filesystem/IPath.cpp index 70bebe3..de9b32d 100644 --- a/src/modules/API/Filesystem/IPath.cpp +++ b/src/modules/API/Filesystem/IPath.cpp @@ -19,7 +19,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - IPathPtr IPath::create(const std::string& str) { return Path::create(str); @@ -31,9 +30,7 @@ IPath::SeparatorType IPath::getSeparator() } IPath::~IPath() -{ -} - +{} } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IPath.h b/src/modules/API/Filesystem/IPath.h index 5c6d2f8..3c32abd 100644 --- a/src/modules/API/Filesystem/IPath.h +++ b/src/modules/API/Filesystem/IPath.h @@ -21,8 +21,7 @@ namespace WrtDeviceApis { namespace Filesystem { -namespace Api{ - +namespace Api { class IPath; typedef DPL::SharedPtr IPathPtr; @@ -98,19 +97,19 @@ class IPath }; inline const IPathPtr operator+(const IPath& lhs, - const IPath& rhs) + const IPath& rhs) { return IPath::create(lhs.getFullPath())->append(rhs.getFullPath()); } inline const IPathPtr operator+(const IPath& lhs, - const std::string& rhs) + const std::string& rhs) { return IPath::create(lhs.getFullPath())->append(rhs); } inline const IPathPtr operator+(const std::string& lhs, - const IPath& rhs) + const IPath& rhs) { return IPath::create(lhs)->append(rhs.getFullPath()); } @@ -144,7 +143,6 @@ inline bool operator!=(const std::string& lhs, const IPath& rhs) { return (lhs != rhs.getFullPath()); } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IStream.cpp b/src/modules/API/Filesystem/IStream.cpp index 6fb245e..b18f188 100644 --- a/src/modules/API/Filesystem/IStream.cpp +++ b/src/modules/API/Filesystem/IStream.cpp @@ -18,11 +18,8 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - IStream::~IStream() -{ -} - +{} } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/IStream.h b/src/modules/API/Filesystem/IStream.h index 1e3aa86..d39ddb0 100644 --- a/src/modules/API/Filesystem/IStream.h +++ b/src/modules/API/Filesystem/IStream.h @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - class IStream; typedef DPL::SharedPtr IStreamPtr; @@ -119,7 +118,6 @@ class IStream : private DPL::Noncopyable */ virtual long getSize() const = 0; }; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/NodeFilter.cpp b/src/modules/API/Filesystem/NodeFilter.cpp index c74e433..b26e275 100644 --- a/src/modules/API/Filesystem/NodeFilter.cpp +++ b/src/modules/API/Filesystem/NodeFilter.cpp @@ -22,7 +22,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - OptionalString NodeFilter::getName() const { return m_name; @@ -107,7 +106,6 @@ void NodeFilter::setSize(const OptionalSize& size) { m_size.min = m_size.max = size; } - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/NodeFilter.h b/src/modules/API/Filesystem/NodeFilter.h index ec20781..3c47549 100644 --- a/src/modules/API/Filesystem/NodeFilter.h +++ b/src/modules/API/Filesystem/NodeFilter.h @@ -30,7 +30,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { - typedef DPL::Optional OptionalString; typedef DPL::Optional OptionalDate; typedef DPL::Optional OptionalSize; @@ -73,7 +72,6 @@ class NodeFilter }; typedef DPL::SharedPtr NodeFilterPtr; - } // API } // Filesystem } // WrtDeviceApis diff --git a/src/modules/API/Filesystem/PathUtils.cpp b/src/modules/API/Filesystem/PathUtils.cpp index cdb0695..e2ac7de 100644 --- a/src/modules/API/Filesystem/PathUtils.cpp +++ b/src/modules/API/Filesystem/PathUtils.cpp @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { namespace PathUtils { - PathList getParts(const IPathPtr& path) { PathList result; @@ -36,7 +35,6 @@ PathList getParts(const IPathPtr& path) } return result; } - } // PathUtils } // API } // Filesystem diff --git a/src/modules/API/Filesystem/PathUtils.h b/src/modules/API/Filesystem/PathUtils.h index d5fecfc..40642f3 100644 --- a/src/modules/API/Filesystem/PathUtils.h +++ b/src/modules/API/Filesystem/PathUtils.h @@ -27,7 +27,6 @@ namespace WrtDeviceApis { namespace Filesystem { namespace Api { namespace PathUtils { - typedef std::vector PathList; typedef PathList::iterator PathListIterator; @@ -38,7 +37,6 @@ typedef PathList::iterator PathListIterator; * @return List of paths. */ PathList getParts(const IPathPtr& path); - } // PathUtils } // API } // Filesystem diff --git a/src/modules/API/LocalStorage/ILocalStorage.h b/src/modules/API/LocalStorage/ILocalStorage.h index d1a4db7..6ee677e 100644 --- a/src/modules/API/LocalStorage/ILocalStorage.h +++ b/src/modules/API/LocalStorage/ILocalStorage.h @@ -30,7 +30,6 @@ namespace WrtDeviceApis { namespace LocalStorage { namespace Api { - class ILocalStorage { public: @@ -56,19 +55,21 @@ class ILocalStorage * */ virtual DPL::Optional getValue( - const std::string& key) const = 0; + const std::string& key) const = 0; /** * Clears the local storage * @param removeReadOnly - true -remove all elements - * false - ommit items which have read only flag set + * false - ommit items which have read only flag + * set */ virtual void clear(bool removeReadOnly) = 0; /** * Get number of elements in local storage * @param removeReadOnly - true -remove all elements - * false - ommit items which have read only flag set + * false - ommit items which have read only flag + * set */ virtual size_t getStorageSize() const = 0; @@ -81,13 +82,10 @@ class ILocalStorage * virtual destructor */ virtual ~ILocalStorage() - { - } - + {} }; typedef DPL::SharedPtr ILocalStoragePtr; - } // Api } // LocalStorage } // WrtDeviceApis diff --git a/src/modules/API/LocalStorage/LocalStorageMgr.cpp b/src/modules/API/LocalStorage/LocalStorageMgr.cpp index 7ff636e..7cb7492 100644 --- a/src/modules/API/LocalStorage/LocalStorageMgr.cpp +++ b/src/modules/API/LocalStorage/LocalStorageMgr.cpp @@ -27,12 +27,10 @@ namespace WrtDeviceApis { namespace LocalStorage { namespace Api { - ILocalStoragePtr getLocalStorage(int widgetId) { return ILocalStoragePtr(new WrtDeviceApis::WidgetInterfaceDAO(widgetId)); } - } // Api } // LocalStorage } // WrtDeviceApis diff --git a/src/modules/API/LocalStorage/LocalStorageMgr.h b/src/modules/API/LocalStorage/LocalStorageMgr.h index 1accb4f..c892376 100644 --- a/src/modules/API/LocalStorage/LocalStorageMgr.h +++ b/src/modules/API/LocalStorage/LocalStorageMgr.h @@ -28,9 +28,7 @@ namespace WrtDeviceApis { namespace LocalStorage { namespace Api { - ILocalStoragePtr getLocalStorage(int widgetId); - } // Api } // LocalStorage } // WrtDeviceApis diff --git a/src/modules/API/Networking/EventConnected.cpp b/src/modules/API/Networking/EventConnected.cpp index 9a6b248..51a5799 100644 --- a/src/modules/API/Networking/EventConnected.cpp +++ b/src/modules/API/Networking/EventConnected.cpp @@ -17,7 +17,6 @@ namespace WrtDeviceApis { namespace Networking { -namespace Api { -} // Api +namespace Api {} // Api } // Networking } // WrtDeviceApis diff --git a/src/modules/API/Networking/EventDisconnected.cpp b/src/modules/API/Networking/EventDisconnected.cpp index 1cdf747..7be367a 100644 --- a/src/modules/API/Networking/EventDisconnected.cpp +++ b/src/modules/API/Networking/EventDisconnected.cpp @@ -17,7 +17,6 @@ namespace WrtDeviceApis { namespace Networking { -namespace Api { -} // Api +namespace Api {} // Api } // Networking } // WrtDeviceApis diff --git a/src/modules/API/Networking/IAdapter.cpp b/src/modules/API/Networking/IAdapter.cpp index 94ba294..5b94609 100644 --- a/src/modules/API/Networking/IAdapter.cpp +++ b/src/modules/API/Networking/IAdapter.cpp @@ -19,8 +19,7 @@ namespace WrtDeviceApis { namespace Networking { namespace Api { IAdapter::~IAdapter() -{ -} +{} } // Api } // Networking } // WrtDeviceApis diff --git a/src/modules/API/Networking/IConnection.cpp b/src/modules/API/Networking/IConnection.cpp index b8dabcb..d8bc537 100644 --- a/src/modules/API/Networking/IConnection.cpp +++ b/src/modules/API/Networking/IConnection.cpp @@ -19,8 +19,7 @@ namespace WrtDeviceApis { namespace Networking { namespace Api { IConnection::~IConnection() -{ -} +{} } // Api } // Networking } // WrtDeviceApis diff --git a/src/modules/API/Networking/IManager.cpp b/src/modules/API/Networking/IManager.cpp index a2438d9..fd3f216 100644 --- a/src/modules/API/Networking/IManager.cpp +++ b/src/modules/API/Networking/IManager.cpp @@ -25,8 +25,7 @@ IManager& IManager::getInstance() } IManager::~IManager() -{ -} +{} } // Api } // Networking } // WrtDeviceApis diff --git a/src/modules/API/PluginManager/IPluginManager.h b/src/modules/API/PluginManager/IPluginManager.h index 37848fb..d96652c 100644 --- a/src/modules/API/PluginManager/IPluginManager.h +++ b/src/modules/API/PluginManager/IPluginManager.h @@ -31,7 +31,6 @@ namespace WrtDeviceApis { namespace PluginManager { namespace Api { - class IPluginManager { public: @@ -52,7 +51,6 @@ class IPluginManager }; typedef DPL::SharedPtr IPluginManagerPtr; - } } } diff --git a/src/modules/API/PluginManager/PluginManagerFactory.cpp b/src/modules/API/PluginManager/PluginManagerFactory.cpp index 9cd39b8..3866028 100644 --- a/src/modules/API/PluginManager/PluginManagerFactory.cpp +++ b/src/modules/API/PluginManager/PluginManagerFactory.cpp @@ -26,10 +26,8 @@ namespace WrtDeviceApis { namespace PluginManager { namespace Api { - PluginManagerFactory::PluginManagerFactory() -{ -} +{} PluginManagerFactory& PluginManagerFactory::getInstance() { @@ -38,15 +36,14 @@ PluginManagerFactory& PluginManagerFactory::getInstance() } IPluginManagerPtr PluginManagerFactory::getPluginManager( - int widgetHandle, - const std::string &objectUri, - JSObjectRef object, - JSContextRef context) const + int widgetHandle, + const std::string &objectUri, + JSObjectRef object, + JSContextRef context) const { return IPluginManagerPtr( - new PluginManager(widgetHandle, objectUri, object, context)); + new PluginManager(widgetHandle, objectUri, object, context)); } - } } } diff --git a/src/modules/API/PluginManager/PluginManagerFactory.h b/src/modules/API/PluginManager/PluginManagerFactory.h index ed3c578..b13a36a 100644 --- a/src/modules/API/PluginManager/PluginManagerFactory.h +++ b/src/modules/API/PluginManager/PluginManagerFactory.h @@ -30,20 +30,19 @@ namespace WrtDeviceApis { namespace PluginManager { namespace Api { - class PluginManagerFactory : private DPL::Noncopyable { -public: + public: static PluginManagerFactory& getInstance(); IPluginManagerPtr getPluginManager( int widgetHandle, const std::string &objectUri, JSObjectRef object, JSContextRef context) const; -private: + + private: PluginManagerFactory(); }; - } } } diff --git a/src/modules/API/SoftKeyboardChangeEvent/ISoftKeyboardChangeEvent.h b/src/modules/API/SoftKeyboardChangeEvent/ISoftKeyboardChangeEvent.h index 2bc752b..a001b71 100644 --- a/src/modules/API/SoftKeyboardChangeEvent/ISoftKeyboardChangeEvent.h +++ b/src/modules/API/SoftKeyboardChangeEvent/ISoftKeyboardChangeEvent.h @@ -29,19 +29,17 @@ namespace WrtDeviceApis { namespace SoftKeyboardChangeEvent { namespace Api { - class ISoftKeyboardChangeEvent { - public : + public: virtual std::string getState() const = 0; virtual int getWidth() const = 0; virtual int getHeight() const = 0; - virtual ~ISoftKeyboardChangeEvent() {}; + virtual ~ISoftKeyboardChangeEvent() {} }; typedef std::shared_ptr ISoftKeyboardChangeEventPtr; - } // Api } // SoftKeyboardChangeEvent } // WrtDeviceApis diff --git a/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.cpp b/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.cpp index 154a014..7cd04ba 100644 --- a/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.cpp +++ b/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.cpp @@ -26,16 +26,13 @@ namespace WrtDeviceApis { namespace SoftKeyboardChangeEvent { namespace Api { - SoftKeyboardChangeEvent::SoftKeyboardChangeEvent( - std::string state, int width, int height): + std::string state, int width, int height) : m_state(state), m_width(width), m_height(height) -{ -} +{} SoftKeyboardChangeEvent::~SoftKeyboardChangeEvent() -{ -} +{} std::string SoftKeyboardChangeEvent::getState() const { @@ -51,7 +48,6 @@ int SoftKeyboardChangeEvent::getHeight() const { return m_height; } - } // Api } // SoftKeyboardChangeEvent } // WrtDeviceApis diff --git a/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.h b/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.h index ef28353..df8f721 100644 --- a/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.h +++ b/src/modules/API/SoftKeyboardChangeEvent/SoftKeyboardChangeEvent.h @@ -30,26 +30,24 @@ namespace WrtDeviceApis { namespace SoftKeyboardChangeEvent { namespace Api { - class SoftKeyboardChangeEvent : public ISoftKeyboardChangeEvent { - public : + public: explicit SoftKeyboardChangeEvent( - std::string state, - int width, - int height); + std::string state, + int width, + int height); ~SoftKeyboardChangeEvent(); std::string getState() const; int getWidth() const; int getHeight() const; - private : + private: std::string m_state; int m_width; int m_height; }; - } // Api } // SoftKeyboardChangeEvent } // WrtDeviceApis diff --git a/src/modules/API/StorageEvent/IStorageEvent.h b/src/modules/API/StorageEvent/IStorageEvent.h index 63be2da..5c34514 100644 --- a/src/modules/API/StorageEvent/IStorageEvent.h +++ b/src/modules/API/StorageEvent/IStorageEvent.h @@ -31,10 +31,9 @@ namespace WrtDeviceApis { namespace StorageEvent { namespace Api { - class IStorageEvent { - public : + public: virtual std::string getKey() const = 0; virtual DPL::OptionalString getOldValue() const = 0; @@ -47,11 +46,10 @@ class IStorageEvent virtual void setNewValue(const std::string &inValue) = 0; virtual void setUrl(const std::string &inUrl) = 0; virtual void setStorageArea( - const LocalStorage::Api::ILocalStoragePtr &inStorageArea) = 0; + const LocalStorage::Api::ILocalStoragePtr &inStorageArea) = 0; }; typedef DPL::SharedPtr IStorageEventPtr; - } // Api } // StorageEvent } // WrtDeviceApis diff --git a/src/modules/API/StorageEvent/StorageEvent.cpp b/src/modules/API/StorageEvent/StorageEvent.cpp index fd0734b..11068b7 100644 --- a/src/modules/API/StorageEvent/StorageEvent.cpp +++ b/src/modules/API/StorageEvent/StorageEvent.cpp @@ -26,12 +26,11 @@ namespace WrtDeviceApis { namespace StorageEvent { namespace Api { - StorageEvent::StorageEvent() : m_storageArea(NULL) {} StorageEvent::StorageEvent( - const LocalStorage::Api::ILocalStoragePtr &storageArea) : + const LocalStorage::Api::ILocalStoragePtr &storageArea) : m_storageArea(storageArea) {} std::string StorageEvent::getKey() const @@ -79,11 +78,10 @@ void StorageEvent::setUrl(const std::string &inUrl) } void StorageEvent::setStorageArea( - const LocalStorage::Api::ILocalStoragePtr &inStorageArea) + const LocalStorage::Api::ILocalStoragePtr &inStorageArea) { m_storageArea = inStorageArea; } - } // Api } // StorageEvent } // WrtDeviceApis diff --git a/src/modules/API/StorageEvent/StorageEvent.h b/src/modules/API/StorageEvent/StorageEvent.h index 661743a..37df421 100644 --- a/src/modules/API/StorageEvent/StorageEvent.h +++ b/src/modules/API/StorageEvent/StorageEvent.h @@ -30,14 +30,13 @@ namespace WrtDeviceApis { namespace StorageEvent { namespace Api { - class StorageEvent : public IStorageEvent { - public : + public: StorageEvent(); explicit StorageEvent( - const LocalStorage::Api::ILocalStoragePtr &storageArea); + const LocalStorage::Api::ILocalStoragePtr &storageArea); std::string getKey() const; DPL::OptionalString getOldValue() const; @@ -50,16 +49,15 @@ class StorageEvent : public IStorageEvent void setNewValue(const std::string &inValue); void setUrl(const std::string &inUrl); void setStorageArea( - const LocalStorage::Api::ILocalStoragePtr &inStorageArea); + const LocalStorage::Api::ILocalStoragePtr &inStorageArea); - private : + private: std::string m_key; DPL::OptionalString m_oldValue; DPL::OptionalString m_newValue; std::string m_url; LocalStorage::Api::ILocalStoragePtr m_storageArea; }; - } // Api } // StorageEvent } // WrtDeviceApis diff --git a/src/modules/API/StorageEvent/StorageEventMgr.cpp b/src/modules/API/StorageEvent/StorageEventMgr.cpp index ab7f185..92b8772 100644 --- a/src/modules/API/StorageEvent/StorageEventMgr.cpp +++ b/src/modules/API/StorageEvent/StorageEventMgr.cpp @@ -27,12 +27,10 @@ namespace WrtDeviceApis { namespace StorageEvent { namespace Api { - IStorageEventPtr getStorageEvent() { return IStorageEventPtr(new StorageEvent()); } - } // Api } // StorageEvent } // WrtDeviceApis diff --git a/src/modules/API/StorageEvent/StorageEventMgr.h b/src/modules/API/StorageEvent/StorageEventMgr.h index ca9e423..b519abd 100644 --- a/src/modules/API/StorageEvent/StorageEventMgr.h +++ b/src/modules/API/StorageEvent/StorageEventMgr.h @@ -29,9 +29,7 @@ namespace WrtDeviceApis { namespace StorageEvent { namespace Api { - IStorageEventPtr getStorageEvent(); - } // Api } // StorageEvent } // WrtDeviceApis diff --git a/src/modules/API/TizenServiceEvent/ITizenServiceEvent.h b/src/modules/API/TizenServiceEvent/ITizenServiceEvent.h index 6a6831d..8882b69 100644 --- a/src/modules/API/TizenServiceEvent/ITizenServiceEvent.h +++ b/src/modules/API/TizenServiceEvent/ITizenServiceEvent.h @@ -30,20 +30,18 @@ namespace WrtDeviceApis { namespace TizenServiceEvent { namespace Api { - class ITizenServiceEvent { - public : + public: virtual float getScale() const = 0; virtual std::string getBundle() const = 0; virtual void setScale(const float scale) = 0; virtual void setBundle(const std::string &bundle) = 0; - virtual ~ITizenServiceEvent() {}; + virtual ~ITizenServiceEvent() {} }; typedef DPL::SharedPtr ITizenServiceEventPtr; - } // Api } // TizenServiceEvent } // WrtDeviceApis diff --git a/src/modules/API/TizenServiceEvent/TizenServiceEvent.cpp b/src/modules/API/TizenServiceEvent/TizenServiceEvent.cpp index ba07076..79d4f9a 100644 --- a/src/modules/API/TizenServiceEvent/TizenServiceEvent.cpp +++ b/src/modules/API/TizenServiceEvent/TizenServiceEvent.cpp @@ -26,14 +26,11 @@ namespace WrtDeviceApis { namespace TizenServiceEvent { namespace Api { - TizenServiceEvent::TizenServiceEvent() -{ -} +{} TizenServiceEvent::~TizenServiceEvent() -{ -} +{} float TizenServiceEvent::getScale() const { @@ -54,7 +51,6 @@ void TizenServiceEvent::setBundle(const std::string& bundle) { m_bundle = bundle; } - } // Api } // TizenServiceEvent } // WrtDeviceApis diff --git a/src/modules/API/TizenServiceEvent/TizenServiceEvent.h b/src/modules/API/TizenServiceEvent/TizenServiceEvent.h index 3bceb3b..3b577f0 100644 --- a/src/modules/API/TizenServiceEvent/TizenServiceEvent.h +++ b/src/modules/API/TizenServiceEvent/TizenServiceEvent.h @@ -30,10 +30,9 @@ namespace WrtDeviceApis { namespace TizenServiceEvent { namespace Api { - class TizenServiceEvent : public ITizenServiceEvent { - public : + public: TizenServiceEvent(); ~TizenServiceEvent(); @@ -44,11 +43,10 @@ class TizenServiceEvent : public ITizenServiceEvent void setScale(const float scale); void setBundle(const std::string &bundle); - private : + private: float m_scale; std::string m_bundle; }; - } // Api } // TizenServiceEvent } // WrtDeviceApis diff --git a/src/modules/API/Widget/IWidget.h b/src/modules/API/Widget/IWidget.h index 9b2f97d..1936ee9 100644 --- a/src/modules/API/Widget/IWidget.h +++ b/src/modules/API/Widget/IWidget.h @@ -28,10 +28,9 @@ #include -namespace WrtDeviceApis{ -namespace Widget{ +namespace WrtDeviceApis { +namespace Widget { namespace Api { - class IWidget; typedef DPL::SharedPtr IWidgetPtr; @@ -120,10 +119,8 @@ class IWidget virtual unsigned int getWidth() const = 0; virtual ~IWidget() - { - } + {} }; - } } } diff --git a/src/modules/API/Widget/WidgetFactory.cpp b/src/modules/API/Widget/WidgetFactory.cpp index b402256..2197a75 100644 --- a/src/modules/API/Widget/WidgetFactory.cpp +++ b/src/modules/API/Widget/WidgetFactory.cpp @@ -28,12 +28,10 @@ namespace WrtDeviceApis { namespace Widget { namespace Api { - IWidgetPtr WidgetFactory::createWidget() { return IWidgetPtr(new WrtDeviceApis::Widget::Widget()); } - } } } diff --git a/src/modules/API/Widget/WidgetFactory.h b/src/modules/API/Widget/WidgetFactory.h index 9773e78..b068dc2 100644 --- a/src/modules/API/Widget/WidgetFactory.h +++ b/src/modules/API/Widget/WidgetFactory.h @@ -31,7 +31,6 @@ namespace WrtDeviceApis { namespace Widget { namespace Api { - class WidgetFactory : private DPL::Noncopyable { public: @@ -44,10 +43,8 @@ class WidgetFactory : private DPL::Noncopyable private: WidgetFactory() - { - } + {} }; - } } } diff --git a/src/modules/API/WidgetDB/IWidgetDB.h b/src/modules/API/WidgetDB/IWidgetDB.h index d35fd63..e0c3f9b 100644 --- a/src/modules/API/WidgetDB/IWidgetDB.h +++ b/src/modules/API/WidgetDB/IWidgetDB.h @@ -30,13 +30,13 @@ namespace WrtDeviceApis { namespace WidgetDB { namespace Api { - class IWidgetDB; typedef DPL::SharedPtr IWidgetDBPtr; typedef std::vector Features; -enum class ConfigAttribute { +enum class ConfigAttribute +{ ID, VERSION, DESCRIPTION, @@ -62,7 +62,6 @@ enum class InstallationStatus STATUS_UNINSTALLED }; - class IWidgetDB { public: @@ -76,9 +75,9 @@ class IWidgetDB virtual std::string getUserAgent() const = 0; virtual InstallationStatus checkInstallationStatus( - const std::string& gid, - const std::string& name, - const std::string& version) const = 0; + const std::string& gid, + const std::string& name, + const std::string& version) const = 0; virtual Features getWidgetFeatures() const = 0; @@ -91,11 +90,8 @@ class IWidgetDB virtual std::string getWidgetTemporaryStoragePath() const = 0; virtual ~IWidgetDB() - { - } - + {} }; - } // Api } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/API/WidgetDB/IWidgetFeature.h b/src/modules/API/WidgetDB/IWidgetFeature.h index 7ee91eb..17e635d 100644 --- a/src/modules/API/WidgetDB/IWidgetFeature.h +++ b/src/modules/API/WidgetDB/IWidgetFeature.h @@ -29,7 +29,6 @@ namespace WrtDeviceApis { namespace WidgetDB { namespace Api { - class IWidgetFeature { public: @@ -40,8 +39,7 @@ class IWidgetFeature public: virtual ~IWidgetFeature() - { - } + {} virtual std::string getName() const = 0; @@ -50,13 +48,12 @@ class IWidgetFeature virtual Params getParams() const = 0; virtual void addParam(const std::string& paramName, - const std::string& paramValue) = 0; + const std::string& paramValue) = 0; virtual bool isRequestedByWidget() const = 0; }; typedef DPL::SharedPtr IWidgetFeaturePtr; - } // Api } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/API/WidgetDB/WidgetDBMgr.cpp b/src/modules/API/WidgetDB/WidgetDBMgr.cpp index d8d6ab2..b275f33 100644 --- a/src/modules/API/WidgetDB/WidgetDBMgr.cpp +++ b/src/modules/API/WidgetDB/WidgetDBMgr.cpp @@ -27,12 +27,10 @@ namespace WrtDeviceApis { namespace WidgetDB { namespace Api { - IWidgetDBPtr getWidgetDB(int widgetId) { return IWidgetDBPtr(new WrtDeviceApis::WidgetDB::WidgetDB(widgetId)); } - } // Api } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/API/WidgetDB/WidgetDBMgr.h b/src/modules/API/WidgetDB/WidgetDBMgr.h index 78810e5..6de3f99 100644 --- a/src/modules/API/WidgetDB/WidgetDBMgr.h +++ b/src/modules/API/WidgetDB/WidgetDBMgr.h @@ -28,9 +28,7 @@ namespace WrtDeviceApis { namespace WidgetDB { namespace Api { - IWidgetDBPtr getWidgetDB(int widgetId); - } // Api } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp index f4ec621..b0cfc2d 100644 --- a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp +++ b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp @@ -42,7 +42,8 @@ const char* EMAIL_PATTERN = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+$"; const char* HTTP_ADDRESS_PATTERN = "^(http(s)?://)?\\w+.*$"; const char* FILE_ADDRESS_PATTERN = "^.*\\..*$"; -const char* APPLICATION_ALARM = "org.tizen.clock"; // alarm has been included in clock app +const char* APPLICATION_ALARM = "org.tizen.clock"; // alarm has been + // included in clock app const char* APPLICATION_BROWSER = "org.tizen.browser"; const char* APPLICATION_CALCULATOR = "org.tizen.calculator"; const char* APPLICATION_CALENDAR = "org.tizen.efl-calendar"; @@ -234,7 +235,10 @@ bool AppLauncherManager::initializeApplicationList() APPLICATION_TYPE_WIDGET_MANAGER, APPLICATION_EMPTY)); - bool registered_application = false; // A variable that gets set if the current pkg_name is needed by WAC spec, needless of weather the package is visible or not. + bool registered_application = false; // A variable that gets set if the + // current pkg_name is needed by WAC + // spec, needless of weather the + // package is visible or not. app_info info = {}; unsigned int count = record_count(COUNT_MENU, &info); LogDebug("number of registered applications: " << count); @@ -254,14 +258,16 @@ bool AppLauncherManager::initializeApplicationList() LogDebug("app_name " << infoAll.Get()[i].app_name); registered_application = false; if (infoAll.Get()[i].app_path == NULL || - infoAll.Get()[i].app_name == NULL) { + infoAll.Get()[i].app_name == NULL) + { LogDebug("Not Registered."); LogDebug("-----"); continue; } if (0 == strncmp(APPLICATION_ALARM, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_ALARM] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_ALARM] = @@ -270,7 +276,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_BROWSER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_BROWSER] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_BROWSER] = @@ -279,7 +286,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_CALCULATOR, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_CALCULATOR] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_CALCULATOR] = @@ -288,7 +296,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_CALENDAR, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_CALENDAR] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_CALENDAR] = @@ -297,7 +306,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_CAMERA, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_CAMERA] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_CAMERA] = @@ -306,7 +316,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_CONTACTS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_CONTACTS] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_CONTACTS] = @@ -315,7 +326,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_FILES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_FILES] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_FILES] = @@ -324,7 +336,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_GAMES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_GAMES] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_GAMES] = @@ -333,7 +346,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_MAIL, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_MAIL] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_MAIL] = @@ -342,7 +356,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_MEDIAPLAYER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_MEDIAPLAYER] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_MEDIAPLAYER] = @@ -351,7 +366,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_MESSAGING, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_MESSAGING] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_MESSAGING] = @@ -360,7 +376,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_PHONECALL, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_PHONECALL] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_PHONECALL] = @@ -369,7 +386,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_PICTURES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_PICTURES] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_PICTURES] = @@ -378,7 +396,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_PROG_MANAGER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_PROG_MANAGER] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_PROG_MANAGER] = @@ -387,7 +406,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_SETTINGS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_SETTINGS] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_SETTINGS] = @@ -396,7 +416,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_TASKS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_TASKS] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_TASKS] = @@ -405,7 +426,8 @@ bool AppLauncherManager::initializeApplicationList() } if (0 == strncmp(APPLICATION_WIDGET_MANAGER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { + NAME_LEN)) + { m_applicationTypesByPath[APPLICATION_TYPE_WIDGET_MANAGER] = infoAll.Get()[i].app_path; m_applicationTypesByName[APPLICATION_TYPE_WIDGET_MANAGER] = @@ -413,7 +435,8 @@ bool AppLauncherManager::initializeApplicationList() registered_application = true; } if (infoAll.Get()[i].visible == 0 && registered_application == - false) { + false) + { LogDebug("Not Registered."); LogDebug("-----"); continue; @@ -428,13 +451,14 @@ bool AppLauncherManager::initializeApplicationList() } ApplicationType AppLauncherManager::getRegisteredApplicationType( - const std::string &name) const + const std::string &name) const { if (!name.empty()) { std::map::const_iterator it; for (it = m_applicationTypesByPath.begin(); it != m_applicationTypesByPath.end(); - ++it) { + ++it) + { if (it->second == name) { return it->first; } @@ -496,16 +520,19 @@ std::string AppLauncherManager::getRealPath(const std::string &path) const } std::string AppLauncherManager::getPathFromApplicationName( - const std::string &applicationName) const + const std::string &applicationName) const { if (0 == applicationName.find(WIDGET_URI_PREFIX) && std::string::npos != - applicationName.find("?")) { + applicationName.find("?")) + { //uri format is: widget://{widgetId}?wname={WidgetName} LogDebug("found widget:// URI"); std::string uri = applicationName; uri.erase(0, strlen(WIDGET_URI_PREFIX)); //remove widget://part std::string widgetId = uri.substr(0, uri.find("?")); - uri.erase(0, widgetId.size() + 7); //remove widget id and "?wname=" string, so uri contains only widget name now + uri.erase(0, widgetId.size() + 7); //remove widget id and "?wname=" + // string, so uri contains only + // widget name now std::string packageName = APPLICATION_WIDGET + widgetId; LogDebug( "Widget id: " << widgetId << ", widget name: " << uri << @@ -527,7 +554,7 @@ std::string AppLauncherManager::getPathFromApplicationName( } std::string AppLauncherManager::getPathFromPackageName( - const std::string &packageName) const + const std::string &packageName) const { app_info info = { 0, }; strncpy(info.pkg_name, packageName.c_str(), NAME_LEN); @@ -559,8 +586,8 @@ const } int AppLauncherManager::launchApplicationFileInternal( - const std::string &uriParameter, - const std::vector &applicationParams) + const std::string &uriParameter, + const std::vector &applicationParams) { LogDebug("entered with uriParameter: '" << uriParameter << "'"); ApplicationType appType = getRegisteredApplicationType(uriParameter); @@ -577,7 +604,8 @@ int AppLauncherManager::launchApplicationFileInternal( std::vector::const_iterator it; for (it = applicationParams.begin(); it != applicationParams.end(); - ++it) { + ++it) + { std::string param(Commons::String::trim(*it)); if (param.empty()) { continue; @@ -588,14 +616,18 @@ int AppLauncherManager::launchApplicationFileInternal( if (params.size() > 0) { if (appType == APPLICATION_TYPE_PHONECALL) { //phone number is provided. - //replace package to make a call, not run application with this functionality + //replace package to make a call, not run application with this + // functionality packageName = APPLICATION_PHONECALL_CALLING; kb = bundle_create(); if (!kb) { return ERROR_LAUNCHER_EXECUTION_ERROR; } - if (bundle_add(kb, "launch-type", "MO") < 0) { // "MO" : normal call, "EMERGENCY" : emergency call + if (bundle_add(kb, "launch-type", "MO") < 0) { // "MO" : normal + // call, + // "EMERGENCY" : + // emergency call bundle_free(kb); return ERROR_LAUNCHER_EXECUTION_ERROR; } @@ -650,7 +682,8 @@ int AppLauncherManager::launchApplicationFileInternal( } if (bundle_add(kb, "path", getRealPath(params.front()).c_str()) < - 0) { + 0) + { bundle_free(kb); return ERROR_LAUNCHER_EXECUTION_ERROR; } @@ -671,7 +704,8 @@ int AppLauncherManager::launchApplicationFileInternal( return ERROR_LAUNCHER_EXECUTION_ERROR; } if (bundle_add(kb, "Path", - getRealPath(params.front()).c_str()) < 0) { + getRealPath(params.front()).c_str()) < 0) + { bundle_free(kb); return ERROR_LAUNCHER_EXECUTION_ERROR; } @@ -694,9 +728,9 @@ int AppLauncherManager::launchApplicationFileInternal( } int AppLauncherManager::launchApplicationInternal( - const ApplicationUriType uriType, - const std::string &uriParameter, - const std::vector &applicationParams) + const ApplicationUriType uriType, + const std::string &uriParameter, + const std::vector &applicationParams) { LogDebug( "entered with uriType: " << uriType << ", uriParameter: " << @@ -753,7 +787,7 @@ int AppLauncherManager::launchApplicationInternal( } std::string AppLauncherManager::getDefaultApplicationByMimeInternal( - const std::string &mime) const + const std::string &mime) const { LogDebug("entered with mime: " << mime); const int bufferSize = 1024; @@ -770,7 +804,7 @@ std::string AppLauncherManager::getDefaultApplicationByMimeInternal( } void AppLauncherManager::OnRequestReceived( - const EventGetDefaultApplicationPtr &event) + const EventGetDefaultApplicationPtr &event) { LogDebug("entered"); Try @@ -786,36 +820,40 @@ void AppLauncherManager::OnRequestReceived( } void AppLauncherManager::OnRequestReceived( - const EventGetInstalledApplicationsPtr &event) + const EventGetInstalledApplicationsPtr &event) { LogDebug("entered"); std::vector::const_iterator it1; for (it1 = m_installedApplications.begin(); it1 != m_installedApplications.end(); - ++it1) { + ++it1) + { event->addApplicationFullPath(*it1); } for (it1 = m_installedApplicationsNames.begin(); it1 != m_installedApplicationsNames.end(); - ++it1) { + ++it1) + { event->addApplicationName(*it1); } std::map::const_iterator it2; for (it2 = m_applicationTypesByPath.begin(); it2 != m_applicationTypesByPath.end(); - ++it2) { + ++it2) + { event->addApplicationTypeByPath(*it2); } for (it2 = m_applicationTypesByName.begin(); it2 != m_applicationTypesByName.end(); - ++it2) { + ++it2) + { event->addApplicationTypeByName(*it2); } event->setExceptionCode(Commons::ExceptionCodes::None); } void AppLauncherManager::OnRequestReceived( - const EventLaunchApplicationPtr &event) + const EventLaunchApplicationPtr &event) { LogDebug("entered"); ApplicationUriType uriType = event->getApplicationUriType(); @@ -825,7 +863,8 @@ void AppLauncherManager::OnRequestReceived( if (result == SUCCESS_LAUNCHER) { event->setExceptionCode(Commons::ExceptionCodes::None); } else if (result == ERROR_LAUNCHER_INVALID_PARAMETER || - result == ERROR_LAUNCHER_INVALID_URI) { + result == ERROR_LAUNCHER_INVALID_URI) + { event->setExceptionCode( Commons::ExceptionCodes::InvalidArgumentException); } else { diff --git a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h index d540831..f34fc4a 100644 --- a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h +++ b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h @@ -39,16 +39,17 @@ class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager public: AppLauncherManager(); virtual ~AppLauncherManager(); + protected: virtual void OnRequestReceived( - const Api::AppLauncher::EventGetDefaultApplicationPtr &event); + const Api::AppLauncher::EventGetDefaultApplicationPtr &event); virtual void OnRequestReceived( - const Api::AppLauncher::EventGetInstalledApplicationsPtr &event); + const Api::AppLauncher::EventGetInstalledApplicationsPtr &event); virtual void OnRequestReceived( - const Api::AppLauncher::EventLaunchApplicationPtr &event); + const Api::AppLauncher::EventLaunchApplicationPtr &event); virtual bool isRegisteredApplication(const std::string &name) const; virtual Api::AppLauncher::ApplicationType getRegisteredApplicationType( - const std::string &name) const; + const std::string &name) const; virtual std::string getRealPath(const std::string &path) const; virtual bool validateHttpAddress(const std::string &value) const; virtual bool validateEmailAddress(const std::string &value) const; @@ -63,11 +64,13 @@ class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager std::string getDefaultApplicationByMimeInternal(const std::string &mime) const; int launchApplicationInternal( - const Api::AppLauncher::ApplicationUriType uriType, - const std::string &uriParameter, - const std::vector &applicationParams); - int launchApplicationFileInternal(const std::string &uriParameter, - const std::vector &applicationParam); + const Api::AppLauncher::ApplicationUriType uriType, + const std::string &uriParameter, + const std::vector &applicationParams); + int launchApplicationFileInternal( + const std::string &uriParameter, + const std::vector & + applicationParam); static std::map m_applicationTypesByPath; static std::map #include - namespace WrtDeviceApis { namespace Camera { - template class CameraPrivateData { -public: + public: Camera* camera; EventPtr event; }; @@ -48,15 +46,17 @@ enum EventTypeId class OpaquePrivateData { -public: + public: EventTypeId eventTypeId; void* cameraPrivateData; }; - //GetEventTypeId template -EventTypeId getEventTypeId(const T& event){ Assert(0); } +EventTypeId getEventTypeId(const T& event) +{ + Assert(0); +} template<> EventTypeId getEventTypeId( @@ -99,7 +99,7 @@ OpaquePrivateData* createPrivateOpaqueData(Camera* camera, template CameraPrivateData* getPrivateData(void* data) { - OpaquePrivateData* opaqueData = static_cast (data); + OpaquePrivateData* opaqueData = static_cast(data); CameraPrivateData* privateData = static_cast *> @@ -111,7 +111,7 @@ CameraPrivateData* getPrivateData(void* data) template void deletePrivateData(void* data) { - OpaquePrivateData* opaqueData = static_cast (data); + OpaquePrivateData* opaqueData = static_cast(data); CameraPrivateData* privateData = static_cast *> @@ -121,18 +121,16 @@ void deletePrivateData(void* data) delete opaqueData; } - template EventType createEvent(const EventArg& arg1) { return EventType(arg1); } - template class BaseCallbackHandler : private DPL::Noncopyable { -public: + public: explicit BaseCallbackHandler(void* data) : m_camera(NULL) { @@ -163,9 +161,9 @@ public: virtual ~BaseCallbackHandler(){ } protected: - virtual void setPrivate(void* /*data*/) {}; + virtual void setPrivate(void* /*data*/) {} -protected: + protected: Camera* m_camera; EventType m_event; }; @@ -174,32 +172,33 @@ template class CallbackHandler : public BaseCallbackHandler { static_assert(WrtDeviceApis::Commons::AlwaysFalse::value, - "Error, no specialization found for given type"); + "Error, no specialization found for given type"); public: explicit CallbackHandler(void* data) : BaseCallbackHandler(data) - { - } + {} //virtual void post(){ } }; template<> -class CallbackHandler - : public BaseCallbackHandler +class CallbackHandler: + public BaseCallbackHandler { public: explicit CallbackHandler(void* data) : BaseCallbackHandler(data) {} - virtual void post(){ + virtual void post() + { this->m_camera->setRecordingState(Camera::COMPLETED); this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); + DPL::Event::ControllerEventHandler:: + PostEvent( + createEvent(this->m_event)); } virtual void handleSuccessCallback(void* data) @@ -211,19 +210,21 @@ class CallbackHandler }; template<> -class CallbackHandler - : public BaseCallbackHandler +class CallbackHandler: + public BaseCallbackHandler { public: explicit CallbackHandler(void* data) : BaseCallbackHandler(data) {} - virtual void post(){ + virtual void post() + { this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); + DPL::Event::ControllerEventHandler:: + PostEvent( + createEvent(this->m_event)); } virtual void setPrivate(void* data) @@ -233,19 +234,21 @@ class CallbackHandler }; template<> -class CallbackHandler - : public BaseCallbackHandler +class CallbackHandler: + public BaseCallbackHandler { public: explicit CallbackHandler(void* data) : BaseCallbackHandler(data) {} - virtual void post(){ + virtual void post() + { this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); + DPL::Event::ControllerEventHandler:: + PostEvent( + createEvent(this->m_event)); } virtual void setPrivate(void* data) @@ -257,7 +260,7 @@ class CallbackHandler Camera::Camera(const Commons::IWrtCameraPtr& wrtCamera) : m_wrtCamera(wrtCamera), - m_stateRecordingVideo (Camera::IDLE) + m_stateRecordingVideo(Camera::IDLE) { CameraJobDoneController::Touch(); } @@ -269,9 +272,8 @@ Camera::~Camera() CameraJobDoneController::SwitchToThread(NULL); } - void Camera::OnRequestReceived( - const Api::EventTakePictureSharedPtr & event) + const Api::EventTakePictureSharedPtr & event) { LogDebug("enter"); @@ -282,13 +284,13 @@ void Camera::OnRequestReceived( camCaptureImageSuccessCallback, camCaptureImageErrorCallback, setPendingOperation, - createPrivateOpaqueData(this,event)); + createPrivateOpaqueData(this, event)); LogDebug("leaving"); } void Camera::OnRequestReceived( - const Api::EventBeginRecordingSharedPtr & event) + const Api::EventBeginRecordingSharedPtr & event) { LogDebug("enter"); @@ -306,13 +308,13 @@ void Camera::OnRequestReceived( camCaptureVideoSuccessCallback, camCaptureVideoErrorCallback, setPendingOperation, - createPrivateOpaqueData(this,event)); + createPrivateOpaqueData(this, event)); LogDebug("leaving"); } void Camera::OnRequestReceived( - const Api::EventEndRecordingSharedPtr & event) + const Api::EventEndRecordingSharedPtr & event) { LogDebug("end request"); if (m_stateRecordingVideo == Camera::PROCESSING) { @@ -324,7 +326,7 @@ void Camera::OnRequestReceived( } void Camera::OnRequestReceived( - const Api::EventGetPreviewNodeSharedPtr & event) + const Api::EventGetPreviewNodeSharedPtr & event) { LogDebug("enter"); @@ -335,12 +337,12 @@ void Camera::OnRequestReceived( m_wrtCamera->createPreviewNode(camPreviewSuccessCallback, camPreviewErrorCallback, setPendingOperation, - createPrivateOpaqueData(this,event)); + createPrivateOpaqueData(this, event)); LogDebug("leaving"); } void Camera::camCaptureImageSuccessCallback( - const char* filename, void* data) + const char* filename, void* data) { LogDebug("*Picture* Captured. !!!"); @@ -357,7 +359,7 @@ void Camera::camCaptureVideoSuccessCallback(const char* filename, void* data) } void Camera::camPreviewSuccessCallback( - Commons::IWrtCamera::CameraPreviewNode node, void* data) + Commons::IWrtCamera::CameraPreviewNode node, void* data) { LogDebug("enter"); @@ -411,7 +413,7 @@ void Camera::OnEventReceived(const JobDoneTakePictureEvent &event) } void Camera::OnCancelEvent( - const Api::EventBeginRecordingSharedPtr& event) + const Api::EventBeginRecordingSharedPtr& event) { LogDebug(__FUNCTION__); @@ -447,36 +449,34 @@ void Camera::setPendingOperation( LogDebug("Set pending operation callback invoked"); Assert(data); - OpaquePrivateData* opaqueData = static_cast (data); + OpaquePrivateData* opaqueData = static_cast(data); Assert(opaqueData->cameraPrivateData); switch (opaqueData->eventTypeId) { case BeginRecordingType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } + { + static_cast* >( + opaqueData->cameraPrivateData) + ->event->setPendingOperation(pendingOperation); + break; + } case CreatePreviewType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } + { + static_cast* >( + opaqueData->cameraPrivateData) + ->event->setPendingOperation(pendingOperation); + break; + } case TakePictureType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } - default: - Assert(0); + { + static_cast* >( + opaqueData->cameraPrivateData) + ->event->setPendingOperation(pendingOperation); + break; + } + default: + Assert(0); } } - - } } diff --git a/src/modules/tizen/DEPRACATED/Camera-Webkit/Camera.h b/src/modules/tizen/DEPRACATED/Camera-Webkit/Camera.h index 27201fe..c1abf01 100644 --- a/src/modules/tizen/DEPRACATED/Camera-Webkit/Camera.h +++ b/src/modules/tizen/DEPRACATED/Camera-Webkit/Camera.h @@ -37,9 +37,8 @@ #include #include -namespace WrtDeviceApis{ -namespace Camera{ - +namespace WrtDeviceApis { +namespace Camera { DECLARE_GENERIC_EVENT_1(JobDoneTakePictureEvent, Camera::Api::EventTakePictureSharedPtr) DECLARE_GENERIC_EVENT_1(JobDoneVideoRecordingEvent, @@ -47,25 +46,24 @@ DECLARE_GENERIC_EVENT_1(JobDoneVideoRecordingEvent, DECLARE_GENERIC_EVENT_1(JobDoneCreatePreviewEvent, Camera::Api::EventGetPreviewNodeSharedPtr) - typedef DPL::TypeListDecl::Type JobDoneEvents; + >::Type JobDoneEvents; typedef DPL::Event::Controller CameraJobDoneController; -class Camera: public Api::ICamera, - public CameraJobDoneController +class Camera : public Api::ICamera, + public CameraJobDoneController { -public: - enum CameraState{ + public: + enum CameraState { IDLE, PROCESSING, COMPLETED }; -public: + public: explicit Camera(const Commons::IWrtCameraPtr& wrtCamera); virtual ~Camera(); @@ -89,13 +87,13 @@ public: void setRecordingState(CameraState state); -private: + private: static void camCaptureImageSuccessCallback(const char* filename, void* data); static void camCaptureVideoSuccessCallback(const char* filename, void* data); static void camPreviewSuccessCallback( - Commons::IWrtCamera::CameraPreviewNode node, void* data); + Commons::IWrtCamera::CameraPreviewNode node, void* data); static void camCaptureImageErrorCallback(int errorCode, void* data); static void camCaptureVideoErrorCallback(int errorCode, void* data); @@ -105,7 +103,7 @@ private: bool checkHighResolutionRequired(const EventType& event) const { return event->getCaptureOptionsRef()->getImageResolution() - == Api::ICaptureOptions::IMAGE_RESOLUTION_HIGH; + == Api::ICaptureOptions::IMAGE_RESOLUTION_HIGH; } template @@ -129,14 +127,14 @@ private: } static void setPendingOperation( - Commons::IWrtCamera::CameraPendingOperation pendingOperation, void* data); + Commons::IWrtCamera::CameraPendingOperation pendingOperation, + void* data); -private: + private: Commons::IWrtCameraPtr m_wrtCamera; CameraState m_stateRecordingVideo; }; - } } #endif /* WRTPLUGINSCAMERA_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.cpp b/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.cpp index 53d26dd..cc7fa88 100644 --- a/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.cpp +++ b/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.cpp @@ -27,23 +27,21 @@ namespace WrtDeviceApis { namespace Camera { - void CameraManager::OnRequestReceived( const Api::EventGetCamerasPtr &event) { LogDebug(__FUNCTION__); - try - { + try { if (m_cameras.empty()) { DPL::Mutex::ScopedLock lock(&m_accessMutex); if (m_cameras.empty()) { Commons::IWrtCameraManager::WrtCamerasPtr cameras; cameras = event-> - getConfiguration()-> + getConfiguration()-> getWrtWrapper()-> - getCameraManagerInterface()-> - getCameras(); + getCameraManagerInterface()-> + getCameras(); FOREACH(it, *cameras) { @@ -52,15 +50,12 @@ void CameraManager::OnRequestReceived( } } } - event->setCamerasRef(m_cameras,0); + event->setCamerasRef(m_cameras, 0); LogDebug("Nr of cameras: " << m_cameras.size()); - } - catch(const Commons::Exception &exc) - { + } catch (const Commons::Exception &exc) { LogError("Exception has occurred: " << std::hex << exc.getCode()); event->setExceptionCode(exc.getCode()); } } - } } diff --git a/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.h b/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.h index 6fce3eb..754717a 100644 --- a/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.h +++ b/src/modules/tizen/DEPRACATED/Camera-Webkit/CameraManager.h @@ -29,17 +29,15 @@ namespace WrtDeviceApis { namespace Camera { - class CameraManager : public Api::ICameraManager { -protected: + protected: virtual void OnRequestReceived( const Api::EventGetCamerasPtr &event); -private: + private: DPL::Mutex m_accessMutex; }; - } } #endif /* */ diff --git a/src/modules/tizen/DEPRACATED/Device/Manager.cpp b/src/modules/tizen/DEPRACATED/Device/Manager.cpp index f77c660..3677a1c 100644 --- a/src/modules/tizen/DEPRACATED/Device/Manager.cpp +++ b/src/modules/tizen/DEPRACATED/Device/Manager.cpp @@ -31,8 +31,7 @@ Manager& Manager::getInstance() } Manager::~Manager() -{ -} +{} bool Manager::hasClamshell() const { @@ -67,8 +66,7 @@ std::string Manager::getImei() const } Manager::Manager() : m_imei(VCONFKEY_TELEPHONY_IMEI) -{ -} +{} } // Device } // Platform } // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Display/Manager.cpp b/src/modules/tizen/DEPRACATED/Display/Manager.cpp index 3bdb2c1..e732980 100644 --- a/src/modules/tizen/DEPRACATED/Display/Manager.cpp +++ b/src/modules/tizen/DEPRACATED/Display/Manager.cpp @@ -64,8 +64,7 @@ Manager::~Manager() } Manager::Manager() -{ -} +{} } // Display } // Platform } // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Display/Screen.cpp b/src/modules/tizen/DEPRACATED/Display/Screen.cpp index 214bb6f..bc2dc4c 100644 --- a/src/modules/tizen/DEPRACATED/Display/Screen.cpp +++ b/src/modules/tizen/DEPRACATED/Display/Screen.cpp @@ -96,7 +96,7 @@ Api::Display::State Screen::getState() const } void Screen::addOnChangeOrientation( - const Api::Display::EventChangeOrientationEmitterPtr& emitter) + const Api::Display::EventChangeOrientationEmitterPtr& emitter) { m_onChangeOrientation.attach(emitter); ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock(); @@ -109,7 +109,7 @@ void Screen::addOnChangeOrientation( } void Screen::removeOnChangeOrientation( - Api::Display::EventChangeOrientationEmitter::IdType id) + Api::Display::EventChangeOrientationEmitter::IdType id) { m_onChangeOrientation.detach(id); ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock(); @@ -122,7 +122,7 @@ void Screen::removeOnChangeOrientation( } void Screen::addOnChangeState( - const Api::Display::EventChangeStateEmitterPtr& emitter) + const Api::Display::EventChangeStateEmitterPtr& emitter) { m_onChangeState.attach(emitter); ChangeStateEmitters::LockType lock = m_onChangeState.getLock(); @@ -132,7 +132,7 @@ void Screen::addOnChangeState( } void Screen::removeOnChangeState( - Api::Display::EventChangeStateEmitter::IdType id) + Api::Display::EventChangeStateEmitter::IdType id) { m_onChangeState.detach(id); ChangeStateEmitters::LockType lock = m_onChangeState.getLock(); @@ -144,12 +144,11 @@ void Screen::removeOnChangeState( Screen::Screen(std::size_t index) : m_index(index), m_powerState(VCONFKEY_PM_STATE) -{ -} +{} bool Screen::getXDpyProperty(const char* pattern, - const pcrecpp::Arg& arg1, - const pcrecpp::Arg& arg2) + const pcrecpp::Arg& arg1, + const pcrecpp::Arg& arg2) { FILE* pipe = popen(COMMAND_XDPYINFO, "r"); if (pipe == NULL) { @@ -172,7 +171,7 @@ bool Screen::getXDpyProperty(const char* pattern, } void Screen::onChangeState(const VConf::Node* /*node*/, - void* data) + void* data) { Screen* this_ = static_cast(data); Api::Display::EventChangeStatePtr event(new Api::Display::EventChangeState()); @@ -186,7 +185,7 @@ void Screen::onChangeState(const VConf::Node* /*node*/, } int Screen::onChangeOrientation(appcore_rm rot, - void* data) + void* data) { Screen* this_ = static_cast(data); Api::Display::EventChangeOrientationPtr event( diff --git a/src/modules/tizen/DEPRACATED/Display/Screen.h b/src/modules/tizen/DEPRACATED/Display/Screen.h index 143a66d..c09b772 100644 --- a/src/modules/tizen/DEPRACATED/Display/Screen.h +++ b/src/modules/tizen/DEPRACATED/Display/Screen.h @@ -66,19 +66,19 @@ class Screen : public Api::Display::IScreen * @see WrtPlugins::Api::Display::IScreen::addOnChangeOrientation() */ void addOnChangeOrientation( - const Api::Display::EventChangeOrientationEmitterPtr& emitter); + const Api::Display::EventChangeOrientationEmitterPtr& emitter); /** * @see WrtPlugins::Api::Display::IScreen::removeOnChangeOrientation() */ void removeOnChangeOrientation( - Api::Display::EventChangeOrientationEmitter::IdType id); + Api::Display::EventChangeOrientationEmitter::IdType id); /** * @see WrtPlugins::Api::Display::IScreen::addOnChangeState() */ void addOnChangeState( - const Api::Display::EventChangeStateEmitterPtr& emitter); + const Api::Display::EventChangeStateEmitterPtr& emitter); /** * @see WrtPlugins::Api::Display::IScreen::removeOnChangeState() @@ -97,8 +97,8 @@ class Screen : public Api::Display::IScreen * @return Zero or positive value on success, -1 on failure. */ static bool getXDpyProperty(const char* pattern, - const pcrecpp::Arg& arg1 = pcrecpp::RE::no_arg, - const pcrecpp::Arg& arg2 = pcrecpp::RE::no_arg); + const pcrecpp::Arg& arg1 = pcrecpp::RE::no_arg, + const pcrecpp::Arg& arg2 = pcrecpp::RE::no_arg); /** * Callback run when device's power state changes. @@ -106,7 +106,7 @@ class Screen : public Api::Display::IScreen * @param data User data. */ static void onChangeState(const VConf::Node* node, - void* data); + void* data); /** * Callback run when device's orientation changes. @@ -115,14 +115,15 @@ class Screen : public Api::Display::IScreen * @return Error code (?) - not specified in documentation. */ static int onChangeOrientation(appcore_rm rot, - void* data); + void* data); protected: explicit Screen(std::size_t index); protected: std::size_t m_index; ///< Index of the screen. - ChangeOrientationEmitters m_onChangeOrientation; ///< Change orientation emitters. + ChangeOrientationEmitters m_onChangeOrientation; ///< Change orientation + // emitters. ChangeStateEmitters m_onChangeState; ///< Change state emitters. VConf::Key m_powerState; ///< Key for power manager state. }; diff --git a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp index 35b08ac..484d664 100644 --- a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp +++ b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp @@ -26,9 +26,11 @@ using namespace WrtPlugins::Api; namespace WrtPlugins { namespace Platform { -//static void wrtPlatformCallback(int widgetHandler, JSObjectRef object, void* userParam) +//static void wrtPlatformCallback(int widgetHandler, JSObjectRef object, void* +// userParam) //{ -// FeatureManager::platformCallback(widgetHandler, static_cast(object), userParam); +// FeatureManager::platformCallback(widgetHandler, +// static_cast(object), userParam); //} void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event) @@ -40,14 +42,16 @@ void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event) DPL::StaticPointerCast( event->getPrivateData()); - /* TODO uncomment - this function _will_ be available in new wrt-engine API */ + /* TODO uncomment - this function _will_ be available in new wrt-engine API + **/ LogError("*** CRITICAL wrt_dynamic_feature_request is disable!"); - // wrt_dynamic_feature_request(jsCallbackManager->getContext(), event->getFeature().c_str(), wrtPlatformCallback, eventWrapper); + // wrt_dynamic_feature_request(jsCallbackManager->getContext(), + // event->getFeature().c_str(), wrtPlatformCallback, eventWrapper); } void FeatureManager::platformCallback(int, - void* object, - void* userParam) + void* object, + void* userParam) { if (object == NULL) { LogError("Request has been rejected."); diff --git a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h index ffa419a..3187b55 100644 --- a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h +++ b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h @@ -29,29 +29,27 @@ class FeatureManager : { public: FeatureManager() - { - } + {} virtual ~FeatureManager() - { - } + {} static void platformCallback(int, - void* object, - void* userParam); + void* object, + void* userParam); + protected: virtual void OnRequestReceived(const Api::EventLoadFeaturePtr &event); + private: struct EventWrapper { EventWrapper(FeatureManager *featureManager, - const Api::EventLoadFeaturePtr &event) : + const Api::EventLoadFeaturePtr &event) : m_featureManager(featureManager), m_event(event) - { - } + {} ~EventWrapper() - { - } + {} FeatureManager *m_featureManager; Api::EventLoadFeaturePtr m_event; diff --git a/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp b/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp index 5132aec..3e4b918 100644 --- a/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp +++ b/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp @@ -68,19 +68,19 @@ map &createExtToMimeMap() } bool compareByFilename(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) + const IMediaItemPtr &rpm) { return lpm->getFileName().compare(rpm->getFileName()) < 0; } bool compareByFileDate(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) + const IMediaItemPtr &rpm) { return lpm->getDate() < rpm->getDate(); } bool compareByType(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) + const IMediaItemPtr &rpm) { return lpm->getType() < rpm->getType(); } @@ -88,10 +88,10 @@ bool compareByType(const IMediaItemPtr &lpm, class SearchIdObj { unsigned long m_id; + public: SearchIdObj(unsigned long id) : m_id(id) - { - } + {} bool operator ()(const IMediaItemPtr &elem) { return elem->getId() == m_id; @@ -163,7 +163,8 @@ void Gallery::searchFiles(const SharedPtr &node) NodeList nodes = node->getChildNodes(); NodeList::iterator it = nodes.begin(), end = nodes.end(); while (it != end) { - //Warning: '*it' element will be deleted after out of scope (next iteration) + //Warning: '*it' element will be deleted after out of scope (next + // iteration) (*it)->setPermissions(PERM_READ); searchFiles(SharedPtr(*it)); ++it; @@ -218,9 +219,11 @@ void Gallery::changeView(const IViewProperties &props) //Copy elements within date period to view struct for (IMediaItemsSetIterator it = m_mediaItems.begin(), end = m_mediaItems.end(); - it != end; ++it) { + it != end; ++it) + { if ((m_viewProperties.getStartDate() <= (*it)->getDate()) && - ((*it)->getDate() <= m_viewProperties.getEndDate())) { + ((*it)->getDate() <= m_viewProperties.getEndDate())) + { m_view->push_back(*it); } } diff --git a/src/modules/tizen/DEPRACATED/Gallery/Gallery.h b/src/modules/tizen/DEPRACATED/Gallery/Gallery.h index 122e1db..c1d98e4 100644 --- a/src/modules/tizen/DEPRACATED/Gallery/Gallery.h +++ b/src/modules/tizen/DEPRACATED/Gallery/Gallery.h @@ -86,14 +86,12 @@ class Gallery : public Api::Gallery::IGallery m_name(name), m_opened(false), m_lastId(0) - { - } + {} /* * Destructor of the gallery */ virtual ~Gallery() - { - } + {} /* * Gets number of media items selected by current view @@ -108,7 +106,8 @@ class Gallery : public Api::Gallery::IGallery virtual std::string getName() const; /* * Opens the gallery - * \exception Commons::PlatformWrongStateException when gallery is already open + * \exception Commons::PlatformWrongStateException when gallery is already + * open */ virtual void open(); /* Gets the current state of the gallery diff --git a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp index eec5a02..1e5606e 100644 --- a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp +++ b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp @@ -30,7 +30,7 @@ using namespace WrtPlugins::Api::Gallery; namespace WrtPlugins { namespace Platform { void GalleryRequestManager::OnRequestReceived( - const IEventGetGalleriesPtr &event) + const IEventGetGalleriesPtr &event) { IGallerySetPtr galleries(new IGallerySet()); galleries->push_back(IGalleryPtr(new Gallery("Device"))); @@ -107,7 +107,7 @@ void GalleryRequestManager::OnRequestReceived(const IEventChangeViewPtr &event) } void GalleryRequestManager::OnRequestReceived( - const IEventGetMediaItemsPtr &event) + const IEventGetMediaItemsPtr &event) { Try { @@ -126,7 +126,7 @@ void GalleryRequestManager::OnRequestReceived( } void GalleryRequestManager::OnRequestReceived( - const IEventGetMediaItemByIdPtr &event) + const IEventGetMediaItemByIdPtr &event) { Try { diff --git a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h index da344b1..204675e 100644 --- a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h +++ b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h @@ -32,16 +32,16 @@ class GalleryRequestManager : public Api::Gallery::IGalleryRequestManager protected: virtual void OnRequestReceived( - const Api::Gallery::IEventGetGalleriesPtr &event); + const Api::Gallery::IEventGetGalleriesPtr &event); virtual void OnRequestReceived(const Api::Gallery::IEventOpenPtr &event); virtual void OnRequestReceived(const Api::Gallery::IEventRefreshPtr &event); virtual void OnRequestReceived(const Api::Gallery::IEventClosePtr &event); virtual void OnRequestReceived( - const Api::Gallery::IEventChangeViewPtr &event); + const Api::Gallery::IEventChangeViewPtr &event); virtual void OnRequestReceived( - const Api::Gallery::IEventGetMediaItemsPtr &event); + const Api::Gallery::IEventGetMediaItemsPtr &event); virtual void OnRequestReceived( - const Api::Gallery::IEventGetMediaItemByIdPtr &event); + const Api::Gallery::IEventGetMediaItemByIdPtr &event); }; } } diff --git a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp index 53a94c2..41fb02c 100644 --- a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp +++ b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp @@ -30,10 +30,10 @@ namespace Platform { namespace Geolocation { namespace { static void positionChangedCallback(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy, - Geolocation* this_) + guint type, + gpointer data, + gpointer accuracy, + Geolocation* this_) { if (this_) { this_->positionHasChanged(obj, type, data, accuracy); @@ -108,9 +108,9 @@ void Geolocation::OnRequestReceived(const EventGetCurrentPositionPtr& event) } long Geolocation::watchPosition(const EventPositionChangedEmitterPtr& emitter, - long timeout, - long maximumAge, - bool highAccuracy) + long timeout, + long maximumAge, + bool highAccuracy) { initialize(); m_positionEmitters.attach(emitter); @@ -123,9 +123,9 @@ void Geolocation::clearWatch(EventPositionChangedEmitter::IdType id) } void Geolocation::positionHasChanged(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy) + guint type, + gpointer data, + gpointer accuracy) { LogDebug("Enter"); if (POSITION_UPDATED != type) { @@ -208,7 +208,9 @@ void Geolocation::start() return; } - m_location = location_new(convertMethodToPlatform(m_currentLocationMethod)); //may return NULL + //may return NULL + m_location = location_new(convertMethodToPlatform(m_currentLocationMethod)); + if (NULL == m_location) { ThrowMsg(Commons::PlatformException, "Couldn't create new location object."); diff --git a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h index b13bcc5..ac3b3cd 100644 --- a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h +++ b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h @@ -49,22 +49,22 @@ class Geolocation : public Api::Geolocation::IGeolocation * @See: IGelocation::getCurrentPosition */ virtual void getCurrentPosition( - const Api::Geolocation::EventGetCurrentPositionPtr& event); + const Api::Geolocation::EventGetCurrentPositionPtr& event); /** * @See: IGelocation::watchPosition */ virtual long watchPosition( - const Api::Geolocation::EventPositionChangedEmitterPtr& emitter, - long timeout, - long maximumAge, - bool highAccuracy); + const Api::Geolocation::EventPositionChangedEmitterPtr& emitter, + long timeout, + long maximumAge, + bool highAccuracy); /** * @See: IGelocation::clearWatch */ virtual void clearWatch( - Api::Geolocation::EventPositionChangedEmitter::IdType id); + Api::Geolocation::EventPositionChangedEmitter::IdType id); /** * @See: IGelocation::changeLocationMethod @@ -75,14 +75,14 @@ class Geolocation : public Api::Geolocation::IGeolocation * Method to run from platform's callback function */ void positionHasChanged(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy); + guint type, + gpointer data, + gpointer accuracy); protected: Geolocation(); virtual void OnRequestReceived( - const Api::Geolocation::EventGetCurrentPositionPtr& event); + const Api::Geolocation::EventGetCurrentPositionPtr& event); private: typedef Emitters diff --git a/src/modules/tizen/DEPRACATED/Memory/Manager.cpp b/src/modules/tizen/DEPRACATED/Memory/Manager.cpp index 2bde62d..da505be 100644 --- a/src/modules/tizen/DEPRACATED/Memory/Manager.cpp +++ b/src/modules/tizen/DEPRACATED/Memory/Manager.cpp @@ -45,8 +45,7 @@ unsigned long Manager::getFree() const } Manager::Manager() -{ -} +{} unsigned long Manager::getMeminfoValue(const char* pattern) const { @@ -61,7 +60,8 @@ unsigned long Manager::getMeminfoValue(const char* pattern) const bool matched = false; std::string line; while ((std::getline(file, line).rdstate() & - (std::ifstream::failbit | std::ifstream::eofbit)) == 0) { + (std::ifstream::failbit | std::ifstream::eofbit)) == 0) + { if (pcrecpp::RE(pattern).FullMatch(line, &result)) { matched = true; break; diff --git a/src/modules/tizen/DEPRACATED/Memory/Manager.h b/src/modules/tizen/DEPRACATED/Memory/Manager.h index a40608c..0049155 100644 --- a/src/modules/tizen/DEPRACATED/Memory/Manager.h +++ b/src/modules/tizen/DEPRACATED/Memory/Manager.h @@ -34,12 +34,15 @@ class Manager : public Api::Memory::IManager Manager(); /** - * Reads value from meminfo file looking it up using specified regex pattern. + * Reads value from meminfo file looking it up using specified regex + * pattern. * Function matches each (whole!) line against specified pattern. - * @param pattern Perl-like regular expresion used to search through meminfo. + * @param pattern Perl-like regular expresion used to search through + * meminfo. * @return Found value. * @throw PlatformException If could not find meminfo file. - * @throw UnsupportedException If pattern didn't match any line in meminfo file. + * @throw UnsupportedException If pattern didn't match any line in meminfo + * file. */ unsigned long getMeminfoValue(const char* pattern) const; }; diff --git a/src/modules/tizen/DEPRACATED/System/Environment.cpp b/src/modules/tizen/DEPRACATED/System/Environment.cpp index b75dfa9..39c80aa 100644 --- a/src/modules/tizen/DEPRACATED/System/Environment.cpp +++ b/src/modules/tizen/DEPRACATED/System/Environment.cpp @@ -93,8 +93,7 @@ std::string Environment::getHardwareName() const std::string result; char line[LINE_MAX] = { 0 }; pcrecpp::RE re(PATTERN_CPUINFO_HARDWARE); - while (fgets(line, LINE_MAX, file) && !re.FullMatch(line, &result)) { - } + while (fgets(line, LINE_MAX, file) && !re.FullMatch(line, &result)) {} fclose(file); if (result.empty()) { @@ -121,8 +120,7 @@ std::string Environment::getVariable(const char* name) } Environment::Environment() -{ -} +{} } // System } // Platform } // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp index 7d8bd57..3b4b32f 100644 --- a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp +++ b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp @@ -55,12 +55,14 @@ bool LogEntryWrapper::matchFilters(const LogFilterPtr &filter) } if (filter->getStartTimeIsSet() && (filter->getStartTimeMinFilter() > m_logEntry->getStartTime() || - filter->getStartTimeMaxFilter() < m_logEntry->getStartTime())) { + filter->getStartTimeMaxFilter() < m_logEntry->getStartTime())) + { return false; } if (filter->getDurationIsSet() && (filter->getDurationMinFilter() > m_logEntry->getDuration() || - filter->getDurationMaxFilter() < m_logEntry->getDuration())) { + filter->getDurationMaxFilter() < m_logEntry->getDuration())) + { return false; } if (filter->getPhoneNumberIsSet() && @@ -76,7 +78,8 @@ bool LogEntryWrapper::matchFilters(const LogFilterPtr &filter) return false; } if (filter->getFolderIsSet() && - !filter->checkIfFolderIsSet(m_logEntry->getFolder())) { + !filter->checkIfFolderIsSet(m_logEntry->getFolder())) + { return false; } else if (m_logEntry->getFolder() == LogEntry::INVALID_FOLDER) { return false; diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h index d317034..571e9ab 100644 --- a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h +++ b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h @@ -36,6 +36,7 @@ class LogEntryWrapper virtual ~LogEntryWrapper(); bool matchFilters(const Api::LogFilterPtr &filter); Api::LogEntryPtr getAbstractCall() const; + private: Api::LogEntryPtr m_logEntry; bool convertPlatformStructToAbstractStruct(CTSvalue *log); diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp b/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp index a14061f..eca34cf 100644 --- a/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp +++ b/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp @@ -150,9 +150,9 @@ int LogManager::getNumberOfLogsInternal(const LogFilterPtr &filter) } std::vector LogManager::findLogEntriesInternal( - const LogFilterPtr &filter, - const int minIndex, - const int maxIndex) + const LogFilterPtr &filter, + const int minIndex, + const int maxIndex) { LogDebug("entered"); std::vector result; diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogManager.h b/src/modules/tizen/DEPRACATED/Telephony/LogManager.h index c5c53a3..bfb7b22 100644 --- a/src/modules/tizen/DEPRACATED/Telephony/LogManager.h +++ b/src/modules/tizen/DEPRACATED/Telephony/LogManager.h @@ -40,24 +40,25 @@ class LogManager : public Api::ILogManager public: LogManager(); virtual ~LogManager(); + protected: virtual void OnRequestReceived( - const Api::IEventGetNumberOfLogsPtr &event); + const Api::IEventGetNumberOfLogsPtr &event); virtual void OnRequestReceived( - const Api::IEventFindLogEntriesPtr &event); + const Api::IEventFindLogEntriesPtr &event); virtual void OnRequestReceived( - const Api::IEventDeleteLogEntryPtr &event); + const Api::IEventDeleteLogEntryPtr &event); virtual void OnRequestReceived( - const Api::IEventClearLogPtr &event); + const Api::IEventClearLogPtr &event); int getNumberOfLogsInternal( - const Api::LogFilterPtr &filter); + const Api::LogFilterPtr &filter); std::vector findLogEntriesInternal( - const Api::LogFilterPtr &filter, - const int minIndex = -1, - const int maxIndex = -1); + const Api::LogFilterPtr &filter, + const int minIndex = -1, + const int maxIndex = -1); void deleteLogEntryInternal(int id) const; void clearLogInternal( - const Api::LogFilterPtr &filter); + const Api::LogFilterPtr &filter); static int m_instanceCount; DPL::Mutex m_constructorMutex; }; diff --git a/src/modules/tizen/Filesystem/Manager.cpp b/src/modules/tizen/Filesystem/Manager.cpp old mode 100755 new mode 100644 index 68d533f..5ecfe2f --- a/src/modules/tizen/Filesystem/Manager.cpp +++ b/src/modules/tizen/Filesystem/Manager.cpp @@ -46,7 +46,6 @@ const char* PATH_SDCARD = "/opt/storage/sdcard"; namespace WrtDeviceApis { namespace Filesystem { - using namespace Api; Manager::Locations Manager::m_locations; @@ -110,8 +109,7 @@ Manager::Manager() } Manager::~Manager() -{ -} +{} IPathPtr Manager::getBasePath() const { @@ -182,74 +180,79 @@ void Manager::find(const EventFindPtr& event) } void Manager::find(const IPathPtr& path, - const FiltersMap& filters, - NodeList& result, - const EventFindPtr& event) + const FiltersMap& filters, + NodeList& result, + const EventFindPtr& event) { Try { Assert(path && "path is NULL"); FTS *fts; FTSENT *ftsent; - std::string pth=path->getFullPath(); - char * const paths[] = {const_cast(pth.c_str()), NULL}; + std::string pth = path->getFullPath(); + char * const paths[] = { const_cast(pth.c_str()), NULL }; - if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == NULL) { + if ((fts = + fts_open(paths, FTS_PHYSICAL | FTS_NOCHDIR, NULL)) == NULL) + { //ERROR int error = errno; LogError(__PRETTY_FUNCTION__ << ": fts_open on " - << pth - << " failed with error: " - << strerror(error)); + << pth + << " failed with error: " + << strerror(error)); return; } while ((ftsent = fts_read(fts)) != NULL) { - if(event && event->checkCancelled()) break; + if (event && event->checkCancelled()) { + break; + } switch (ftsent->fts_info) { - case FTS_DP: - //directory in postorder - do nothing - break; - case FTS_D: - case FTS_DC: - case FTS_F: - case FTS_SL: - case FTS_SLNONE: - case FTS_DEFAULT: - //regular files, symbolic links, directories in preorder - //and other file entries that can be processed further - if (matchFilters(ftsent->fts_name, *ftsent->fts_statp, filters)) { - IPathPtr childPath=IPath::create(ftsent->fts_path); - result.push_back(Node::resolve(childPath)); - } - break; - case FTS_NS: - case FTS_NSOK: - case FTS_DOT: - case FTS_DNR: - case FTS_ERR: - default: - LogWarning(__PRETTY_FUNCTION__ - << ": traversal failed with error: " - << strerror(ftsent->fts_errno)); - ThrowMsg(Commons::PlatformException, - "Error reading directory"); + case FTS_DP: + //directory in postorder - do nothing + break; + case FTS_D: + case FTS_DC: + case FTS_F: + case FTS_SL: + case FTS_SLNONE: + case FTS_DEFAULT: + //regular files, symbolic links, directories in preorder + //and other file entries that can be processed further + if (matchFilters(ftsent->fts_name, *ftsent->fts_statp, + filters)) + { + IPathPtr childPath = IPath::create(ftsent->fts_path); + result.push_back(Node::resolve(childPath)); + } + break; + case FTS_NS: + case FTS_NSOK: + case FTS_DOT: + case FTS_DNR: + case FTS_ERR: + default: + LogWarning(__PRETTY_FUNCTION__ + << ": traversal failed with error: " + << strerror(ftsent->fts_errno)); + ThrowMsg(Commons::PlatformException, + "Error reading directory"); } } if (fts_close(fts) == -1) { int error = errno; LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: " - << strerror(error)); + << strerror(error)); ThrowMsg(Commons::PlatformException, "Could not close platform node."); } } - Catch(Commons::Exception) { - } + Catch(Commons::Exception) {} } void Manager::copyElement( - const std::string &src, const std::string &dest, bool recursive) const + const std::string &src, const std::string &dest, bool recursive) const { LogDebug("Copying src: " << src << " to: " << dest); @@ -288,44 +291,60 @@ void Manager::copyElement( free(data); } } - } bool Manager::access(const IPathPtr& path, - int accessType) const + int accessType) const { int amode = 0; - if (accessType & AT_EXISTS) { amode |= F_OK; } - if (accessType & AT_READ) { amode |= R_OK; } - if (accessType & AT_WRITE) { amode |= W_OK; } - if (accessType & AT_EXEC) { amode |= X_OK; } + if (accessType & AT_EXISTS) { + amode |= F_OK; + } + if (accessType & AT_READ) { + amode |= R_OK; + } + if (accessType & AT_WRITE) { + amode |= W_OK; + } + if (accessType & AT_EXEC) { + amode |= X_OK; + } return (::access(path->getFullPath().c_str(), amode) == 0); } bool Manager::matchFilters(const std::string& name, - const struct stat& info, - const FiltersMap& filters) + const struct stat& info, + const FiltersMap& filters) { FiltersMap::const_iterator it = filters.begin(); for (; it != filters.end(); ++it) { if (it->first == FF_NAME) { - if (!pcrecpp::RE(it->second).PartialMatch(name)) { return false; } + if (!pcrecpp::RE(it->second).PartialMatch(name)) { + return false; + } } else if (it->first == FF_SIZE) { std::size_t size; std::stringstream ss(it->second); ss >> size; if (!ss || - (size != static_cast(info.st_size))) { return false; } + (size != static_cast(info.st_size))) + { + return false; + } } else if (it->first == FF_CREATED) { std::time_t created; std::stringstream ss(it->second); ss >> created; - if (!ss || (created != info.st_ctime)) { return false; } + if (!ss || (created != info.st_ctime)) { + return false; + } } else if (it->first == FF_MODIFIED) { std::time_t modified; std::stringstream ss(it->second); ss >> modified; - if (!ss || (modified != info.st_mtime)) { return false; } + if (!ss || (modified != info.st_mtime)) { + return false; + } } } return true; @@ -335,8 +354,7 @@ void Manager::OnRequestReceived(const EventResolvePtr& event) { try { event->setResult(Node::resolve(event->getPath())); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } @@ -344,8 +362,9 @@ void Manager::OnRequestReceived(const EventResolvePtr& event) } void Manager::checkPaths( - Api::IPathPtr &src, - Api::IPathPtr &dest) { + Api::IPathPtr &src, + Api::IPathPtr &dest) +{ Assert(dest); Assert(src); if (!dest->isAbsolute()) { @@ -373,11 +392,12 @@ void Manager::checkPaths( if (!access(parent->getPath(), AT_WRITE)) { ThrowMsg(Commons::SecurityException, - "Not enough permissions to write to destination."); + "Not enough permissions to write to destination."); } } -bool Manager::pathExists(const std::string &path) { +bool Manager::pathExists(const std::string &path) +{ errno = 0; struct stat info; memset(&info, 0, sizeof(struct stat)); @@ -395,16 +415,16 @@ void Manager::OnRequestReceived(const EventCopyPtr& event) INodePtr srcNode = Node::resolve(event->getSource()); int requiredAccess; switch (srcNode->getType()) { - case NT_DIRECTORY: - requiredAccess = AT_EXEC; - break; - case NT_FILE: - requiredAccess = AT_READ; - break; + case NT_DIRECTORY: + requiredAccess = AT_EXEC; + break; + case NT_FILE: + requiredAccess = AT_READ; + break; } if (!access(srcNode->getPath(), requiredAccess)) { ThrowMsg(Commons::SecurityException, - "Not enough permissions to copy source node."); + "Not enough permissions to copy source node."); } IPathPtr src = event->getSource(); @@ -446,12 +466,10 @@ void Manager::OnRequestReceived(const EventCopyPtr& event) copyElement(realSrc, realDest); event->setResult(Node::resolve(dest)); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - catch (const Commons::SecurityException& ex) { + } catch (const Commons::SecurityException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::SecurityException); } @@ -468,7 +486,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) INodePtr srcNode = Node::resolve(src); if (!access(srcNode->getParent()->getPath(), AT_WRITE)) { ThrowMsg(Commons::SecurityException, - "Not enough permissions to move source node."); + "Not enough permissions to move source node."); } checkPaths(src, dest); @@ -490,41 +508,40 @@ void Manager::OnRequestReceived(const EventMovePtr& event) dest->getFullPath().c_str())) { int error = errno; - switch (error) - { + switch (error) { case EXDEV: - { - if (destExists) { - //destination exist. Need to be removed - Try { - INodePtr node = Node::resolve( - event->getDestination()); - node->remove(event->getOptions()); - } - Catch(Commons::PlatformException) { - LogError("Exception while removing dest directory"); - event->setExceptionCode( - Commons::ExceptionCodes::PlatformException); - } - Catch(Commons::SecurityException) { - event->setExceptionCode( - Commons::ExceptionCodes::SecurityException); - } - } - - copyElement(src->getFullPath(), - dest->getFullPath()); - //remove source files + { + if (destExists) { + //destination exist. Need to be removed Try { - INodePtr node = Node::resolve(event->getSource()); + INodePtr node = Node::resolve( + event->getDestination()); node->remove(event->getOptions()); } - Catch(Commons::Exception) { - LogError("Exception: " - << _rethrown_exception.GetMessage()); + Catch(Commons::PlatformException) { + LogError("Exception while removing dest directory"); + event->setExceptionCode( + Commons::ExceptionCodes::PlatformException); + } + Catch(Commons::SecurityException) { + event->setExceptionCode( + Commons::ExceptionCodes::SecurityException); } - break; } + + copyElement(src->getFullPath(), + dest->getFullPath()); + //remove source files + Try { + INodePtr node = Node::resolve(event->getSource()); + node->remove(event->getOptions()); + } + Catch(Commons::Exception) { + LogError("Exception: " + << _rethrown_exception.GetMessage()); + } + break; + } default: ThrowMsg(Commons::PlatformException, "Error on rename: " << DPL::GetErrnoString(error)); @@ -533,12 +550,10 @@ void Manager::OnRequestReceived(const EventMovePtr& event) } event->setResult(Node::resolve(dest)); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - catch (const Commons::SecurityException& ex) { + } catch (const Commons::SecurityException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::SecurityException); } @@ -571,8 +586,7 @@ void Manager::OnRequestReceived(const EventFindPtr& event) NodeList result; find(event->getPath(), event->getFilters(), result, event); event->setResult(result); - } - catch (const Commons::Exception& ex) { + } catch (const Commons::Exception& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } @@ -593,19 +607,17 @@ bool Manager::init() } void Manager::setupLocation(LocationType location, - const char* path) + const char* path) { if (!nodeExists(path)) { try { makePath(path, 0755); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.DumpToString()); return; } } m_locations[location] = IPath::create(path); } - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Manager.h b/src/modules/tizen/Filesystem/Manager.h index e582a89..fa59e3d 100644 --- a/src/modules/tizen/Filesystem/Manager.h +++ b/src/modules/tizen/Filesystem/Manager.h @@ -27,7 +27,6 @@ namespace WrtDeviceApis { namespace Filesystem { - class Manager : public Api::IManager { public: @@ -84,7 +83,7 @@ class Manager : public Api::IManager * only by virtual roots. */ bool access(const Api::IPathPtr& path, - int accessType) const; + int accessType) const; void addOpenedNode(const Api::INodePtr& node); void removeOpenedNode(const Api::INodePtr& node); @@ -92,8 +91,8 @@ class Manager : public Api::IManager protected: bool matchFilters(const std::string& name, - const struct stat& info, - const Api::FiltersMap& filter); + const struct stat& info, + const Api::FiltersMap& filter); void OnRequestReceived(const Api::EventResolvePtr& event); void OnRequestReceived(const Api::EventCopyPtr& event); @@ -127,12 +126,13 @@ class Manager : public Api::IManager */ void checkPaths(Api::IPathPtr &src, Api::IPathPtr &dest); bool pathExists(const std::string &path); + private: static Locations m_locations; ///< Paths to default locations. static const std::size_t m_maxPathLength; ///< Maximum path length. - static Api::NodeList m_openedNodes; ///< List of nodes that has opened streams. + static Api::NodeList m_openedNodes; ///< List of nodes that has opened + // streams. }; - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Node.cpp b/src/modules/tizen/Filesystem/Node.cpp old mode 100755 new mode 100644 index 582fcba..d345dd0 --- a/src/modules/tizen/Filesystem/Node.cpp +++ b/src/modules/tizen/Filesystem/Node.cpp @@ -33,7 +33,6 @@ namespace WrtDeviceApis { namespace Filesystem { - using namespace Api; INodePtr Node::resolve(const IPathPtr& path) @@ -104,7 +103,8 @@ Node::NameList Node::getChildNames() const struct dirent *entry = NULL; while ((entry = readdir(dir))) { if (!strncmp(entry->d_name, ".", - 1) || !strncmp(entry->d_name, "..", 2)) { + 1) || !strncmp(entry->d_name, "..", 2)) + { continue; } result.push_back(entry->d_name); @@ -141,7 +141,8 @@ NodeList Node::getChildNodes(const NodeFilterPtr& filter) const struct dirent *entry = NULL; while ((entry = readdir(dir))) { if (!strncmp(entry->d_name, ".", - 1) || !strncmp(entry->d_name, "..", 2)) { + 1) || !strncmp(entry->d_name, "..", 2)) + { continue; } Try { @@ -152,8 +153,7 @@ NodeList Node::getChildNodes(const NodeFilterPtr& filter) const result.push_back(node); } } - Catch(Commons::PlatformException) { - } + Catch(Commons::PlatformException) {} } if (errno != 0) { @@ -174,9 +174,9 @@ void Node::getChildNodes(const EventListNodesPtr& event) } INodePtr Node::createChild( - const IPathPtr& path, - NodeType type, - int options) + const IPathPtr& path, + NodeType type, + int options) { if (m_type != NT_DIRECTORY) { ThrowMsg(Commons::PlatformException, "Parent node is not a directory."); @@ -222,7 +222,8 @@ IStreamPtr Node::open(int mode) if (((mode & AM_READ) && ((m_perms & PERM_READ) == 0)) || (((mode & AM_WRITE) || - (mode & AM_APPEND)) && ((m_perms & PERM_WRITE) == 0))) { + (mode & AM_APPEND)) && ((m_perms & PERM_WRITE) == 0))) + { ThrowMsg(Commons::SecurityException, "Not enough permissions."); } @@ -296,15 +297,33 @@ int Node::getMode() const { int result = 0; struct stat info = stat(m_path); - if (info.st_mode & S_IRUSR) { result |= PM_USER_READ; } - if (info.st_mode & S_IWUSR) { result |= PM_USER_WRITE; } - if (info.st_mode & S_IXUSR) { result |= PM_USER_EXEC; } - if (info.st_mode & S_IRGRP) { result |= PM_GROUP_READ; } - if (info.st_mode & S_IWGRP) { result |= PM_GROUP_WRITE; } - if (info.st_mode & S_IXGRP) { result |= PM_GROUP_EXEC; } - if (info.st_mode & S_IROTH) { result |= PM_OTHER_READ; } - if (info.st_mode & S_IWOTH) { result |= PM_OTHER_WRITE; } - if (info.st_mode & S_IXOTH) { result |= PM_OTHER_EXEC; } + if (info.st_mode & S_IRUSR) { + result |= PM_USER_READ; + } + if (info.st_mode & S_IWUSR) { + result |= PM_USER_WRITE; + } + if (info.st_mode & S_IXUSR) { + result |= PM_USER_EXEC; + } + if (info.st_mode & S_IRGRP) { + result |= PM_GROUP_READ; + } + if (info.st_mode & S_IWGRP) { + result |= PM_GROUP_WRITE; + } + if (info.st_mode & S_IXGRP) { + result |= PM_GROUP_EXEC; + } + if (info.st_mode & S_IROTH) { + result |= PM_OTHER_READ; + } + if (info.st_mode & S_IWOTH) { + result |= PM_OTHER_WRITE; + } + if (info.st_mode & S_IXOTH) { + result |= PM_OTHER_EXEC; + } return result; } @@ -342,7 +361,7 @@ struct stat Node::stat(const IPathPtr& path) struct stat result; memset(&result, 0, sizeof(struct stat)); if (::stat(path->getFullPath().c_str(), - &result) != 0) + &result) != 0) { LogError("File: " << path->getFullPath().c_str()); ThrowMsg(Commons::PlatformException, "Node does not exist or no access"); @@ -355,11 +374,10 @@ Node::Node(const IPathPtr& path, m_path(path), m_type(type), m_perms(PERM_NONE) -{ -} +{} Node* Node::createAsFile(const IPathPtr& path, - int /* options */) + int /* options */) { LogDebug("ENTER"); createAsFileInternal(path); @@ -378,13 +396,15 @@ void Node::createAsFileInternal(const IPathPtr& path) } Node* Node::createAsDirectory(const IPathPtr& path, - int options) + int options) { if (options & OPT_RECURSIVE) { PathUtils::PathList parts = PathUtils::getParts(path); PathUtils::PathListIterator it = parts.begin(); for (; it != parts.end(); ++it) { - if (!exists(*it)) { createAsDirectoryInternal(*it); } + if (!exists(*it)) { + createAsDirectoryInternal(*it); + } } } createAsDirectoryInternal(path); @@ -394,7 +414,8 @@ Node* Node::createAsDirectory(const IPathPtr& path, void Node::createAsDirectoryInternal(const IPathPtr& path) { if (mkdir(path->getFullPath().c_str(), S_IRWXU | S_IRWXG | S_IROTH | - S_IXOTH) != 0) { + S_IXOTH) != 0) + { ThrowMsg(Commons::PlatformException, "Platform node could not be created."); } @@ -424,64 +445,66 @@ void Node::removeAsDirectory(const IPathPtr& path, FTS *fts; FTSENT *ftsent; int error = 0; - std::string pth=path->getFullPath(); - char * const paths[] = {const_cast(pth.c_str()), NULL}; + std::string pth = path->getFullPath(); + char * const paths[] = { const_cast(pth.c_str()), NULL }; - if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == NULL) { + if ((fts = + fts_open(paths, FTS_PHYSICAL | FTS_NOCHDIR, NULL)) == NULL) + { //ERROR error = errno; LogError(__PRETTY_FUNCTION__ << ": fts_open on " - << pth - << " failed with error: " - << strerror(error)); + << pth + << " failed with error: " + << strerror(error)); ThrowMsg(Commons::PlatformException, "Failed to traverse Node"); } while ((ftsent = fts_read(fts)) != NULL) { switch (ftsent->fts_info) { - case FTS_D: - //directory in preorder - do nothing - break; - case FTS_DP: - //directory in postorder - remove - errno = 0; - if (rmdir(ftsent->fts_accpath) != 0) { - if (errno == EEXIST) { - ThrowMsg(Commons::PlatformException, - "Node has child nodes."); - } + case FTS_D: + //directory in preorder - do nothing + break; + case FTS_DP: + //directory in postorder - remove + errno = 0; + if (rmdir(ftsent->fts_accpath) != 0) { + if (errno == EEXIST) { ThrowMsg(Commons::PlatformException, - "Error while removing platform node."); - } - break; - case FTS_DC: - case FTS_F: - case FTS_NSOK: - case FTS_SL: - case FTS_SLNONE: - case FTS_DEFAULT: - { - //regular files and other objects that can safely be removed - IPathPtr file_path = IPath::create(ftsent->fts_path); - removeAsFile(file_path); - break; + "Node has child nodes."); } - case FTS_NS: - case FTS_DOT: - case FTS_DNR: - case FTS_ERR: - default: - LogWarning(__PRETTY_FUNCTION__ - << ": traversal failed with error: " - << strerror(ftsent->fts_errno)); - break; + ThrowMsg(Commons::PlatformException, + "Error while removing platform node."); + } + break; + case FTS_DC: + case FTS_F: + case FTS_NSOK: + case FTS_SL: + case FTS_SLNONE: + case FTS_DEFAULT: + { + //regular files and other objects that can safely be removed + IPathPtr file_path = IPath::create(ftsent->fts_path); + removeAsFile(file_path); + break; + } + case FTS_NS: + case FTS_DOT: + case FTS_DNR: + case FTS_ERR: + default: + LogWarning(__PRETTY_FUNCTION__ + << ": traversal failed with error: " + << strerror(ftsent->fts_errno)); + break; } } if (fts_close(fts) == -1) { error = errno; LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: " - << strerror(error)); + << strerror(error)); } } else { if (rmdir(path->getFullPath().c_str()) != 0) { @@ -489,7 +512,7 @@ void Node::removeAsDirectory(const IPathPtr& path, ThrowMsg(Commons::PlatformException, "Node has child nodes."); } ThrowMsg(Commons::PlatformException, - "Error while removing platform node."); + "Error while removing platform node."); } } } @@ -499,12 +522,10 @@ void Node::OnRequestReceived(const EventListNodesPtr& event) try { NodeList list = event->getNode()->getChildNodes(event->getFilter()); event->setResult(list); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - catch (const Commons::SecurityException& ex) { + } catch (const Commons::SecurityException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::SecurityException); } @@ -516,12 +537,10 @@ void Node::OnRequestReceived(const EventOpenPtr& event) try { IStreamPtr result = open(event->getMode()); event->setResult(result); - } - catch (const Commons::PlatformException& ex) { + } catch (const Commons::PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - catch (const Commons::SecurityException& ex) { + } catch (const Commons::SecurityException& ex) { LogError("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::SecurityException); } @@ -564,8 +583,9 @@ std::string Node::readText() DPL::SharedPtr stream(new Stream(SharedFromThis(), AM_READ)); while (!stream->isEof()) { result << stream->getLine(); - if(!stream->isEof()) + if (!stream->isEof()) { result << '\n'; + } } stream->close(); return result.str(); @@ -576,6 +596,5 @@ std::string Node::toUri(int /*widgetId*/) const // TODO I believe moving this feature to WrtWrapper would make more sense. return "file://" + m_path->getFullPath(); } - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Node.h b/src/modules/tizen/Filesystem/Node.h index 0abcaf9..de95317 100644 --- a/src/modules/tizen/Filesystem/Node.h +++ b/src/modules/tizen/Filesystem/Node.h @@ -31,7 +31,6 @@ namespace WrtDeviceApis { namespace Filesystem { - class Node : public Api::INode, public DPL::EnableSharedFromThis @@ -53,7 +52,7 @@ class Node : Api::INodePtr getChild(const Api::IPathPtr& path); NameList getChildNames() const; Api::NodeList getChildNodes( - const Api::NodeFilterPtr& filter = Api::NodeFilterPtr()) const; + const Api::NodeFilterPtr& filter = Api::NodeFilterPtr()) const; void getChildNodes(const Api::EventListNodesPtr& event); Api::INodePtr createChild(const Api::IPathPtr & path, Api::NodeType, @@ -85,7 +84,7 @@ class Node : void removeAsFile(const Api::IPathPtr& path); void removeAsDirectory(const Api::IPathPtr& path, - bool recursive); + bool recursive); void OnRequestReceived(const Api::EventListNodesPtr& event); void OnRequestReceived(const Api::EventOpenPtr& event); @@ -104,7 +103,6 @@ class Node : }; typedef DPL::SharedPtr NodePtr; - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/NodeFilterMatcher.cpp b/src/modules/tizen/Filesystem/NodeFilterMatcher.cpp index 254be88..d85f4f0 100644 --- a/src/modules/tizen/Filesystem/NodeFilterMatcher.cpp +++ b/src/modules/tizen/Filesystem/NodeFilterMatcher.cpp @@ -23,7 +23,6 @@ namespace WrtDeviceApis { namespace Filesystem { - using namespace Api; bool NodeFilterMatcher::match(const INodePtr& value, @@ -36,19 +35,22 @@ bool NodeFilterMatcher::match(const INodePtr& value, if (!matchRange(value->getCreated(), filter->getMinCreated(), - filter->getMaxCreated())) { + filter->getMaxCreated())) + { return false; } if (!matchRange(value->getModified(), filter->getMinModified(), - filter->getMaxModified())) { + filter->getMaxModified())) + { return false; } if (!matchRange(value->getSize(), filter->getMinSize(), - filter->getMaxSize())) { + filter->getMaxSize())) + { return false; } } @@ -56,7 +58,7 @@ bool NodeFilterMatcher::match(const INodePtr& value, } bool NodeFilterMatcher::matchString(const std::string& value, - const OptionalString& filter) + const OptionalString& filter) { if (!filter.IsNull()) { return pcrecpp::RE(*filter).PartialMatch(value); @@ -66,15 +68,15 @@ bool NodeFilterMatcher::matchString(const std::string& value, template bool NodeFilterMatcher::matchRange(const Type& value, - const DPL::Optional& min, - const DPL::Optional& max) + const DPL::Optional& min, + const DPL::Optional& max) { if ((!min.IsNull() && (value < *min)) || - (!max.IsNull() && (value > *max))) { + (!max.IsNull() && (value > *max))) + { return false; } return true; } - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/NodeFilterMatcher.h b/src/modules/tizen/Filesystem/NodeFilterMatcher.h index fe22a23..e300058 100644 --- a/src/modules/tizen/Filesystem/NodeFilterMatcher.h +++ b/src/modules/tizen/Filesystem/NodeFilterMatcher.h @@ -27,7 +27,6 @@ namespace WrtDeviceApis { namespace Filesystem { - class NodeFilterMatcher { public: @@ -46,7 +45,6 @@ class NodeFilterMatcher private: NodeFilterMatcher(); }; - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Path.cpp b/src/modules/tizen/Filesystem/Path.cpp index 31edceb..9aa1197 100644 --- a/src/modules/tizen/Filesystem/Path.cpp +++ b/src/modules/tizen/Filesystem/Path.cpp @@ -26,7 +26,6 @@ namespace WrtDeviceApis { namespace Filesystem { - using namespace Api; const Path::SeparatorType Path::m_pathSeparator = '/'; @@ -86,8 +85,7 @@ IPathPtr Path::clone() const } Path::Path() -{ -} +{} void Path::reset(const std::string& str) { @@ -113,6 +111,5 @@ void Path::reset(const std::string& str) m_fullPath += m_name; } } - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Path.h b/src/modules/tizen/Filesystem/Path.h index 6a25f66..6c7b314 100644 --- a/src/modules/tizen/Filesystem/Path.h +++ b/src/modules/tizen/Filesystem/Path.h @@ -23,7 +23,6 @@ namespace WrtDeviceApis { namespace Filesystem { - class Path : public Api::IPath, public DPL::EnableSharedFromThis { @@ -60,7 +59,6 @@ class Path : public Api::IPath, std::string m_path; ///< Base path. std::string m_name; ///< Last part of the path. }; - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Stream.cpp b/src/modules/tizen/Filesystem/Stream.cpp old mode 100755 new mode 100644 index f999484..f63d7c4 --- a/src/modules/tizen/Filesystem/Stream.cpp +++ b/src/modules/tizen/Filesystem/Stream.cpp @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace Filesystem { - using namespace Api; Stream::Stream(const NodePtr& parent, @@ -35,9 +34,14 @@ Stream::Stream(const NodePtr& parent, Assert(m_parent && "Stream needs to have parent."); std::ios_base::openmode mode_ = std::ios_base::binary; - if (mode & AM_READ) { mode_ |= std::ios_base::in; } - if (mode & AM_WRITE) { mode_ |= std::ios_base::out; } else if (mode & - AM_APPEND) { + if (mode & AM_READ) { + mode_ |= std::ios_base::in; + } + if (mode & AM_WRITE) { + mode_ |= std::ios_base::out; + } else if (mode & + AM_APPEND) + { mode_ |= (std::ios_base::app | std::ios_base::out); } @@ -237,7 +241,7 @@ IStreamPtr Stream::write_(T arg) if (!(m_stream << arg)) { LogError("Error while writing to the stream."); ThrowMsg(Commons::PlatformException, - "Error while writing to the stream."); + "Error while writing to the stream."); } m_stream.flush(); @@ -294,6 +298,5 @@ void Stream::checkForWriting() const ThrowMsg(Commons::PlatformException, "Stream is not writeable."); } } - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Stream.h b/src/modules/tizen/Filesystem/Stream.h index 1e1da11..777168f 100644 --- a/src/modules/tizen/Filesystem/Stream.h +++ b/src/modules/tizen/Filesystem/Stream.h @@ -26,7 +26,6 @@ namespace WrtDeviceApis { namespace Filesystem { - class Node; typedef DPL::SharedPtr NodePtr; @@ -92,7 +91,7 @@ class Stream : private: Stream(const NodePtr& parent, - int mode); + int mode); private: NodePtr m_parent; @@ -101,7 +100,6 @@ class Stream : }; typedef DPL::SharedPtr StreamPtr; - } // Filesystem } // WrtDeviceApis diff --git a/src/modules/tizen/Filesystem/Utils.cpp b/src/modules/tizen/Filesystem/Utils.cpp index 7fa5b6b..fc9cde0 100644 --- a/src/modules/tizen/Filesystem/Utils.cpp +++ b/src/modules/tizen/Filesystem/Utils.cpp @@ -78,7 +78,6 @@ int mkpath(const char* path, namespace WrtDeviceApis { namespace Filesystem { - bool nodeExists(const std::string& path) { struct stat info; @@ -91,12 +90,11 @@ bool nodeExists(const std::string& path) } void makePath(const std::string& path, - mode_t mode) + mode_t mode) { if (mkpath(path.c_str(), mode) == -1) { ThrowMsg(Commons::PlatformException, "Couldn't create path: " << path); } } - } } diff --git a/src/modules/tizen/Filesystem/Utils.h b/src/modules/tizen/Filesystem/Utils.h index a094dad..2b1eeb3 100644 --- a/src/modules/tizen/Filesystem/Utils.h +++ b/src/modules/tizen/Filesystem/Utils.h @@ -27,11 +27,9 @@ namespace WrtDeviceApis { namespace Filesystem { - bool nodeExists(const std::string& path); void makePath(const std::string& path, mode_t mode); - } } diff --git a/src/modules/tizen/Networking/EthernetAdapter.cpp b/src/modules/tizen/Networking/EthernetAdapter.cpp index 4523db8..e2cf447 100644 --- a/src/modules/tizen/Networking/EthernetAdapter.cpp +++ b/src/modules/tizen/Networking/EthernetAdapter.cpp @@ -18,29 +18,28 @@ namespace WrtDeviceApis { namespace Networking { EthernetAdapter::EthernetAdapter() -{ -} +{} void EthernetAdapter::addOnConnected( - const Api::EventConnectedEmitterPtr& emitter) + const Api::EventConnectedEmitterPtr& emitter) { m_onConnected.attach(emitter); } void EthernetAdapter::removeOnConnected( - Api::EventConnectedEmitter::IdType id) + Api::EventConnectedEmitter::IdType id) { m_onConnected.detach(id); } void EthernetAdapter::addOnDisconnected( - const Api::EventDisconnectedEmitterPtr& emitter) + const Api::EventDisconnectedEmitterPtr& emitter) { m_onDisconnected.attach(emitter); } void EthernetAdapter::removeOnDisconnected( - Api::EventDisconnectedEmitter::IdType id) + Api::EventDisconnectedEmitter::IdType id) { m_onDisconnected.detach(id); } diff --git a/src/modules/tizen/Networking/EthernetAdapter.h b/src/modules/tizen/Networking/EthernetAdapter.h index d51683a..6193531 100644 --- a/src/modules/tizen/Networking/EthernetAdapter.h +++ b/src/modules/tizen/Networking/EthernetAdapter.h @@ -35,21 +35,22 @@ class EthernetAdapter : public Api::IAdapter public: bool isConnected() const /* TODO */ - { return false; + { + return false; } // Api::Networking::IConnectionPtr getConnection() const { /* TODO */ } void addOnConnected( - const Api::EventConnectedEmitterPtr& emitter); + const Api::EventConnectedEmitterPtr& emitter); void removeOnConnected(Api::EventConnectedEmitter::IdType id); void addOnDisconnected( - const Api::EventDisconnectedEmitterPtr& emitter); + const Api::EventDisconnectedEmitterPtr& emitter); void removeOnDisconnected( - Api::EventDisconnectedEmitter::IdType id); + Api::EventDisconnectedEmitter::IdType id); Api::IAdapter::Type getAdapterType() const; diff --git a/src/modules/tizen/Networking/Manager.cpp b/src/modules/tizen/Networking/Manager.cpp index 89d2dcb..0f1e7c0 100644 --- a/src/modules/tizen/Networking/Manager.cpp +++ b/src/modules/tizen/Networking/Manager.cpp @@ -30,7 +30,8 @@ namespace WrtDeviceApis { namespace Networking { -//net_event_callbacks Manager::m_netEventCallbacks = Manager::getNetEventCallbacks(); +//net_event_callbacks Manager::m_netEventCallbacks = +// Manager::getNetEventCallbacks(); Manager& Manager::getInstance() { @@ -89,7 +90,8 @@ void Manager::getAvailableAdapters(Api::AdaptersSet *retSet) const // //void Manager::onNetStatusChange(NetStatusInfo_t* status, void *userData) { // LogDebug("--| ENTER"); -// LogInfo("Type: " << status->transportType << ", status: " << status->WiFiStatus); +// LogInfo("Type: " << status->transportType << ", status: " << +// status->WiFiStatus); //} Manager::Manager() @@ -108,7 +110,8 @@ void Manager::setupAdapters() // Api::IAdapter* adapter = NULL; // // adapter = new EthernetAdapter(); - // m_adapters.insert(Adapters::value_type(Api::IAdapter::T_ETHERNET, adapter)); + // m_adapters.insert(Adapters::value_type(Api::IAdapter::T_ETHERNET, + // adapter)); // // adapter = new WifiAdapter(); // m_adapters.insert(Adapters::value_type(Api::IAdapter::T_WIFI, adapter)); @@ -127,8 +130,10 @@ void Manager::removeAdapters() //void Manager::attachListeners() { // int error = 0; // -// if ((error = net_register_client(&m_netEventCallbacks, this)) != NET_ERR_NONE) { -// LogError("Could not register to datanetworking module (" << error << ")."); +// if ((error = net_register_client(&m_netEventCallbacks, this)) != +// NET_ERR_NONE) { +// LogError("Could not register to datanetworking module (" << error << +// ")."); // } // // if ((error = wlan_client_register(wlanCallback, this)) != WLAN_ERR_NONE) { @@ -140,7 +145,8 @@ void Manager::removeAdapters() // int error = 0; // // if ((error = net_deregister_client()) != NET_ERR_NONE) { -// LogError("Could not deregister from datanetworking module (" << error << ")."); +// LogError("Could not deregister from datanetworking module (" << error << +// ")."); // } // // if ((error = wlan_client_deregister()) != WLAN_ERR_NONE) { @@ -152,7 +158,8 @@ void Manager::removeAdapters() // int error; // int profile = 0; // char ssid[SSID_MAX_LENGTH + 1] = {0}; -// if ((error = wlan_client_get_connected_ap_info(&profile, ssid)) == WLAN_ERR_NONE) { +// if ((error = wlan_client_get_connected_ap_info(&profile, ssid)) == +// WLAN_ERR_NONE) { // Adapter* connection = new Adapter(); // connection->setType(Api::IAdapter::T_WIFI); // connection->setName(ssid); diff --git a/src/modules/tizen/Networking/WifiAdapter.cpp b/src/modules/tizen/Networking/WifiAdapter.cpp index 748c069..6ad6077 100644 --- a/src/modules/tizen/Networking/WifiAdapter.cpp +++ b/src/modules/tizen/Networking/WifiAdapter.cpp @@ -18,29 +18,28 @@ namespace WrtDeviceApis { namespace Networking { WifiAdapter::WifiAdapter() -{ -} +{} void WifiAdapter::addOnConnected( - const Api::EventConnectedEmitterPtr& emitter) + const Api::EventConnectedEmitterPtr& emitter) { m_onConnected.attach(emitter); } void WifiAdapter::removeOnConnected( - Api::EventConnectedEmitter::IdType id) + Api::EventConnectedEmitter::IdType id) { m_onConnected.detach(id); } void WifiAdapter::addOnDisconnected( - const Api::EventDisconnectedEmitterPtr& emitter) + const Api::EventDisconnectedEmitterPtr& emitter) { m_onDisconnected.attach(emitter); } void WifiAdapter::removeOnDisconnected( - Api::EventDisconnectedEmitter::IdType id) + Api::EventDisconnectedEmitter::IdType id) { m_onDisconnected.detach(id); } diff --git a/src/modules/tizen/Networking/WifiAdapter.h b/src/modules/tizen/Networking/WifiAdapter.h index 001c708..ebb4245 100644 --- a/src/modules/tizen/Networking/WifiAdapter.h +++ b/src/modules/tizen/Networking/WifiAdapter.h @@ -35,21 +35,22 @@ class WifiAdapter : public Api::IAdapter public: bool isConnected() const /* TODO */ - { return false; + { + return false; } //Api::Networking::IConnectionPtr getConnection() const { /* TODO */ } void addOnConnected( - const Api::EventConnectedEmitterPtr& emitter); + const Api::EventConnectedEmitterPtr& emitter); void removeOnConnected(Api::EventConnectedEmitter::IdType id); void addOnDisconnected( - const Api::EventDisconnectedEmitterPtr& emitter); + const Api::EventDisconnectedEmitterPtr& emitter); void removeOnDisconnected( - Api::EventDisconnectedEmitter::IdType id); + Api::EventDisconnectedEmitter::IdType id); Api::IAdapter::Type getAdapterType() const; diff --git a/src/modules/tizen/PluginManager/PluginManager.cpp b/src/modules/tizen/PluginManager/PluginManager.cpp index 8f71524..2d868d8 100644 --- a/src/modules/tizen/PluginManager/PluginManager.cpp +++ b/src/modules/tizen/PluginManager/PluginManager.cpp @@ -34,7 +34,6 @@ #include #include - using namespace std; namespace { @@ -44,8 +43,6 @@ const char* SEPARATOR = "."; namespace WrtDeviceApis { namespace PluginManager { - - PluginManager::PluginManager(int widgetHandle, const string &objectUri, JSObjectRef object, @@ -63,8 +60,7 @@ PluginManager::PluginManager(int widgetHandle, PluginManager::~PluginManager() { ObjectList::iterator it = m_objectList.begin(); - for (; it != m_objectList.end(); ++it) - { + for (; it != m_objectList.end(); ++it) { JSValueUnprotect(m_context, it->second); } WrtDB::WrtDatabase::detachFromThread(); @@ -106,28 +102,27 @@ bool PluginManager::loadChild(const string &name) const } if (widgetType == WrtDB::APP_TYPE_TIZENWEBAPP) { - JavaScriptObject jsObject = {m_objectInstance, - m_shortUri}; + JavaScriptObject jsObject = { m_objectInstance, + m_shortUri }; return PluginLogicSingleton::Instance().loadPluginOnDemand( - handle, jsObject, const_cast(m_context)); + handle, jsObject, const_cast(m_context)); } //check does plugin with feature was requested - FOREACH (it, features) + FOREACH(it, features) { - if (it->pluginId == handle) - { - if(it->rejected) - { + if (it->pluginId == handle) { + if (it->rejected) { LogWarning("Feature rejected by ACE"); continue; } - JavaScriptObject jsObject = {m_objectInstance, - m_shortUri}; + JavaScriptObject jsObject = { m_objectInstance, + m_shortUri }; return PluginLogicSingleton::Instance().loadPluginOnDemand( - handle, jsObject, const_cast(m_context)); + handle, jsObject, + const_cast(m_context)); } } LogError("Plugin not loaded"); @@ -179,7 +174,6 @@ bool PluginManager::deleteProperty(const string &name) return false; } - Api::IPluginManager::PropertyList PluginManager::getProperties() const { if (!m_propertyCache.IsNull()) { @@ -191,8 +185,7 @@ Api::IPluginManager::PropertyList PluginManager::getProperties() const WrtDB::WidgetDAOReadOnly dao(m_widgetHandle); string localUri = m_objectUri + SEPARATOR; - if (dao.getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) - { + if (dao.getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) { WrtDB::PluginHandleList pluginHandleList = WrtDB::PluginDAOReadOnly::getPluginHandleList(); @@ -219,9 +212,7 @@ Api::IPluginManager::PropertyList PluginManager::getProperties() const } } } - } - else - { + } else { WrtDB::DbWidgetFeatureSet features; Try @@ -261,7 +252,7 @@ Api::IPluginManager::PropertyList PluginManager::getProperties() const } void PluginManager::addPropertiesToList( - JSPropertyNameAccumulatorRef propertyNames) const + JSPropertyNameAccumulatorRef propertyNames) const { PropertyList properties = getProperties(); CommonsJavaScript::Converter converter(m_context); @@ -270,8 +261,6 @@ void PluginManager::addPropertiesToList( JSPropertyNameAccumulatorAddName(propertyNames, name); JSStringRelease(name); } - } - } } diff --git a/src/modules/tizen/PluginManager/PluginManager.h b/src/modules/tizen/PluginManager/PluginManager.h index b6564e1..30b72a3 100644 --- a/src/modules/tizen/PluginManager/PluginManager.h +++ b/src/modules/tizen/PluginManager/PluginManager.h @@ -30,10 +30,9 @@ namespace WrtDeviceApis { namespace PluginManager { - class PluginManager : public Api::IPluginManager { -public: + public: PluginManager(int widgetHandle, const std::string &objectUri, JSObjectRef object, @@ -50,7 +49,7 @@ public: PropertyList getProperties() const; void addPropertiesToList(JSPropertyNameAccumulatorRef propertyNames) const; -private: + private: typedef std::map ObjectList; int m_widgetHandle; @@ -61,7 +60,6 @@ private: ObjectList m_objectList; JSContextRef m_context; }; - } } diff --git a/src/modules/tizen/Widget/Property.h b/src/modules/tizen/Widget/Property.h index 251783d..d1a19d1 100644 --- a/src/modules/tizen/Widget/Property.h +++ b/src/modules/tizen/Widget/Property.h @@ -30,7 +30,6 @@ namespace WrtDeviceApis { namespace Widget { - template class Property { @@ -38,8 +37,7 @@ class Property explicit Property() : m_value(), m_valid(false) - { - } + {} void setValue(const T& value) { @@ -61,8 +59,8 @@ class Property } virtual ~Property() - { - } + {} + private: T m_value; bool m_valid; diff --git a/src/modules/tizen/Widget/Widget.cpp b/src/modules/tizen/Widget/Widget.cpp index 3bc7341..383ca91 100644 --- a/src/modules/tizen/Widget/Widget.cpp +++ b/src/modules/tizen/Widget/Widget.cpp @@ -29,21 +29,19 @@ #include #include - namespace WrtDeviceApis { namespace Widget { using namespace std; using namespace WidgetDB::Api; -Widget::Widget() +Widget::Widget() { using namespace WrtDeviceApis::Commons; m_widgetId = WrtAccessSingleton::Instance().getWidgetId(); } Widget::~Widget() -{ -} +{} string Widget::getProperty(ConfigAttribute attr) const { @@ -149,7 +147,7 @@ unsigned int Widget::getHeight() const if (!m_height.isValid()) { m_height.setValue(Commons::String::toInt( - getProperty(ConfigAttribute::HEIGHT))); + getProperty(ConfigAttribute::HEIGHT))); } return m_height.getValue(); } @@ -160,7 +158,7 @@ unsigned int Widget::getWidth() const if (!m_width.isValid()) { m_width.setValue(Commons::String::toInt( - getProperty(ConfigAttribute::WIDTH))); + getProperty(ConfigAttribute::WIDTH))); } return m_width.getValue(); } diff --git a/src/modules/tizen/Widget/Widget.h b/src/modules/tizen/Widget/Widget.h index eb2ca30..1dee043 100644 --- a/src/modules/tizen/Widget/Widget.h +++ b/src/modules/tizen/Widget/Widget.h @@ -35,7 +35,6 @@ namespace WrtDeviceApis { namespace Widget { - class Widget : public Api::IWidget { public: @@ -74,7 +73,6 @@ class Widget : public Api::IWidget int m_widgetId; }; - } } diff --git a/src/modules/tizen/WidgetDB/WidgetDB.cpp b/src/modules/tizen/WidgetDB/WidgetDB.cpp index 444a859..b37711c 100644 --- a/src/modules/tizen/WidgetDB/WidgetDB.cpp +++ b/src/modules/tizen/WidgetDB/WidgetDB.cpp @@ -41,13 +41,10 @@ #include "WidgetFeature.h" - namespace WrtDeviceApis { namespace WidgetDB { - WidgetDB::WidgetDB(int widgetId) : m_widgetId(widgetId) {} - int WidgetDB::getWidgetId() const { return m_widgetId; @@ -70,25 +67,24 @@ std::string WidgetDB::getLanguage() const } // get 'en' language or first from the list if 'en' does not exist - if (languageTags.size() > 1) - { + if (languageTags.size() > 1) { FOREACH(lang, languageTags) { - if ("en" == DPL::ToUTF8String(*lang)) + if ("en" == DPL::ToUTF8String(*lang)) { return "en"; + } } } - if (!languageTags.empty()) - { - // get first language tag + if (!languageTags.empty()) { + // get first language tag outLanguage = DPL::ToUTF8String(*(languageTags.begin())); } return outLanguage; } /*License,LicenseHref,Description,Name can be \ - returned with incorect language*/ + * returned with incorect language*/ std::string WidgetDB::getConfigValue(Api::ConfigAttribute attribute) const { LogDebug("entered"); @@ -102,55 +98,65 @@ std::string WidgetDB::getConfigValue(Api::ConfigAttribute attribute) const std::ostringstream out; switch (attribute) { - case Api::ConfigAttribute::ID: { + case Api::ConfigAttribute::ID: { DPL::OptionalString val = dao.getGUID(); value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::VERSION: { DPL::OptionalString val = dao.getVersion(); value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::DESCRIPTION: { DPL::OptionalString val = widgetInfo.description; value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::LICENSE: { DPL::OptionalString val = widgetInfo.license; value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::LICENSE_HREF: { DPL::OptionalString val = widgetInfo.licenseHref; value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::AUTHOR_NAME: { DPL::OptionalString val = dao.getAuthorName(); value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::AUTHOR_EMAIL: { DPL::OptionalString val = dao.getAuthorEmail(); value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::AUTHOR_HREF: { DPL::OptionalString val = dao.getAuthorHref(); value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::NAME: { DPL::OptionalString val = widgetInfo.name; value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::SHORT_NAME: { DPL::OptionalString val = widgetInfo.shortName; value = !val ? "" : DPL::ToUTF8String(*val); - break; } + break; + } case Api::ConfigAttribute::ACCESS_NETWORK: value = dao.getAccessNetworkMode() ? "yes" : "no"; @@ -160,13 +166,15 @@ std::string WidgetDB::getConfigValue(Api::ConfigAttribute attribute) const DPL::OptionalInt width = dao.getPreferredSize().width; !width ? out << "0" : out << *width; value = out.str(); - break; } + break; + } case Api::ConfigAttribute::HEIGHT: { DPL::OptionalInt height = dao.getPreferredSize().height; !height ? out << "0" : out << *height; value = out.str(); - break; } + break; + } case Api::ConfigAttribute::INSTALL_PATH: value = DPL::ToUTF8String(dao.getPath()); @@ -195,14 +203,12 @@ std::string WidgetDB::getConfigValue(Api::ConfigAttribute attribute) const return value; } - - std::string WidgetDB::getUserAgent() const { - LogDebug("Widget User_Agent data get"); + LogDebug("Widget User_Agent data get"); - std::string outUA("not implemented"); - return outUA; + std::string outUA("not implemented"); + return outUA; } Api::InstallationStatus WidgetDB::checkInstallationStatus( @@ -210,8 +216,8 @@ Api::InstallationStatus WidgetDB::checkInstallationStatus( const std::string& name, const std::string& version) const { - LogDebug("Checking widget ( gid(" << gid << "), name(" << name << - "), version(" << version << ")) installation status"); + LogDebug("Checking widget ( gid(" << gid << "), name(" << name << + "), version(" << version << ")) installation status"); Api::InstallationStatus outStatus; Try @@ -221,7 +227,7 @@ Api::InstallationStatus WidgetDB::checkInstallationStatus( try { WrtDB::DbWidgetHandle widgetHandle = - WrtDB::WidgetDAOReadOnly::getHandle(w_guid); + WrtDB::WidgetDAOReadOnly::getHandle(w_guid); WrtDB::WidgetDAOReadOnly dao(widgetHandle); DPL::OptionalString ver = dao.getVersion(); @@ -232,7 +238,7 @@ Api::InstallationStatus WidgetDB::checkInstallationStatus( } else { outStatus = Api::InstallationStatus::STATUS_LATEST; } - }catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) { + } catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) { outStatus = Api::InstallationStatus::STATUS_UNINSTALLED; } } @@ -244,7 +250,6 @@ Api::InstallationStatus WidgetDB::checkInstallationStatus( return outStatus; } - Api::Features WidgetDB::getWidgetFeatures() const { LogDebug("entered"); @@ -267,9 +272,9 @@ Api::Features WidgetDB::getWidgetFeatures() const FOREACH(it, features) { Api::IWidgetFeaturePtr feature( - new WidgetFeature(DPL::ToUTF8String((*it).name), - (*it).required, - true)); // requested (WidgetFeature param) + new WidgetFeature(DPL::ToUTF8String((*it).name), + (*it).required, + true)); // requested (WidgetFeature param) // iterating multimap FOREACH(iterator, (*it).params) { @@ -321,9 +326,9 @@ Api::Features WidgetDB::getRegisteredFeatures() const // feature is not on outRegisteredFeature so add it with // 'required' property false Api::IWidgetFeaturePtr newFeature(new WidgetFeature( - dao.GetName(), - false, - false)); + dao.GetName(), + false, + false)); // TODO what about feature params? aren't they needed outRegisteredFeatures.push_back(newFeature); @@ -340,22 +345,20 @@ Api::Features WidgetDB::getRegisteredFeatures() const return outRegisteredFeatures; } - std::string WidgetDB::getWidgetInstallationPath() const { Try { WrtDB::WidgetDAOReadOnly dao(getWidgetId()); std::string result(DPL::ToUTF8String(dao.getFullPath())); - result.erase(0,strlen("file://")); + result.erase(0, strlen("file://")); std::string::size_type pos = result.size(); std::string separator("/"); pos = result.rfind(separator, pos); - if((result.size()-pos) >0 && (result.size()-pos) < 2) - { + if ((result.size() - pos) > 0 && (result.size() - pos) < 2) { result.erase(pos, result.size()); } - return result; + return result; } Catch(DPL::Exception) { @@ -369,7 +372,8 @@ std::string WidgetDB::getWidgetPersistentStoragePath() const { WrtDB::WidgetDAOReadOnly dao(getWidgetId()); return - WrtDB::WidgetConfig::GetWidgetPersistentStoragePath(dao.getTizenPkgId()); + WrtDB::WidgetConfig::GetWidgetPersistentStoragePath( + dao.getTizenPkgId()); } Catch(DPL::Exception) { @@ -383,13 +387,13 @@ std::string WidgetDB::getWidgetTemporaryStoragePath() const { WrtDB::WidgetDAOReadOnly dao(getWidgetId()); return - WrtDB::WidgetConfig::GetWidgetTemporaryStoragePath(dao.getTizenPkgId()); + WrtDB::WidgetConfig::GetWidgetTemporaryStoragePath( + dao.getTizenPkgId()); } Catch(DPL::Exception) { ReThrow(Commons::PlatformException); } } - } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/tizen/WidgetDB/WidgetDB.h b/src/modules/tizen/WidgetDB/WidgetDB.h index 46af26d..b471e1a 100644 --- a/src/modules/tizen/WidgetDB/WidgetDB.h +++ b/src/modules/tizen/WidgetDB/WidgetDB.h @@ -28,7 +28,6 @@ namespace WrtDeviceApis { namespace WidgetDB { - class WidgetDB : public Api::IWidgetDB { public: @@ -44,9 +43,9 @@ class WidgetDB : public Api::IWidgetDB virtual std::string getUserAgent() const; virtual Api::InstallationStatus checkInstallationStatus( - const std::string& gid, - const std::string& name, - const std::string& version) const; + const std::string& gid, + const std::string& name, + const std::string& version) const; virtual Api::Features getWidgetFeatures() const; @@ -61,12 +60,9 @@ class WidgetDB : public Api::IWidgetDB private: int m_widgetId; - }; - } // WidgetDB } // WrtDeviceApis #endif // WRTDEVICEAPIS_WIDGETDB_WIDGETDB_H - diff --git a/src/modules/tizen/WidgetDB/WidgetFeature.cpp b/src/modules/tizen/WidgetDB/WidgetFeature.cpp index 530acff..5733926 100644 --- a/src/modules/tizen/WidgetDB/WidgetFeature.cpp +++ b/src/modules/tizen/WidgetDB/WidgetFeature.cpp @@ -24,7 +24,6 @@ namespace WrtDeviceApis { namespace WidgetDB { - WidgetFeature::WidgetFeature(const std::string& name, bool required, bool requested) : @@ -54,7 +53,7 @@ Api::IWidgetFeature::Params WidgetFeature::getParams() const } void WidgetFeature::addParam(const std::string& paramName, - const std::string& paramValue) + const std::string& paramValue) { //LogDebug("entered"); m_params.push_back(std::make_pair(paramName, paramValue)); @@ -69,6 +68,5 @@ bool WidgetFeature::isRequestedByWidget() const { return m_requested; } - } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/tizen/WidgetDB/WidgetFeature.h b/src/modules/tizen/WidgetDB/WidgetFeature.h index 0634a3a..11be686 100644 --- a/src/modules/tizen/WidgetDB/WidgetFeature.h +++ b/src/modules/tizen/WidgetDB/WidgetFeature.h @@ -27,13 +27,12 @@ namespace WrtDeviceApis { namespace WidgetDB { - class WidgetFeature : public Api::IWidgetFeature { public: WidgetFeature(const std::string& name, - bool required, - bool requested); + bool required, + bool requested); std::string getName() const; @@ -44,7 +43,7 @@ class WidgetFeature : public Api::IWidgetFeature virtual ~WidgetFeature(); virtual void addParam(const std::string& paramName, - const std::string& paramValue); + const std::string& paramValue); virtual bool isRequestedByWidget() const; @@ -54,7 +53,6 @@ class WidgetFeature : public Api::IWidgetFeature bool m_requested; Params m_params; }; - } // WidgetDB } // WrtDeviceApis diff --git a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp index cabc376..411b559 100644 --- a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp +++ b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp @@ -44,7 +44,6 @@ const char *KEY_WIDGET_ARG = "widget_arg"; } namespace WrtDeviceApis { - WidgetInterfaceDAO::WidgetInterfaceDAO(int widgetHandle) : m_widgetHandle(widgetHandle), m_databaseInterface(databaseFileName(widgetHandle), DATABASE_FLAGS) @@ -66,7 +65,6 @@ bool WidgetInterfaceDAO::checkDatabase() std::string databaseFile = databaseFileName(m_widgetHandle); struct stat buffer; if (stat(databaseFile.c_str(), &buffer) != 0) { - //Create fresh database LogInfo("Creating database " << databaseFile); @@ -86,7 +84,7 @@ bool WidgetInterfaceDAO::checkDatabase() Try { DPL::DB::SqlConnection con(databaseFile, - DATABASE_FLAGS, DATABASE_OPTIONS); + DATABASE_FLAGS, DATABASE_OPTIONS); con.ExecCommand(buffer.str().c_str()); } Catch(DPL::DB::SqlConnection::Exception::Base) @@ -178,8 +176,7 @@ void WidgetInterfaceDAO::setItem(const std::string& key, row.Set_configxml(fromConfigXml ? 1 : 0); insert.Values(row); insert.Execute(); - } - else { + } else { Assert(rows.size() == 1); Properties::Row row = rows.front(); if (row.Get_readonly() != 0) { @@ -199,7 +196,6 @@ void WidgetInterfaceDAO::setItem(const std::string& key, LogError("Cannot set item " << key << " with value " << value); ReThrow(Commons::PlatformException); } - } void WidgetInterfaceDAO::removeItem(const std::string& key) @@ -214,7 +210,7 @@ void WidgetInterfaceDAO::removeItem(const std::string& key) bool readonly = select.GetSingleValue(); if (readonly) { ThrowMsg(Commons::LocalStorageValueNoModifableException, - "Cannot delete item. Item is readonly"); + "Cannot delete item. Item is readonly"); } Properties::Delete deleteItem(&m_databaseInterface); deleteItem.Where(Equals(DPL::FromUTF8String(key))); @@ -228,7 +224,7 @@ void WidgetInterfaceDAO::removeItem(const std::string& key) } DPL::Optional WidgetInterfaceDAO::getValue( - const std::string& key) const + const std::string& key) const { using namespace DPL::DB::ORM; using namespace DPL::DB::ORM::widget_interface; @@ -341,5 +337,4 @@ std::string WidgetInterfaceDAO::databaseFileName(int widgetHandle) WrtDB::WrtDatabase::detachFromThread(); return filename.str(); } - } diff --git a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.h b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.h index 371ae58..b4141c0 100644 --- a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.h +++ b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.h @@ -28,7 +28,6 @@ #include namespace WrtDeviceApis { - class WidgetInterfaceDAO : public LocalStorage::Api::ILocalStorage { @@ -58,7 +57,6 @@ class WidgetInterfaceDAO : bool copyPropertiesFromWrtDatabase(); static std::string databaseFileName(int widgetHandle); }; - } #endif //WRTDEVICEAPIS_COMMONS_WIDGET_INTERFACE_DAO_H_ \ No newline at end of file diff --git a/src/modules/tizen/WidgetInterfaceDAO/widget_interface_db_sql_generator.h b/src/modules/tizen/WidgetInterfaceDAO/widget_interface_db_sql_generator.h index a45dc93..b4ce0b6 100644 --- a/src/modules/tizen/WidgetInterfaceDAO/widget_interface_db_sql_generator.h +++ b/src/modules/tizen/WidgetInterfaceDAO/widget_interface_db_sql_generator.h @@ -17,7 +17,8 @@ * @file wrt_db_sql_generator.h * @author Bartosz Janiak (b.janiak@samsung.com) * @version 1.0 - * @brief Macro definitions for generating the SQL input file from database definition. + * @brief Macro definitions for generating the SQL input file from + * database definition. */ //Do not include this file directly! It is used only for SQL code generation. diff --git a/src/plugin-loading/explorer.cpp b/src/plugin-loading/explorer.cpp index bbb22d4..fc69a28 100644 --- a/src/plugin-loading/explorer.cpp +++ b/src/plugin-loading/explorer.cpp @@ -27,7 +27,7 @@ #include "explorer.h" #include "plugin_property_support.h" -// JS overlay +// JS overlay #include #include #include @@ -38,7 +38,6 @@ #include #include - namespace { //const char* SEPARATOR = "."; const std::string GLOBAL_OBJECT_NAME = "GLOBAL_OBJECT"; @@ -66,8 +65,7 @@ Explorer::Explorer(JSGlobalContextRef context) : m_propertySupport.reset(new WindowPropertySupport(m_context)); // initialization for use of custom event - if (!AddEventListenerSupport::isInitialized()) - { + if (!AddEventListenerSupport::isInitialized()) { LogInfo("initialization for use of custom event"); AddEventListenerSupport::initialize(context); } @@ -81,23 +79,22 @@ Explorer::~Explorer() AddEventListenerSupport::deinitialize(); } } - + JSObjectPtr Explorer::getJSObjectProperty(const std::string& propertyName, - JSObjectPtr object) + JSObjectPtr object) { LogDebug("Get object property " << propertyName); return JavaScriptInterfaceSingleton::Instance().getJSObjectProperty( - m_context, object, propertyName); + m_context, object, propertyName); } JSObjectPtr Explorer::getProperty( const string& requestedProperty, - JSObjectPtr providedObject) + JSObjectPtr providedObject) { LogDebug("Requested Property: " << requestedProperty); - if(!providedObject) - { + if (!providedObject) { LogError("Provided object is empty"); return JSObjectPtr(); } @@ -106,27 +103,23 @@ JSObjectPtr Explorer::getProperty( std::string currentPropertyRequested = requestedProperty; JSObjectPtr currentObject = providedObject; - while(true) - { + while (true) { auto pos = currentPropertyRequested.find("."); - if (pos == string::npos) - { + if (pos == string::npos) { return getJSObjectProperty(currentPropertyRequested, currentObject); } //check if requested object has child - currentObjectName = currentPropertyRequested.substr(0,pos); + currentObjectName = currentPropertyRequested.substr(0, pos); - if (currentPropertyRequested.size() <= pos+1) - { + if (currentPropertyRequested.size() <= pos + 1) { LogError("Wrong name of requested property"); return JSObjectPtr(); } - currentPropertyRequested = currentPropertyRequested.substr(pos+1); + currentPropertyRequested = currentPropertyRequested.substr(pos + 1); currentObject = getJSObjectProperty(currentObjectName, currentObject); - if(!currentObject) - { + if (!currentObject) { LogError("Failed to get property: " << currentObjectName); return JSObjectPtr(); } @@ -140,92 +133,91 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration, bool retValue; - if (declaration->getParentName() == GLOBAL_OBJECT_NAME) - { + if (declaration->getParentName() == GLOBAL_OBJECT_NAME) { LogDebug("Connect to Global object"); retValue = register_(declaration, m_globalObject, context); - } - else //PIM support - { + } else { //PIM support LogDebug("Connect to NOT global object"); //it should be master object name string masterName = declaration->getParentName(); auto pos = masterName.find("."); - if (string::npos != pos) - { + if (string::npos != pos) { LogError("ParentName not allowed"); return false; } auto masterObject = getJSObjectProperty(masterName, m_globalObject); - if (masterObject->getObject() == 0) - { + if (masterObject->getObject() == 0) { return false; } - retValue = registerObject(declaration, masterName, masterObject, context); + retValue = registerObject(declaration, + masterName, + masterObject, + context); } if (declaration->checkIframesSupported()) { LogDebug("Iframe supported"); m_iframeSupport.registerDeclaration(declaration); -// m_iframeSupport.invokeCallbackForMainFrame(m_context, -// declaration, -// newObject); - } - else { + // m_iframeSupport.invokeCallbackForMainFrame(m_context, + // declaration, + // newObject); + } else { LogDebug("Iframe NOT supported"); } return retValue; } - bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration, - const std::string& providedObjectName, - JSObjectPtr providedObject, - JSGlobalContextRef context) + const std::string& providedObjectName, + JSObjectPtr providedObject, + JSGlobalContextRef context) { - LogDebug("Register object. Provided object name: '" << providedObjectName - << "', registration of: '" << declaration->getName() << "'"); + LogDebug( + "Register object. Provided object name: '" << providedObjectName + << + "', registration of: '" << declaration->getName() << "'"); std::string fullParentName = declaration->getParentName(); LogDebug("Parent name: " << declaration->getParentName()); - if(fullParentName == providedObjectName) - { + if (fullParentName == providedObjectName) { LogDebug("Provided object match equaly to requested parent"); return register_(declaration, providedObject, context); } //check if object exists in fullParentName auto pos = fullParentName.find(providedObjectName); - if(pos == string::npos) - { - LogError("Object: " << declaration->getName() - << " should be child of: " << declaration->getParentName() - << " but you provided object: " << providedObjectName); + if (pos == string::npos) { + LogError( + "Object: " << declaration->getName() + << " should be child of: " << + declaration->getParentName() + << " but you provided object: " << + providedObjectName); return false; } - if (fullParentName.size() <= pos+providedObjectName.size()+1) - { + if (fullParentName.size() <= pos + providedObjectName.size() + 1) { LogError("Invalid object name"); return false; } auto currentRequesteProperty = - fullParentName.substr(pos+providedObjectName.size()+1); - + fullParentName.substr(pos + providedObjectName.size() + 1); JSObjectPtr jsObject = getProperty( - currentRequesteProperty, providedObject); + currentRequesteProperty, providedObject); - if(!jsObject->getObject()) - { - LogError("Object: '" << declaration->getName() - << "' should be child of: '" << declaration->getParentName() - << "'. you provided object: '" << providedObjectName - << "' but object is null"); + if (!jsObject->getObject()) { + LogError( + "Object: '" << declaration->getName() + << "' should be child of: '" << + declaration->getParentName() + << "'. you provided object: '" << + providedObjectName + << "' but object is null"); return false; } @@ -234,8 +226,8 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration, } bool Explorer::register_(const JSObjectDeclarationPtr& declaration, - JSObjectPtr parent, - JSGlobalContextRef context) + JSObjectPtr parent, + JSGlobalContextRef context) { LogInfo("Registration object: " << declaration->getParentName() << "<-" << declaration->getName()); @@ -244,11 +236,11 @@ bool Explorer::register_(const JSObjectDeclarationPtr& declaration, typedef JSObjectDeclaration::Options JO; - JSGlobalContextRef gContext = (context==NULL)?m_context:context; + JSGlobalContextRef gContext = (context == NULL) ? m_context : context; JSObjectPtr newObject; JSObjectPtr objectInstance = JavaScriptInterfaceSingleton::Instance(). - createObject(gContext,declaration); + createObject(gContext, declaration); //function creation if (declaration->getOptions() && @@ -257,33 +249,28 @@ bool Explorer::register_(const JSObjectDeclarationPtr& declaration, LogDebug("Loading function object " << declaration->getName()); auto type = declaration->getOptions()->getIframeOverlay(); - if (JO::IFrameOverlay::OverlayedBeforeOriginal == type) - { + if (JO::IFrameOverlay::OverlayedBeforeOriginal == type) { LogDebug("Create overlayed function"); JSObjectPtr original = JavaScriptInterfaceSingleton::Instance(). - getJSObjectProperty(gContext, - parent, - declaration->getName()); + getJSObjectProperty(gContext, + parent, + declaration->getName()); newObject = JSOverlaySupport:: - createWrappedFunction(gContext, - original, - objectInstance, - declaration->getName()); - } - else - { + createWrappedFunction(gContext, + original, + objectInstance, + declaration->getName()); + } else { LogDebug("create normal function"); newObject = objectInstance; } - } - else //object creation - { + } else { //object creation newObject = objectInstance; } JavaScriptInterfaceSingleton::Instance().setObjectProperty( - gContext, + gContext, parent, declaration->getName(), newObject); @@ -298,16 +285,15 @@ bool Explorer::register_(const JSObjectDeclarationPtr& declaration, objectInstance->getObject()); } - return true; } -void Explorer::registerObjectIntoIframe(const JSObjectDeclarationPtr& declaration, - JSObjectPtr frameObject, - JSGlobalContextRef context) +void Explorer::registerObjectIntoIframe( + const JSObjectDeclarationPtr& declaration, + JSObjectPtr frameObject, + JSGlobalContextRef context) { - if (declaration->getParentName() == GLOBAL_OBJECT_NAME) - { + if (declaration->getParentName() == GLOBAL_OBJECT_NAME) { LogDebug("Connect to Global object of IFRAME"); register_(declaration, frameObject, context); return; @@ -319,14 +305,12 @@ void Explorer::registerObjectIntoIframe(const JSObjectDeclarationPtr& declaratio //it should be master object name string masterName = declaration->getParentName(); auto pos = masterName.find("."); - if (string::npos != pos) - { + if (string::npos != pos) { LogError("ParentName not allowed"); return; } auto masterObject = getJSObjectProperty(masterName, frameObject); - if (!masterObject->getObject()) - { + if (!masterObject->getObject()) { LogError("Object not exist in frame"); return; } @@ -334,7 +318,6 @@ void Explorer::registerObjectIntoIframe(const JSObjectDeclarationPtr& declaratio } } - void Explorer::loadFrame(JSGlobalContextRef context) { LogDebug("Frame attached"); @@ -345,8 +328,7 @@ void Explorer::loadFrame(JSGlobalContextRef context) LogDebug("Register main frame"); //register main frame; - if(frameObject->getObject() == m_globalObject->getObject()) - { + if (frameObject->getObject() == m_globalObject->getObject()) { // Main page was already loaded from constructor LogDebug("Main page loaded"); return; @@ -378,8 +360,7 @@ void Explorer::removePluginsFromIframes() { LogDebug("Remove plugins from iframes"); - if (m_iframeSupport.hasIframes()) - { + if (m_iframeSupport.hasIframes()) { LogDebug("Removing iframes"); JavaScriptInterfaceSingleton::Instance().removeIframes(m_context); } @@ -389,8 +370,7 @@ void Explorer::deregisterObject(const JSObjectDeclarationPtr& declaration) { LogDebug("Deregister object " << declaration->getName()); - if (GLOBAL_OBJECT_NAME != declaration->getParentName()) - { + if (GLOBAL_OBJECT_NAME != declaration->getParentName()) { LogWarning("Ignored remove property " << declaration->getName()); return; } @@ -421,7 +401,8 @@ void Explorer::callEventListeners(CustomEventType eventType, void* data) if (eventType == ServiceCustomEvent) { using namespace WrtDeviceApis::TizenServiceEvent::Api; // set user data of js callback function for 'appservice' js event - ITizenServiceEventPtr event = ITizenServiceEventPtr(new TizenServiceEvent()); + ITizenServiceEventPtr event = ITizenServiceEventPtr( + new TizenServiceEvent()); event->setScale(m_propertySupport->getScale()); event->setBundle(m_propertySupport->getBundle()); @@ -433,10 +414,11 @@ void Explorer::callEventListeners(CustomEventType eventType, void* data) auto eventPriv = new JSTizenServiceEventPrivateObject(m_context, event); JSObjectRef eventObject = - JSObjectMake(m_context, JSTizenServiceEvent::getClassRef(), eventPriv); + JSObjectMake(m_context, + JSTizenServiceEvent::getClassRef(), eventPriv); AddEventListenerSupport::CallCustomEventListenersFromIFrame( - frame, eventType, eventObject); + frame, eventType, eventObject); } } else if (eventType == SoftKeyboardChangeCustomEvent) { using namespace WrtDeviceApis::SoftKeyboardChangeEvent::Api; @@ -445,17 +427,20 @@ void Explorer::callEventListeners(CustomEventType eventType, void* data) return; } - // set user data of js callback function for 'softkeyboardchange' js event - SoftKeyboardChangeArgs* args = static_cast(data); + // set user data of js callback function for 'softkeyboardchange' js + // event + SoftKeyboardChangeArgs* args = + static_cast(data); ISoftKeyboardChangeEventPtr event = ISoftKeyboardChangeEventPtr( - new SoftKeyboardChangeEvent( - args->state, - args->width, - args->height)); + new SoftKeyboardChangeEvent( + args->state, + args->width, + args->height)); LogInfo("softkeyboard event's state: " << args->state); - // call js callback function for 'softkeyboardchange' js event on each frame + // call js callback function for 'softkeyboardchange' js event on each + // frame FOREACH(it, *frameLists) { JSObjectRef frame = static_cast((*it).Get()->getObject()); @@ -464,18 +449,17 @@ void Explorer::callEventListeners(CustomEventType eventType, void* data) new JSSoftKeyboardChangeEventPrivateObject(m_context, event); JSObjectRef eventObject = JSObjectMake( - m_context, - JSSoftKeyboardChangeEvent::getClassRef(), - eventPriv); + m_context, + JSSoftKeyboardChangeEvent::getClassRef(), + eventPriv); AddEventListenerSupport::CallCustomEventListenersFromIFrame( - frame, eventType, eventObject); + frame, eventType, eventObject); } } else { LogInfo("Not supported custom event type"); return; } - } WindowPropertySupport* Explorer::getWindowPropertySupport() diff --git a/src/plugin-loading/explorer.h b/src/plugin-loading/explorer.h index 0c81dcf..60d2fb6 100644 --- a/src/plugin-loading/explorer.h +++ b/src/plugin-loading/explorer.h @@ -87,16 +87,15 @@ class Explorer : private DPL::Noncopyable JSGlobalContextRef context); bool register_(const JSObjectDeclarationPtr& declaration, - JSObjectPtr parent, - JSGlobalContextRef context); - + JSObjectPtr parent, + JSGlobalContextRef context); JSObjectPtr getJSObjectProperty(const std::string& propertyName, - JSObjectPtr object); + JSObjectPtr object); JSObjectPtr getProperty( const std::string& requestedProperty, - JSObjectPtr providedObject); + JSObjectPtr providedObject); }; typedef DPL::SharedPtr ExplorerPtr; diff --git a/src/plugin-loading/javascript_interface.cpp b/src/plugin-loading/javascript_interface.cpp index 0534397..9cb8827 100644 --- a/src/plugin-loading/javascript_interface.cpp +++ b/src/plugin-loading/javascript_interface.cpp @@ -34,15 +34,15 @@ IMPLEMENT_SINGLETON(JavaScriptInterface) #define CHECK_JSVALUE_IS_UNDEFINED_RETURN(context, object, ret) \ - if (JSValueIsUndefined(context, object)) {\ - LogError("Object " << #object << " is undefined");\ - return ret;\ + if (JSValueIsUndefined(context, object)) { \ + LogError("Object " << #object << " is undefined"); \ + return ret; \ } #define CHECK_JSOBJECT_IS_NULL_RETURN(object, ret) \ - if (!object) {\ - LogError("Object " << #object << " is NULL");\ - return ret;\ + if (!object) { \ + LogError("Object " << #object << " is NULL"); \ + return ret; \ } namespace { @@ -71,39 +71,42 @@ std::string toString(const JSStringRef& arg) /** * Converts JSValueRef to std::string * */ -std::string toString(JSContextRef ctx, JSValueRef value) { - Assert(ctx && value); - std::string result; - JSStringRef str = JSValueToStringCopy(ctx, value, NULL); - result = toString(str); - JSStringRelease(str); - return result; +std::string toString(JSContextRef ctx, JSValueRef value) +{ + Assert(ctx && value); + std::string result; + JSStringRef str = JSValueToStringCopy(ctx, value, NULL); + result = toString(str); + JSStringRelease(str); + return result; } -JSValueRef getProperty(JSContextRef ctx, JSValueRef value, const char* name) { - Assert(ctx && value && name); - JSValueRef result = NULL; - JSObjectRef obj = JSValueToObject(ctx, value, NULL); - if (obj) { - JSStringRef str = JSStringCreateWithUTF8CString(name); - result = JSObjectGetProperty(ctx, obj, str, NULL); - JSStringRelease(str); - } - return result; +JSValueRef getProperty(JSContextRef ctx, JSValueRef value, const char* name) +{ + Assert(ctx && value && name); + JSValueRef result = NULL; + JSObjectRef obj = JSValueToObject(ctx, value, NULL); + if (obj) { + JSStringRef str = JSStringCreateWithUTF8CString(name); + result = JSObjectGetProperty(ctx, obj, str, NULL); + JSStringRelease(str); + } + return result; } -JSValueRef getPropertyObj(JSContextRef ctx, JSObjectRef obj, const char* name) { - Assert(ctx && obj && name); - JSStringRef str = JSStringCreateWithUTF8CString(name); - JSValueRef result = JSObjectGetProperty(ctx, obj, str, NULL); - JSStringRelease(str); - return result; +JSValueRef getPropertyObj(JSContextRef ctx, JSObjectRef obj, const char* name) +{ + Assert(ctx && obj && name); + JSStringRef str = JSStringCreateWithUTF8CString(name); + JSValueRef result = JSObjectGetProperty(ctx, obj, str, NULL); + JSStringRelease(str); + return result; } -JSObjectRef getJSGlobalObject(JSGlobalContextRef context){ +JSObjectRef getJSGlobalObject(JSGlobalContextRef context) +{ return JSContextGetGlobalObject(context); } - } typedef JSValueRef (*JSCFunction)( @@ -114,11 +117,10 @@ typedef JSValueRef (*JSCFunction)( const JSValueRef arguments[], JSValueRef* exception); - void JavaScriptInterface::setObjectProperty(JSGlobalContextRef context, - const JSObjectPtr& parentObject, - const std::string &propertyName, - const JSObjectPtr& propertyObject) + const JSObjectPtr& parentObject, + const std::string &propertyName, + const JSObjectPtr& propertyObject) { LogInfo("Webkit:setting property --" << propertyName << "--"); @@ -135,8 +137,8 @@ void JavaScriptInterface::setObjectProperty(JSGlobalContextRef context, } void JavaScriptInterface::removeObjectProperty(JSGlobalContextRef context, - const JSObjectPtr& parentObject, - const std::string &propertyName) + const JSObjectPtr& parentObject, + const std::string &propertyName) { if (!context) { //nothing to do -> no context @@ -152,9 +154,10 @@ void JavaScriptInterface::removeObjectProperty(JSGlobalContextRef context, JSStringRelease(name); } -JavaScriptInterface::PropertiesList JavaScriptInterface::getObjectPropertiesList( - JSGlobalContextRef context, - const JSObjectPtr& object) const +JavaScriptInterface::PropertiesList JavaScriptInterface:: + getObjectPropertiesList( + JSGlobalContextRef context, + const JSObjectPtr& object) const { PropertiesList result; JSPropertyNameArrayRef properties = JSObjectCopyPropertyNames( @@ -172,17 +175,17 @@ JavaScriptInterface::PropertiesList JavaScriptInterface::getObjectPropertiesList } JSObjectPtr JavaScriptInterface::makeJSFunctionObject( - JSGlobalContextRef context, - const std::string &name, - js_function_impl functionImplementation) const + JSGlobalContextRef context, + const std::string &name, + js_function_impl functionImplementation) const { LogDebug("Create JS function"); JSStringRef jsFunName = JSStringCreateWithUTF8CString(name.c_str()); JSObjectRef object = JSObjectMakeFunctionWithCallback( - context, - jsFunName, - reinterpret_cast( + context, + jsFunName, + reinterpret_cast( functionImplementation)); JSStringRelease(jsFunName); @@ -190,8 +193,8 @@ JSObjectPtr JavaScriptInterface::makeJSFunctionObject( } JSObjectPtr JavaScriptInterface::makeJSClassObject( - JSGlobalContextRef context, - JSObjectDeclaration::ConstClassTemplate classTemplate) const + JSGlobalContextRef context, + JSObjectDeclaration::ConstClassTemplate classTemplate) const { LogDebug("Create JS object"); JSObjectRef object = JSObjectMake( @@ -203,92 +206,102 @@ JSObjectPtr JavaScriptInterface::makeJSClassObject( } JSObjectPtr JavaScriptInterface::makeJSObjectBasedOnInterface( - JSGlobalContextRef context, - const std::string &interfaceName) const + JSGlobalContextRef context, + const std::string &interfaceName) const { LogDebug("Create JS object base on interface: " << interfaceName); LogDebug("Context: " << context); - JSObjectPtr jsInterfaceObj = getJSObjectProperty(context, - getGlobalObject(context), interfaceName); + getGlobalObject( + context), + interfaceName); JSObjectRef object = JSObjectCallAsConstructor(context, - static_cast(jsInterfaceObj->getObject()), 0, NULL, - NULL); + static_cast( + jsInterfaceObj-> + getObject()), 0, + NULL, + NULL); return JSObjectPtr(new JSObject(static_cast(object))); } JSObjectPtr JavaScriptInterface::makeJSInterface( - JSGlobalContextRef context, - JSObjectDeclaration::ConstClassTemplate classTemplate, - JSObjectDeclaration::ConstructorCallback constructorCallback) const + JSGlobalContextRef context, + JSObjectDeclaration::ConstClassTemplate classTemplate, + JSObjectDeclaration::ConstructorCallback constructorCallback) const { LogDebug("Create JS interface. Context: " << context); JSObjectRef object = JSObjectMakeConstructor(context, - static_cast( - const_cast( - classTemplate)), - reinterpret_cast( - constructorCallback) - ); + static_cast( + const_cast< + JSObjectDeclaration:: + ClassTemplate>( + classTemplate)), + reinterpret_cast< + JSObjectCallAsConstructorCallback>( + constructorCallback) + ); return JSObjectPtr(new JSObject(static_cast(object))); } -JSObjectPtr JavaScriptInterface::createObject(JSGlobalContextRef context, - const JSObjectDeclarationPtr& declaration) +JSObjectPtr JavaScriptInterface::createObject( + JSGlobalContextRef context, + const JSObjectDeclarationPtr& + declaration) { typedef JSObjectDeclaration::Options JO; - if( declaration->getOptions()) - { - switch (declaration->getOptions()->getType()) - { + if (declaration->getOptions()) { + switch (declaration->getOptions()->getType()) { case JO::ClassType::Function: return makeJSFunctionObject( - context, - declaration->getName(), - declaration->getOptions()->getFunctionImpl()); + context, + declaration->getName(), + declaration->getOptions()->getFunctionImpl()); case JO::ClassType::Class: if (declaration->getInterfaceName().empty()) { return makeJSClassObject( - context, - declaration->getClassTemplate()); + context, + declaration->getClassTemplate()); } else { return makeJSObjectBasedOnInterface( - context, - declaration->getInterfaceName()); + context, + declaration->getInterfaceName()); } case JO::ClassType::Interface: return makeJSInterface( - context, - /* product class template */ - declaration->getClassTemplate(), - declaration->getConstructorCallback()); + context, + /* product class template */ + declaration->getClassTemplate(), + declaration->getConstructorCallback()); default: LogError("Invalid class type. Making empty JS object."); return JSObjectPtr(new JSObject( - JSObjectMake(context, NULL, NULL))); + JSObjectMake(context, NULL, NULL))); } } else { LogDebug("No declaration options"); return JSObjectPtr(new JSObject( - JSObjectMake( - context, - static_cast( - const_cast( - declaration->getClassTemplate())), - NULL))); + JSObjectMake( + context, + static_cast( + const_cast( + declaration->getClassTemplate())), + NULL))); } } JSObjectPtr JavaScriptInterface::getGlobalObject(JSGlobalContextRef context) - const +const { return JSObjectPtr(new JSObject(static_cast( - JSContextGetGlobalObject(static_cast(context))))); + JSContextGetGlobalObject(static_cast< + JSGlobalContextRef>( + context))))); } JSObjectPtr JavaScriptInterface::copyObjectToIframe( @@ -323,7 +336,7 @@ JSObjectPtr JavaScriptInterface::copyObjectToIframe( JSStringRelease(requestedObjectStr); return JSObjectPtr( - new JSObject(const_cast(requestedObject))); + new JSObject(const_cast(requestedObject))); } JavaScriptInterface::ObjectsListPtr @@ -384,8 +397,9 @@ JavaScriptInterface::getIframesList(JSContextRef context, } JSObjectPtr JavaScriptInterface::getJSObjectProperty(JSGlobalContextRef ctx, - const JSObjectPtr& frame, - const std::string& name) const + const JSObjectPtr& frame, + const std::string& name) +const { JSObjectRef frame_js = static_cast(frame->getObject()); diff --git a/src/plugin-loading/javascript_interface.h b/src/plugin-loading/javascript_interface.h index 7b77cc6..c3aa171 100644 --- a/src/plugin-loading/javascript_interface.h +++ b/src/plugin-loading/javascript_interface.h @@ -34,9 +34,9 @@ //forward declaration of JSConectexRef extern "C" { - typedef const struct OpaqueJSContext* JSContextRef; - typedef struct OpaqueJSContext* JSGlobalContextRef; - typedef struct OpaqueJSValue* JSObjectRef; +typedef const struct OpaqueJSContext* JSContextRef; +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSValue* JSObjectRef; } class JavaScriptInterface : DPL::Noncopyable @@ -79,31 +79,30 @@ class JavaScriptInterface : DPL::Noncopyable void invokeGarbageCollector(JSGlobalContextRef context); JSObjectPtr getJSObjectProperty(JSGlobalContextRef ctx, - const JSObjectPtr& frame, - const std::string& name) const; + const JSObjectPtr& frame, + const std::string& name) const; private: JavaScriptInterface() - { - } + {} JSObjectPtr makeJSFunctionObject( - JSGlobalContextRef context, - const std::string &name, - js_function_impl functionImplementation) const; + JSGlobalContextRef context, + const std::string &name, + js_function_impl functionImplementation) const; JSObjectPtr makeJSClassObject( - JSGlobalContextRef context, - JSObjectDeclaration::ConstClassTemplate classTemplate) const; + JSGlobalContextRef context, + JSObjectDeclaration::ConstClassTemplate classTemplate) const; JSObjectPtr makeJSObjectBasedOnInterface( - JSGlobalContextRef context, - const std::string &interfaceName) const; + JSGlobalContextRef context, + const std::string &interfaceName) const; JSObjectPtr makeJSInterface( - JSGlobalContextRef context, - JSObjectDeclaration::ConstClassTemplate classTemplate, - JSObjectDeclaration::ConstructorCallback constructorCallback) const; + JSGlobalContextRef context, + JSObjectDeclaration::ConstClassTemplate classTemplate, + JSObjectDeclaration::ConstructorCallback constructorCallback) const; ObjectsListPtr getIframesList(JSContextRef context, - JSObjectRef object) const; + JSObjectRef object) const; friend class DPL::Singleton; }; diff --git a/src/plugin-loading/js_page_session.cpp b/src/plugin-loading/js_page_session.cpp index 1534d24..501c4bb 100644 --- a/src/plugin-loading/js_page_session.cpp +++ b/src/plugin-loading/js_page_session.cpp @@ -141,26 +141,23 @@ class JSPageSession::Impl const char* theme); void dispatchJavaScriptEvent(CustomEventType eventType, void* data); - }; - JSPageSession::Impl::Impl(const PluginContainerSupportPtr& support) : m_sessionStarted(false) { -// DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS"); + // DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS"); LogDebug("Initializing Page Session"); m_pluginsSupport = support; // explicit call to keep singleton's lifetime until calling destructor. -// JsFunctionManagerSingleton::Instance(); -// JavaScriptInterfaceSingleton::Instance(); + // JsFunctionManagerSingleton::Instance(); + // JavaScriptInterfaceSingleton::Instance(); } JSPageSession::Impl::~Impl() { - if(m_sessionStarted) - { + if (m_sessionStarted) { LogError("Must stop widget session before exit!"); stopSession(); } @@ -207,9 +204,7 @@ bool JSPageSession::Impl::installPlugin(PluginModelPtr plugin) LogInfo("Install Plugin '" << library->GetFileName()); - - if(!library) - { + if (!library) { LogError("Loading library failed"); return false; } @@ -231,7 +226,7 @@ void JSPageSession::Impl::installRequestedFeatures() LogInfo("Installing requested widget features..."); std::list allowedFeatures = - m_pluginsSupport->getAllowedFeatures(m_widgetHandle); + m_pluginsSupport->getAllowedFeatures(m_widgetHandle); PluginContainerSupport::PluginsList allowedPlugins; @@ -242,14 +237,14 @@ void JSPageSession::Impl::installRequestedFeatures() auto plugin = m_pluginsSupport->getPluginForFeature(*feature); ImplementedObjectsList implObjs = PluginDAOReadOnly:: - getImplementedObjectsForPluginHandle(plugin->Handle.Get()); + getImplementedObjectsForPluginHandle(plugin->Handle.Get()); FOREACH(obj, implObjs) { LogDebug("Processing object: " << *obj); /* This can be optimalized, but would need extra data in database. - There should be a list of features that are allowed to be - installed at widget start */ + * There should be a list of features that are allowed to be + * installed at widget start */ if (obj->find(".") == obj->rfind(".")) { allowedPlugins.push_back(plugin); LogWarning("Plugin will be added: " @@ -283,50 +278,49 @@ bool JSPageSession::Impl::loadPluginOnDemand( LogError("Session not started"); return false; } -// //TODO here may be a bug. if plugin contains feature rejected and accepted -// LogInfo("Installing feature : " << widgetFeature.name); -// if (widgetFeature.rejected) { -// LogWarning("This api-feature was rejected"); -// return; -// } -// -// auto plugin = m_pluginsSupport->getPluginModelById(pluginHandle); -// if (!plugin) { -// LogError("Failed to load plugin. plugin handle: " << pluginHandle); -// return false; -// } + // //TODO here may be a bug. if plugin contains feature rejected and + // accepted + // LogInfo("Installing feature : " << widgetFeature.name); + // if (widgetFeature.rejected) { + // LogWarning("This api-feature was rejected"); + // return; + // } + // + // auto plugin = m_pluginsSupport->getPluginModelById(pluginHandle); + // if (!plugin) { + // LogError("Failed to load plugin. plugin handle: " << + // pluginHandle); + // return false; + // } m_pluginsSupport->registerPluginModel(pluginHandle); return installPluginOnDemand( - m_pluginsSupport->getPluginModelById(pluginHandle), - parentObject, - context); + m_pluginsSupport->getPluginModelById(pluginHandle), + parentObject, + context); } bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin, - JavaScriptObject& parentObject, - JSGlobalContextRef context) + JavaScriptObject& parentObject, + JSGlobalContextRef context) { Assert(plugin && "Plugin Model is NULL"); auto library = loadLibrary(plugin); LogInfo("Install Plugin '" << library->GetFileName()); - if(!library) - { + if (!library) { LogError("Loading library failed"); return false; } - if(!(parentObject.instance)) - { + if (!(parentObject.instance)) { LogError("NULL pointer value"); return false; } JSObjectPtr parent(new JSObject(parentObject.instance)); - if (!parent->getObject()) - { + if (!parent->getObject()) { LogError("NULL pointer value"); assert(false); return false; @@ -340,10 +334,11 @@ bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin, parent, context); - if(!installationStatus) - { - LogError("Object Registration failed : " << (*it)->getName() - << "; Parent object name: " << parentObject.name); + if (!installationStatus) { + LogError( + "Object Registration failed : " << (*it)->getName() + << + "; Parent object name: " << parentObject.name); return false; } } @@ -353,11 +348,13 @@ bool JSPageSession::Impl::installPluginOnDemand(PluginModelPtr plugin, } void JSPageSession::Impl::setCustomProperties(double scaleFactor, - const char* encodedBundle, - const char* theme) + const char* encodedBundle, + const char* theme) { - LogInfo("set properties of window object " << scaleFactor << ", " - << encodedBundle << ", " << theme); + LogInfo( + "set properties of window object " << scaleFactor << ", " + << encodedBundle << ", " << + theme); m_objectExplorer->getWindowPropertySupport() ->setScaleToNavigatorProperty(scaleFactor); @@ -367,7 +364,8 @@ void JSPageSession::Impl::setCustomProperties(double scaleFactor, ->setThemeToNavigatorProperty(theme); } -void JSPageSession::Impl::dispatchJavaScriptEvent(CustomEventType eventType, void* data) +void JSPageSession::Impl::dispatchJavaScriptEvent(CustomEventType eventType, + void* data) { // Check if session is already started if (!m_sessionStarted) { @@ -383,13 +381,13 @@ void JSPageSession::Impl::loadInjectedJavaScript() { LogInfo("Entered"); - std::string DIR_PATH = "/usr/etc/wrt/injected-javascript"; + std::string DIR_PATH = "/usr/etc/wrt/injected-javascript"; std::string JS_EXTENSION = ".js"; DIR *dir = opendir(DIR_PATH.c_str()); if (!dir) { - LogError("opendir(\"" << DIR_PATH << "\") error!" ); + LogError("opendir(\"" << DIR_PATH << "\") error!"); return; } @@ -397,8 +395,7 @@ void JSPageSession::Impl::loadInjectedJavaScript() std::list jsFiles; // make file list from DIR_PATH - while ((libdir = readdir(dir)) != 0) - { + while ((libdir = readdir(dir)) != 0) { if (strncmp(libdir->d_name, ".", 2) == 0 || strncmp(libdir->d_name, "..", 3) == 0) { @@ -413,7 +410,7 @@ void JSPageSession::Impl::loadInjectedJavaScript() std::transform(lowercase.begin(), lowercase.end(), lowercase.begin(), towlower); - if( lowercase.rfind(JS_EXTENSION) == std::string::npos || + if (lowercase.rfind(JS_EXTENSION) == std::string::npos || lowercase.length() != lowercase.rfind(JS_EXTENSION) + JS_EXTENSION.length() ) { @@ -439,7 +436,6 @@ void JSPageSession::Impl::loadInjectedJavaScript() closedir(dir); - FOREACH(it, jsFiles) { LogDebug("load file : " << (*it)); @@ -447,8 +443,7 @@ void JSPageSession::Impl::loadInjectedJavaScript() std::string content; std::ifstream fin(it->c_str()); - while(fin.good()) - { + while (fin.good()) { string line; std::getline(fin, line); content += line + "\n"; @@ -456,8 +451,7 @@ void JSPageSession::Impl::loadInjectedJavaScript() fin.close(); // execute - if(!content.empty()) - { + if (!content.empty()) { JSValueRef exception = NULL; JSStringRef script = JSStringCreateWithUTF8CString(content.c_str()); @@ -466,10 +460,9 @@ void JSPageSession::Impl::loadInjectedJavaScript() JSStringRelease(script); - if(exception) - { + if (exception) { LogDebug("Exception Occured while injecting javascript " - "file. : " << *it); + "file. : " << *it); JSStringRef exceptionJSString = JSValueToStringCopy(m_context, exception, NULL); @@ -480,18 +473,18 @@ void JSPageSession::Impl::loadInjectedJavaScript() exceptionString, size); LogDebug("Exception : " << exceptionString); - delete [] exceptionString; + delete[] exceptionString; JSStringRelease(exceptionJSString); - } + } } } } void JSPageSession::Impl::startSession(int widgetHandle, - JSGlobalContextRef context, - double scaleFactor, - const char* encodedBundle, - const char* theme) + JSGlobalContextRef context, + double scaleFactor, + const char* encodedBundle, + const char* theme) { LogInfo("Starting widget session..."); @@ -543,7 +536,6 @@ void JSPageSession::Impl::stopSession() LogInfo("Widget session stopped."); } - void JSPageSession::Impl::unloadPluginsFromSession() { LogDebug("Unload plugins from session"); @@ -580,9 +572,6 @@ void JSPageSession::Impl::unloadPluginsFromSession() m_objectExplorer = NULL; } - - - void JSPageSession::Impl::performLibrariesUnload() { #if 0 @@ -610,19 +599,16 @@ void JSPageSession::Impl::performLibrariesUnload() PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel) { PluginPtr pluginLib = pluginModel->LibraryInstance.Get(); - if (!pluginLib) - { + if (!pluginLib) { std::string path = pluginModel->LibraryPath.Get() + - std::string(LIBRARY_PATH_SEPARATOR) + - pluginModel->LibraryName.Get(); + std::string(LIBRARY_PATH_SEPARATOR) + + pluginModel->LibraryName.Get(); pluginLib = Plugin::LoadFromFile(path); - if (!pluginLib) - { + if (!pluginLib) { LogError("Loading library failed"); - } else - { + } else { pluginModel->LibraryInstance.Set(pluginLib); LogDebug("On widget start"); @@ -636,9 +622,7 @@ PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel) pluginLib->OnFrameLoad(*context); } } - } - else - { + } else { LogDebug("Get from LibraryInstance"); LogDebug("On widget start"); // This is first time for this plugin, start widget Session @@ -655,7 +639,6 @@ PluginPtr JSPageSession::Impl::loadLibrary(PluginModelPtr& pluginModel) return pluginLib; } - void JSPageSession::Impl::loadFrame(JSGlobalContextRef context) { LogDebug("Load a frame"); @@ -698,12 +681,11 @@ void JSPageSession::Impl::unloadFrame(JSGlobalContextRef context) m_objectExplorer->unloadFrame(context); } - void JSPageSession::startSession(int widgetHandle, - JSGlobalContextRef ctx, - double scaleFactor, - const char* encodedBundle, - const char* theme) + JSGlobalContextRef ctx, + double scaleFactor, + const char* encodedBundle, + const char* theme) { m_impl->startSession(widgetHandle, ctx, scaleFactor, encodedBundle, theme); } @@ -727,13 +709,14 @@ bool JSPageSession::loadPluginOnDemand( } void JSPageSession::setCustomProperties(double scaleFactor, - const char* encodedBundle, - const char* theme) + const char* encodedBundle, + const char* theme) { m_impl->setCustomProperties(scaleFactor, encodedBundle, theme); } -void JSPageSession::dispatchJavaScriptEvent(CustomEventType eventType, void* data) +void JSPageSession::dispatchJavaScriptEvent(CustomEventType eventType, + void* data) { m_impl->dispatchJavaScriptEvent(eventType, data); } @@ -749,10 +732,9 @@ void JSPageSession::unloadFrame(JSGlobalContextRef context) } JSPageSession::JSPageSession(const PluginContainerSupportPtr& containerSupport) - : m_impl(new JSPageSession::Impl(containerSupport)) -{ -} + : + m_impl(new JSPageSession::Impl(containerSupport)) +{} JSPageSession::~JSPageSession() -{ -} +{} diff --git a/src/plugin-loading/js_types.h b/src/plugin-loading/js_types.h index bb85699..076582e 100644 --- a/src/plugin-loading/js_types.h +++ b/src/plugin-loading/js_types.h @@ -24,8 +24,8 @@ //forward declaration of JSConectexRef extern "C" { - typedef struct OpaqueJSContext* JSGlobalContextRef; - typedef struct OpaqueJSValue* JSObjectRef; +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSValue* JSObjectRef; } struct JavaScriptObject diff --git a/src/plugin-loading/plugin.cpp b/src/plugin-loading/plugin.cpp index 8cd72f5..7a468a4 100644 --- a/src/plugin-loading/plugin.cpp +++ b/src/plugin-loading/plugin.cpp @@ -25,13 +25,13 @@ #include Plugin::Plugin(const std::string &fileName, - void *libHandle, - on_widget_start_proc *apiOnWidgetStart, - on_widget_init_proc *apiOnWidgetInit, - on_widget_stop_proc *apiOnWidgetStop, - on_frame_load_proc* apiOnFrameLoad, - on_frame_unload_proc* apiOnFrameUnload, - const ClassPtrList &apiClassList) : + void *libHandle, + on_widget_start_proc *apiOnWidgetStart, + on_widget_init_proc *apiOnWidgetInit, + on_widget_stop_proc *apiOnWidgetStop, + on_frame_load_proc* apiOnFrameLoad, + on_frame_unload_proc* apiOnFrameUnload, + const ClassPtrList &apiClassList) : m_fileName(fileName), m_libHandle(libHandle), m_apiOnWidgetStart(apiOnWidgetStart), @@ -40,8 +40,7 @@ Plugin::Plugin(const std::string &fileName, m_apiOnFrameLoad(apiOnFrameLoad), m_apiOnFrameUnload(apiOnFrameUnload), m_apiClassList(apiClassList) -{ -} +{} Plugin::~Plugin() { @@ -100,22 +99,21 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName) reinterpret_cast( dlsym(dllHandle, PLUGIN_GET_CLASS_MAP_PROC_NAME)); - if( getWidgetEntityMapProcPtr ) - { + if (getWidgetEntityMapProcPtr) { rawClassList = (*getWidgetEntityMapProcPtr)(); - LogDebug("rawClassList : " << rawClassList << "by getWidgetClassMapProcPtr()"); - } - else - { + LogDebug( + "rawClassList : " << rawClassList << + "by getWidgetClassMapProcPtr()"); + } else { rawClassList = static_cast(dlsym(dllHandle, - PLUGIN_CLASS_MAP_NAME)); - LogDebug("rawClassList : " << rawClassList ); + PLUGIN_CLASS_MAP_NAME)); + LogDebug("rawClassList : " << rawClassList); } - if (NULL == onWidgetStartProcPtr || NULL == onWidgetStopProcPtr || - /*NULL == onWidgetInitProcPtr ||*/ NULL == rawClassList) { + /*NULL == onWidgetInitProcPtr ||*/ NULL == rawClassList) + { LogWarning("#####"); LogWarning( "##### Warning: The following plugin does not support new plugin API."); @@ -151,7 +149,7 @@ PluginPtr Plugin::LoadFromFile(const std::string& fileName) // Parse all class definitions while (rawEntityListIterator->parent_name != NULL && - rawEntityListIterator->object_name != NULL) + rawEntityListIterator->object_name != NULL) { // Logging LogInfo("#####"); @@ -193,12 +191,9 @@ std::string Plugin::GetFileName() const void Plugin::OnWidgetStart(int widgetId) { - if (NULL != m_apiOnWidgetStart) - { + if (NULL != m_apiOnWidgetStart) { (*m_apiOnWidgetStart)(widgetId); - } - else - { + } else { LogWarning("OnWidgetStart not set!"); } } @@ -206,48 +201,36 @@ void Plugin::OnWidgetStart(int widgetId) void Plugin::OnWidgetInit(feature_mapping_interface_t* mapping) { Assert(NULL != mapping && "NULL mapping interface provided"); - if (NULL != m_apiOnWidgetInit) - { + if (NULL != m_apiOnWidgetInit) { (*m_apiOnWidgetInit)(mapping); - } - else - { + } else { LogWarning("OnWidgetInit not set!"); } } void Plugin::OnWidgetStop(int widgetId) { - if (NULL != m_apiOnWidgetStop) - { + if (NULL != m_apiOnWidgetStop) { (*m_apiOnWidgetStop)(widgetId); - } - else - { + } else { LogWarning("OnWidgetStop not set!"); } } void Plugin::OnFrameLoad(java_script_context_t context) { - if (NULL != m_apiOnFrameLoad) - { + if (NULL != m_apiOnFrameLoad) { (*m_apiOnFrameLoad)(context); - } - else - { + } else { LogWarning("OnFrameLoad not set!"); } } void Plugin::OnFrameUnload(java_script_context_t context) { - if (NULL != m_apiOnFrameUnload) - { + if (NULL != m_apiOnFrameUnload) { (*m_apiOnFrameUnload)(context); - } - else - { + } else { LogWarning("OnFrameUnload not set!"); } } diff --git a/src/plugin-loading/plugin.h b/src/plugin-loading/plugin.h index d3eec30..1eb277f 100644 --- a/src/plugin-loading/plugin.h +++ b/src/plugin-loading/plugin.h @@ -58,13 +58,13 @@ class Plugin : private DPL::Noncopyable const ClassPtrList m_apiClassList; Plugin(const std::string &fileName, - void *libHandle, - on_widget_start_proc* apiOnWidgetStart, - on_widget_init_proc* apiOnWidgetInit, - on_widget_stop_proc* apiOnWidgetStop, - on_frame_load_proc* apiOnFrameLoad, - on_frame_unload_proc* apiOnFrameUnload, - const ClassPtrList &apiClassList); + void *libHandle, + on_widget_start_proc* apiOnWidgetStart, + on_widget_init_proc* apiOnWidgetInit, + on_widget_stop_proc* apiOnWidgetStop, + on_frame_load_proc* apiOnFrameLoad, + on_frame_unload_proc* apiOnFrameUnload, + const ClassPtrList &apiClassList); public: virtual ~Plugin(); diff --git a/src/plugin-loading/plugin_container_support.cpp b/src/plugin-loading/plugin_container_support.cpp index 4518b0f..5565e96 100644 --- a/src/plugin-loading/plugin_container_support.cpp +++ b/src/plugin-loading/plugin_container_support.cpp @@ -36,7 +36,7 @@ using namespace WrtDB; #include -PluginContainerSupport::PluginContainerSupport(): m_initialized(false) +PluginContainerSupport::PluginContainerSupport() : m_initialized(false) { // Reading standard features list from file readStandardFeaturesList(); @@ -56,14 +56,14 @@ PluginContainerSupport::~PluginContainerSupport() void PluginContainerSupport::Initialize(int widgetHandle) { - if (isInitialized() == false) - { + if (isInitialized() == false) { readAllowedPlugins(widgetHandle); readRootPlugins(widgetHandle); } } -std::list PluginContainerSupport::getAllowedFeatures(int widgetHandle) const +std::list PluginContainerSupport::getAllowedFeatures( + int widgetHandle) const { //TODO it has to return LIST NOT SET!!! WidgetDAOReadOnly widgetDao(widgetHandle); @@ -74,7 +74,7 @@ std::list PluginContainerSupport::getAllowedFeatures(int widgetHand LogInfo("Loading api-feature: " << it->name); if (it->rejected) { LogWarning("Api-feature was rejected by ace. (Api-feature name: " - << it->name << ")" ); + << it->name << ")"); continue; } @@ -93,8 +93,11 @@ void PluginContainerSupport::readAllowedPlugins(int widgetHandle) } FeatureData* dt = NULL; - std::map featureDataList = FeatureDAOReadOnly::GetFeatures(allowedFeatures); - DeviceCapList deviceCapabilities = FeatureDAOReadOnly::GetDevCapWithFeatureHandle(); + std::map featureDataList = FeatureDAOReadOnly::GetFeatures( + allowedFeatures); + DeviceCapList deviceCapabilities = + FeatureDAOReadOnly::GetDevCapWithFeatureHandle(); FOREACH(data, featureDataList) { dt = &(data->second); registerPluginModel(dt->pluginHandle); @@ -117,7 +120,11 @@ void PluginContainerSupport::readRootPlugins(int widgetHandle) m_initialized = true; } -void PluginContainerSupport::registerFeatureModel(FeatureHandle handle, FeatureData* data, DeviceCapList deviceCapabilities) +void PluginContainerSupport::registerFeatureModel( + FeatureHandle handle, + FeatureData* data, + DeviceCapList + deviceCapabilities) { LogDebug("Analyzing feature: " << handle); FeatureModelPtr model = getFeatureModel(handle); @@ -277,8 +284,7 @@ PluginContainerSupport::getStandardPlugins() const FOREACH(it, features) { auto plugin = getPluginModel(*it); - if(!plugin) - { + if (!plugin) { LogError("PluginModel not found"); continue; } @@ -307,5 +313,5 @@ PluginContainerSupport::getPluginsList() const PluginModelPtr PluginContainerSupport::getPluginForFeature(const std::string& featureName) { - return getPluginModel(getFeatureModel(featureName)); + return getPluginModel(getFeatureModel(featureName)); } diff --git a/src/plugin-loading/plugin_container_support.h b/src/plugin-loading/plugin_container_support.h index 8bd361e..1069cf9 100644 --- a/src/plugin-loading/plugin_container_support.h +++ b/src/plugin-loading/plugin_container_support.h @@ -32,11 +32,11 @@ class PluginContainerSupport { -public: + public: typedef std::list FeaturesList; typedef std::list PluginsList; -private: + private: // Standard features typedef std::list StandardFeatureList; @@ -54,23 +54,28 @@ private: bool m_initialized; -private: + private: // Reading void readStandardFeaturesList(); // Plugin models typedef std::multimap DeviceCapList; - void registerFeatureModel(WrtDB::FeatureHandle handle, WrtDB::FeatureData* data, DeviceCapList deviceCapabilities); + void registerFeatureModel(WrtDB::FeatureHandle handle, + WrtDB::FeatureData* data, + DeviceCapList deviceCapabilities); - WrtDB::FeatureModelPtr getFeatureModel(const std::string &name) const ; - WrtDB::FeatureModelPtr getFeatureModel(WrtDB::FeatureHandle handle) const ; + WrtDB::FeatureModelPtr getFeatureModel(const std::string &name) const; + WrtDB::FeatureModelPtr getFeatureModel(WrtDB::FeatureHandle handle) const; PluginModelPtr getPluginModel(const WrtDB::FeatureModelPtr &feature) const; -public: + public: PluginContainerSupport(); - bool isInitialized() { return m_initialized; } + bool isInitialized() + { + return m_initialized; + } void Initialize(int widgetHandle); void registerPluginModel(WrtDB::DbPluginHandle handle); std::list getAllowedFeatures(int widgetHandle) const; @@ -87,7 +92,6 @@ public: ~PluginContainerSupport(); }; - typedef std::shared_ptr PluginContainerSupportPtr; #endif // PLUGIN_CONTAINER_SUPPORT_H diff --git a/src/plugin-loading/plugin_iframe_support.cpp b/src/plugin-loading/plugin_iframe_support.cpp index 311d847..2e1c8c6 100644 --- a/src/plugin-loading/plugin_iframe_support.cpp +++ b/src/plugin-loading/plugin_iframe_support.cpp @@ -30,28 +30,29 @@ void IframesSupport::registerDeclaration( LogDebug("Registration iframes-supported plugins " << declaration->getName()); - if(declaration->getParentName().find('.') != std::string::npos) - { + if (declaration->getParentName().find('.') != std::string::npos) { LogWarning("The object will not be loaded to iframes"); return; } m_iframesObjects.push_back(declaration); } -void IframesSupport::registerIframe(const JSObjectPtr& iframe){ +void IframesSupport::registerIframe(const JSObjectPtr& iframe) +{ LogDebug("LoadedIframes size: " << m_loadedIframes.size() ); m_loadedIframes.insert(iframe); } -void IframesSupport::unregisterIframe(const JSObjectPtr& iframe){ +void IframesSupport::unregisterIframe(const JSObjectPtr& iframe) +{ LogDebug("LoadedIframes size: " << m_loadedIframes.size() ); auto it_loaded = std::find_if(m_loadedIframes.begin(), - m_loadedIframes.end(), - std::bind2nd(EqualToJSObjectPtr(), iframe)); + m_loadedIframes.end(), + std::bind2nd(EqualToJSObjectPtr(), iframe)); //object not found, so thats the new iframe - if(it_loaded == m_loadedIframes.end()){ + if (it_loaded == m_loadedIframes.end()) { LogDebug("Nothing to unregister"); return; } diff --git a/src/plugin-loading/plugin_iframe_support.h b/src/plugin-loading/plugin_iframe_support.h index ce5cd14..0c98768 100644 --- a/src/plugin-loading/plugin_iframe_support.h +++ b/src/plugin-loading/plugin_iframe_support.h @@ -22,8 +22,8 @@ #ifndef _WRTENGINE_SRC_PLUGINSERVICE_IFRAME_SUPPORT_H_ #define _WRTENGINE_SRC_PLUGINSERVICE_IFRAME_SUPPORT_H_ -#include -#include +#include +#include #include #include #include "javascript_interface.h" @@ -53,12 +53,12 @@ class IframesSupport // used to find matching object from m_loadedIframes struct EqualToJSObjectPtr { - typedef JSObjectPtr first_argument_type; - typedef JSObjectPtr second_argument_type; - typedef bool result_type; + typedef JSObjectPtr first_argument_type; + typedef JSObjectPtr second_argument_type; + typedef bool result_type; result_type operator()(const first_argument_type &s1, - const second_argument_type &s2) const + const second_argument_type &s2) const { return (s1->getObject() == s2->getObject()); } diff --git a/src/plugin-loading/plugin_logic.cpp b/src/plugin-loading/plugin_logic.cpp index ee01b63..c6913b1 100644 --- a/src/plugin-loading/plugin_logic.cpp +++ b/src/plugin-loading/plugin_logic.cpp @@ -77,7 +77,6 @@ class PluginLogic::Impl typedef std::map PagesSessionsSet; PagesSessionsSet m_sessions; - public: Impl(); ~Impl(); @@ -118,10 +117,10 @@ IMPLEMENT_SINGLETON(PluginLogic); bool PluginLogic::Impl::s_sanityCheck = false; #define PLUGIN_LOGIC_SANITY_CHECK \ - if(!s_sanityCheck)\ - {\ - LogError("Object is not available. Wrong flow occured");\ - return;\ + if (!s_sanityCheck) \ + { \ + LogError("Object is not available. Wrong flow occured"); \ + return; \ } PluginLogic::Impl::Impl() @@ -174,7 +173,7 @@ void PluginLogic::stopSession(JSGlobalContextRef context) void PluginLogic::performLibrariesUnload() { LogError("Libraries unload TURNED OFF"); -// m_impl->performLibrariesUnload(); + // m_impl->performLibrariesUnload(); } bool PluginLogic::loadPluginOnDemand( @@ -228,12 +227,10 @@ void PluginLogic::unloadFrame(JSGlobalContextRef context) } PluginLogic::PluginLogic() : m_impl(new PluginLogic::Impl()) -{ -} +{} PluginLogic::~PluginLogic() -{ -} +{} void PluginLogic::Impl::initSession(int widgetHandle) { @@ -245,40 +242,36 @@ void PluginLogic::Impl::initSession(int widgetHandle) LogDebug("Preload plugins so file"); PluginContainerSupport::PluginsList pluginList = - m_pluginsSupport->getPluginsList(); + m_pluginsSupport->getPluginsList(); FOREACH(it, pluginList) { PluginModelPtr& pluginModel = *it; - if (!pluginModel->LibraryDependencies.Get()->empty()) - { + if (!pluginModel->LibraryDependencies.Get()->empty()) { // Only Root Object continue; } PluginPtr pluginLib = pluginModel->LibraryInstance.Get(); - if (!pluginLib) - { + if (!pluginLib) { std::string path = pluginModel->LibraryPath.Get() + - std::string(LIBRARY_PATH_SEPARATOR) + - pluginModel->LibraryName.Get(); + std::string(LIBRARY_PATH_SEPARATOR) + + pluginModel->LibraryName.Get(); pluginLib = Plugin::LoadFromFile(path); - if (!pluginLib) - { + if (!pluginLib) { LogError("Loading library failed"); - } else - { + } else { pluginModel->LibraryInstance.Set(pluginLib); - LogDebug("pluginModel->LibraryInstance.Set() : " << pluginLib->GetFileName()); + LogDebug( + "pluginModel->LibraryInstance.Set() : " << + pluginLib->GetFileName()); } - } - else - { + } else { LogDebug("Already loaded"); } } @@ -294,15 +287,13 @@ void PluginLogic::Impl::startSession(int widgetHandle, { LogInfo("Starting widget session..."); - if (!m_pluginsSupport->isInitialized()) - { + if (!m_pluginsSupport->isInitialized()) { m_pluginsSupport->Initialize(widgetHandle); } auto sessionIt = m_sessions.find(context); // Check if corresponding session if not already created - if (sessionIt != m_sessions.end()) - { + if (sessionIt != m_sessions.end()) { LogWarning("Session already started!"); return; } @@ -322,8 +313,7 @@ void PluginLogic::Impl::stopSession(JSGlobalContextRef context) LogInfo("Stopping widget session..."); auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogError("Session not exist!"); return; } @@ -343,8 +333,7 @@ bool PluginLogic::Impl::loadPluginOnDemand( LogInfo("Load plugin on demand"); auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogWarning("Session not exist!"); return false; } @@ -361,8 +350,7 @@ void PluginLogic::Impl::loadFrame(JSGlobalContextRef context) PLUGIN_LOGIC_SANITY_CHECK auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogWarning("Session not exist!"); return; } @@ -377,8 +365,7 @@ void PluginLogic::Impl::unloadFrame(JSGlobalContextRef context) PLUGIN_LOGIC_SANITY_CHECK auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogWarning("Session not exist!"); return; } @@ -392,14 +379,15 @@ void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context, const char* encodedBundle, const char* theme) { - LogInfo("set properties of window object " << scaleFactor << ", " - << encodedBundle << ", " << theme); + LogInfo( + "set properties of window object " << scaleFactor << ", " + << encodedBundle << ", " << + theme); PLUGIN_LOGIC_SANITY_CHECK auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogWarning("Session not exist!"); return; } @@ -407,7 +395,6 @@ void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context, sessionIt->second->setCustomProperties(scaleFactor, encodedBundle, theme); - } void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context, @@ -419,13 +406,10 @@ void PluginLogic::Impl::dispatchJavaScriptEvent(JSGlobalContextRef context, PLUGIN_LOGIC_SANITY_CHECK auto sessionIt = m_sessions.find(context); - if (sessionIt == m_sessions.end()) - { + if (sessionIt == m_sessions.end()) { LogWarning("Session not exist!"); return; } sessionIt->second->dispatchJavaScriptEvent(eventType, data); - - } diff --git a/src/plugin-loading/plugin_logic.h b/src/plugin-loading/plugin_logic.h index e524ec0..10bcb08 100644 --- a/src/plugin-loading/plugin_logic.h +++ b/src/plugin-loading/plugin_logic.h @@ -38,7 +38,6 @@ using namespace WrtPlugins::W3C; - class PluginLogic : DPL::Noncopyable { public: @@ -74,11 +73,12 @@ class PluginLogic : DPL::Noncopyable const char* encodedBundle, const char* theme); - WRT_PLUGINS_DEPRECATED void dispatchJavaScriptEvent(CustomEventType eventType); + WRT_PLUGINS_DEPRECATED void dispatchJavaScriptEvent( + CustomEventType eventType); void dispatchJavaScriptEvent(JSGlobalContextRef ctx, - CustomEventType eventType, - void* data); + CustomEventType eventType, + void* data); private: PluginLogic(); diff --git a/src/plugin-loading/plugin_model.cpp b/src/plugin-loading/plugin_model.cpp index 58b56d8..ee6dd6f 100644 --- a/src/plugin-loading/plugin_model.cpp +++ b/src/plugin-loading/plugin_model.cpp @@ -36,8 +36,7 @@ struct BindToPluginDAO : PluginDAOReadOnly, &PluginModel::getHandle, extFun> -{ -}; +{}; template struct BindToFeatureDAOStatic : @@ -46,26 +45,27 @@ struct BindToFeatureDAOStatic : WrtDB::DbPluginHandle, &PluginModel::getHandle, extFun> -{ -}; +{}; PluginModel::PluginModel(const WrtDB::DbPluginHandle& handle) : Handle(this, handle), LibraryName(this, BindToPluginDAO::Get), + &PluginDAOReadOnly::getLibraryName>::Get), LibraryPath(this, BindToPluginDAO::Get), + &PluginDAOReadOnly::getLibraryPath>::Get), FeatureHandles(this, BindToFeatureDAOStatic::Get), + FeatureDAOReadOnly:: + GetFeatureHandleListForPlugin>:: + Get), LibraryDependencies(this, BindToPluginDAO::Get), + &PluginDAOReadOnly:: + getLibraryDependencies>::Get), LibraryInstance(this, PluginPtr()) -{ -} +{} WrtDB::DbPluginHandle PluginModel::getHandle() const { diff --git a/src/plugin-loading/plugin_model.h b/src/plugin-loading/plugin_model.h index 624f86e..e834cd1 100644 --- a/src/plugin-loading/plugin_model.h +++ b/src/plugin-loading/plugin_model.h @@ -41,44 +41,47 @@ class PluginModel : public DPL::Event::Model public: /** - *@brief Plugin handle + * *@brief Plugin handle */ - DPL::Event::Property Handle; + DPL::Event::Property Handle; /** - *@brief LibraryName + * *@brief LibraryName */ DPL::Event::Property LibraryName; + DPL::Event::PropertyReadOnly, + DPL::Event::PropertyStorageDynamicCached> LibraryName; /** - *@brief Library Path + * *@brief Library Path */ DPL::Event::Property LibraryPath; + DPL::Event::PropertyReadOnly, + DPL::Event::PropertyStorageDynamicCached> LibraryPath; /** - *@brief Feature set + * *@brief Feature set */ DPL::Event::Property FeatureHandles; + DPL::Event::PropertyReadOnly, + DPL::Event::PropertyStorageDynamicCached> + FeatureHandles; /** - *@brief Librarydepencies + * *@brief Librarydepencies */ DPL::Event::Property LibraryDependencies; + DPL::Event::PropertyReadOnly, + DPL::Event::PropertyStorageDynamicCached> + LibraryDependencies; /** - *@brief Library instance Low Level + * *@brief Library instance Low Level * */ DPL::Event::Property LibraryInstance; + DPL::Event::PropertyReadWrite, + DPL::Event::PropertyStorageCached> LibraryInstance; public: PluginModel(const WrtDB::DbPluginHandle& handle); diff --git a/src/plugin-loading/plugin_property_support.cpp b/src/plugin-loading/plugin_property_support.cpp index bf54b6f..c88f0c2 100644 --- a/src/plugin-loading/plugin_property_support.cpp +++ b/src/plugin-loading/plugin_property_support.cpp @@ -25,24 +25,21 @@ using namespace PluginModule; - -const char *NAVIGATOR_PROPERTY_NAME = "navigator"; +const char *NAVIGATOR_PROPERTY_NAME = "navigator"; const char *SCALE_PROPERTY_NAME = "scale"; -const char *BUNDLE_PROPERTY_NAME = "__bundle"; -const char *THEME_PROPERTY_NAME = "theme"; +const char *BUNDLE_PROPERTY_NAME = "__bundle"; +const char *THEME_PROPERTY_NAME = "theme"; WindowPropertySupport::WindowPropertySupport( - JSGlobalContextRef context): + JSGlobalContextRef context) : m_scale(0), m_bundle(""), m_theme(""), m_context(context) -{ -} +{} WindowPropertySupport::~WindowPropertySupport() -{ -} +{} float WindowPropertySupport::getScale() const { @@ -69,16 +66,16 @@ void WindowPropertySupport::setScaleToNavigatorProperty(const double scale) LogInfo("set window.navigator.scale: " << scale); m_scale = scale; - - setPropertyToNavigator(SCALE_PROPERTY_NAME, JSValueMakeNumber(m_context, scale)); + + setPropertyToNavigator(SCALE_PROPERTY_NAME, + JSValueMakeNumber(m_context, scale)); } void WindowPropertySupport::setBundleToWindowProperty(const char* bundle) { LogInfo("set window.__bundle: " << bundle); - if(bundle) - { + if (bundle) { m_bundle = bundle; JSStringRef bundleString = JSStringCreateWithUTF8CString(bundle); @@ -94,8 +91,7 @@ void WindowPropertySupport::setThemeToNavigatorProperty(const char* theme) { LogInfo("set window.navigator.__theme: " << theme); - if(theme) - { + if (theme) { m_theme = theme; JSStringRef themeString = JSStringCreateWithUTF8CString(theme); @@ -108,10 +104,9 @@ void WindowPropertySupport::setThemeToNavigatorProperty(const char* theme) } void WindowPropertySupport::setPropertyToWindow(const char* propertyName, - JSValueRef jsValue) + JSValueRef jsValue) { - if(propertyName) - { + if (propertyName) { JSObjectRef globalObject = JSContextGetGlobalObject(m_context); JSStringRef propertyNameString = @@ -128,10 +123,9 @@ void WindowPropertySupport::setPropertyToWindow(const char* propertyName, } void WindowPropertySupport::setPropertyToNavigator(const char* propertyName, - JSValueRef jsValue) + JSValueRef jsValue) { - if(propertyName) - { + if (propertyName) { JSObjectRef globalObject = JSContextGetGlobalObject(m_context); JSStringRef navigatorString = diff --git a/src/plugin-loading/plugin_property_support.h b/src/plugin-loading/plugin_property_support.h index a1914da..fc946c4 100644 --- a/src/plugin-loading/plugin_property_support.h +++ b/src/plugin-loading/plugin_property_support.h @@ -27,32 +27,30 @@ #include namespace PluginModule { - class WindowPropertySupport { public: - float getScale() const; - std::string getBundle() const; - std::string getTheme() const; - JSGlobalContextRef getJSContext() const; - - void setScaleToNavigatorProperty(const double scale); - void setBundleToWindowProperty(const char* bundle); - void setThemeToNavigatorProperty(const char* theme); - - explicit WindowPropertySupport(JSGlobalContextRef m_context); - ~WindowPropertySupport(); - - private: - float m_scale; - std::string m_bundle; // string of base64 encoded bundle - std::string m_theme; - JSGlobalContextRef m_context; - - void setPropertyToWindow(const char* propertyName, JSValueRef jsValue); - void setPropertyToNavigator(const char* propertyName, JSValueRef jsValue); + float getScale() const; + std::string getBundle() const; + std::string getTheme() const; + JSGlobalContextRef getJSContext() const; + + void setScaleToNavigatorProperty(const double scale); + void setBundleToWindowProperty(const char* bundle); + void setThemeToNavigatorProperty(const char* theme); + + explicit WindowPropertySupport(JSGlobalContextRef m_context); + ~WindowPropertySupport(); + + private: + float m_scale; + std::string m_bundle; // string of base64 encoded bundle + std::string m_theme; + JSGlobalContextRef m_context; + + void setPropertyToWindow(const char* propertyName, JSValueRef jsValue); + void setPropertyToNavigator(const char* propertyName, JSValueRef jsValue); }; - } // namespace PluginModule #endif // _PLUGIN_LOGIC_PROPERTY_SUPPORT_H_ diff --git a/src/plugins-api-support/CallbackSupport.h b/src/plugins-api-support/CallbackSupport.h index f460fd1..bcaa849 100644 --- a/src/plugins-api-support/CallbackSupport.h +++ b/src/plugins-api-support/CallbackSupport.h @@ -26,13 +26,11 @@ #include #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { template class CallbackSupport { -public: + public: typedef typename Sig::Signature SlotSignature; typedef typename Sig::Type SlotType; typedef std::string GroupType; @@ -41,8 +39,7 @@ public: void Connect(const GroupType& group, const SlotType& slot) { auto groupIt = m_slots.find(group); - if (m_slots.end() == groupIt) - { + if (m_slots.end() == groupIt) { groupIt = m_slots.insert(std::make_pair(group, SlotList())).first; } groupIt->second.push_back(slot); @@ -53,36 +50,33 @@ public: m_slots.erase(group); } - template - void Invoke(const Args&... args) + template + void Invoke(const Args& ... args) { - FOREACH(groupIt, m_slots) { FOREACH(slotIt, groupIt->second) { - (*slotIt)(args...); + (*slotIt)(args ...); } } } - template - void InvokeGroup(const GroupType& group, const Args&... args) + template + void InvokeGroup(const GroupType& group, const Args& ... args) { auto groupIt = m_slots.find(group); - if (m_slots.end() != groupIt) - { - FOREACH (slotIt, groupIt->second) + if (m_slots.end() != groupIt) { + FOREACH(slotIt, groupIt->second) { - (*slotIt)(args...); + (*slotIt)(args ...); } } } -private: + private: std::map m_slots; }; - } #endif diff --git a/src/plugins-api-support/ExportedApi.h b/src/plugins-api-support/ExportedApi.h index f11395c..019f846 100644 --- a/src/plugins-api-support/ExportedApi.h +++ b/src/plugins-api-support/ExportedApi.h @@ -48,72 +48,72 @@ * * Detailed Example how the file with api may looks like file: * - #include - #include - - #include - #include - #include - #include - - #include "JSTest.h" - #include "plugin_config.h" - - #define OBJECT_WIDGET "widget" - #define OBJECT_TEST "__test" - - using namespace WrtPlugins::W3C; - using namespace WrtDeviceApis; - using namespace WrtDeviceApis::Commons; - using namespace WrtPluginsApi; - - namespace W3CTest - { - - void on_widget_start_callback(int widgetId) - { - - } - - void on_widget_stop_callback(int widgetId) - { - } - - } - - void Register(PluginRegistration& r) - { - Plugin* plugin = new Plugin(); - - auto test = ObjectFactory::createMainObject( - OBJECT_TEST, - WrtPlugins::W3C::JSTest::getClassRef, - OBJECT_WIDGET); - - plugin->AddObject(test); - - r.Connect(W3CTest::on_widget_start_callback); - - r.Connect(W3CTest::on_widget_stop_callback); - - r.AddPlugin(*plugin); - } - - void Unregister(PluginRegistration& r, Plugin* plugin) - { - r.DisconnectAll(); - delete plugin; - } - - void GetProvidedFeatures(feature_mapping_interface_t *mapping) - { - WrtPlugins::W3C::WidgetTestDeclarations::getMappingInterface(mapping); - } - - ExportedApi dll_api={Register, Unregister, GetProvidedFeatures}; - - #undef OBJECT_WIDGET - #undef OBJECT_TEST + * #include + * #include + * + * #include + * #include + * #include + * #include + * + * #include "JSTest.h" + * #include "plugin_config.h" + * + * #define OBJECT_WIDGET "widget" + * #define OBJECT_TEST "__test" + * + * using namespace WrtPlugins::W3C; + * using namespace WrtDeviceApis; + * using namespace WrtDeviceApis::Commons; + * using namespace WrtPluginsApi; + * + * namespace W3CTest + * { + * + * void on_widget_start_callback(int widgetId) + * { + * + * } + * + * void on_widget_stop_callback(int widgetId) + * { + * } + * + * } + * + * void Register(PluginRegistration& r) + * { + * Plugin* plugin = new Plugin(); + * + * auto test = ObjectFactory::createMainObject( + * OBJECT_TEST, + * WrtPlugins::W3C::JSTest::getClassRef, + * OBJECT_WIDGET); + * + * plugin->AddObject(test); + * + * r.Connect(W3CTest::on_widget_start_callback); + * + * r.Connect(W3CTest::on_widget_stop_callback); + * + * r.AddPlugin(*plugin); + * } + * + * void Unregister(PluginRegistration& r, Plugin* plugin) + * { + * r.DisconnectAll(); + * delete plugin; + * } + * + * void GetProvidedFeatures(feature_mapping_interface_t *mapping) + * { + * WrtPlugins::W3C::WidgetTestDeclarations::getMappingInterface(mapping); + * } + * + * ExportedApi dll_api={Register, Unregister, GetProvidedFeatures}; + * + * #undef OBJECT_WIDGET + * #undef OBJECT_TEST * * * */ @@ -144,7 +144,6 @@ extern "C" struct ExportedApi void (*GetProvidedFeatures)(feature_mapping_interface_t*); }; - constexpr const char* GetExportedSymbolName() { return "dll_api"; diff --git a/src/plugins-api-support/IObject.h b/src/plugins-api-support/IObject.h index a3acf24..31b644a 100644 --- a/src/plugins-api-support/IObject.h +++ b/src/plugins-api-support/IObject.h @@ -26,12 +26,10 @@ #include extern "C" { - typedef struct OpaqueJSClass* const (*ClassRef)(); +typedef struct OpaqueJSClass* const (*ClassRef)(); } -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { enum class IObjectType { Object, @@ -56,18 +54,17 @@ class IObject return "window"; } - virtual void AddChild(const IObjectPtr& ) = 0; + virtual void AddChild(const IObjectPtr&) = 0; /* * Optional * */ virtual void setBoolOption(IObjectOption option, bool value) = 0; - virtual ~IObject(){}; + virtual ~IObject(){} }; typedef std::list IObjectsList; typedef std::shared_ptr IObjectsListPtr; - } #endif diff --git a/src/plugins-api-support/IObject_cast.h b/src/plugins-api-support/IObject_cast.h index 8dcf234..105a31d 100644 --- a/src/plugins-api-support/IObject_cast.h +++ b/src/plugins-api-support/IObject_cast.h @@ -26,13 +26,10 @@ #include #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { inline ObjectPtr CAST(const IObjectPtr& object) { return std::dynamic_pointer_cast(object); } - } #endif diff --git a/src/plugins-api-support/Object.cpp b/src/plugins-api-support/Object.cpp index 1aa039e..7db93e4 100644 --- a/src/plugins-api-support/Object.cpp +++ b/src/plugins-api-support/Object.cpp @@ -22,13 +22,10 @@ #include "Object.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { void Object::AddChild(const IObjectPtr& child) { - if(!m_children) - { + if (!m_children) { m_children = IObjectsListPtr(new IObjectsList); } m_children->push_back(child); @@ -36,19 +33,17 @@ void Object::AddChild(const IObjectPtr& child) void Object::setBoolOption(IObjectOption option, bool value) { - if(!m_options) - { + if (!m_options) { m_options = ObjectOptionPtr(new ObjectOption); - } - - switch(option) - { - case IObjectOption::Overlayed: - m_options->overlayedMode = value; - break; - default: - break; - } + } + + switch (option) { + case IObjectOption::Overlayed: + m_options->overlayedMode = value; + break; + default: + break; + } } IObjectsListPtr Object::GetChildren() const @@ -88,53 +83,48 @@ const char* Object::GetParentName() const ObjectOptionPtr Object::GetOptions() const { - return m_options; + return m_options; } Object::Object(const char* name, ClassRef ref, - IObjectType type) - : m_name(name), - m_classRef(ref), - m_parentName(0), - m_type(type), - m_interfaceRef(0), - m_interfaceName(0), - m_constructorRef(0) -{ -} + IObjectType type) : + m_name(name), + m_classRef(ref), + m_parentName(0), + m_type(type), + m_interfaceRef(0), + m_interfaceName(0), + m_constructorRef(0) +{} Object::Object(const char* name, ClassRef ref, const char* parentName, - IObjectType type) - : m_name(name), - m_classRef(ref), - m_parentName(parentName), - m_type(type), - m_interfaceRef(0), - m_interfaceName(0), - m_constructorRef(0) -{ -} + IObjectType type) : + m_name(name), + m_classRef(ref), + m_parentName(parentName), + m_type(type), + m_interfaceRef(0), + m_interfaceName(0), + m_constructorRef(0) +{} Object::Object(const char* name, ClassRef interfaceRef, const char* interfaceName, ClassRef constructorRef, const char* parentName, - IObjectType type) - : m_name(name), - m_parentName(parentName), - m_type(type), - m_interfaceRef(interfaceRef), - m_interfaceName(interfaceName), - m_constructorRef(constructorRef) -{ -} + IObjectType type) : + m_name(name), + m_parentName(parentName), + m_type(type), + m_interfaceRef(interfaceRef), + m_interfaceName(interfaceName), + m_constructorRef(constructorRef) +{} Object::~Object() -{ -} - +{} } diff --git a/src/plugins-api-support/Object.h b/src/plugins-api-support/Object.h index 285f3fe..5417453 100644 --- a/src/plugins-api-support/Object.h +++ b/src/plugins-api-support/Object.h @@ -29,9 +29,7 @@ #include #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { class Object; typedef std::shared_ptr ObjectPtr; @@ -41,7 +39,6 @@ struct ObjectOption }; typedef std::shared_ptr ObjectOptionPtr; - class Object : public IObject { public: @@ -63,11 +60,11 @@ class Object : public IObject ~Object(); - void AddChild(const IObjectPtr& ); + void AddChild(const IObjectPtr&); void setBoolOption(IObjectOption option, bool value); - IObjectsListPtr GetChildren() const ; + IObjectsListPtr GetChildren() const; ClassRef GetClass() const; @@ -102,7 +99,6 @@ class Object : public IObject IObjectsListPtr m_children; }; - } #endif diff --git a/src/plugins-api-support/ObjectFactory.cpp b/src/plugins-api-support/ObjectFactory.cpp index c854344..b897399 100644 --- a/src/plugins-api-support/ObjectFactory.cpp +++ b/src/plugins-api-support/ObjectFactory.cpp @@ -25,7 +25,6 @@ namespace WrtPluginsApi { namespace ObjectFactory { - IObjectPtr createObject( const char* name, ClassRef ref, @@ -58,6 +57,5 @@ IObjectPtr createObjectWithInterface( parentName, type)); } - } } diff --git a/src/plugins-api-support/ObjectFactory.h b/src/plugins-api-support/ObjectFactory.h index bd43878..59bff1d 100644 --- a/src/plugins-api-support/ObjectFactory.h +++ b/src/plugins-api-support/ObjectFactory.h @@ -27,25 +27,24 @@ namespace WrtPluginsApi { namespace ObjectFactory { +IObjectPtr createObject( + const char* name, + ClassRef ref, + IObjectType type = IObjectType::Object); - IObjectPtr createObject( - const char* name, - ClassRef ref, - IObjectType type = IObjectType::Object); +IObjectPtr createMainObject( + const char* name, + ClassRef ref, + const char* parentName = IObject::WINDOW_OBJECT(), + IObjectType type = IObjectType::Object); - IObjectPtr createMainObject( - const char* name, - ClassRef ref, - const char* parentName = IObject::WINDOW_OBJECT(), - IObjectType type = IObjectType::Object); - - IObjectPtr createObjectWithInterface( - const char* name, - ClassRef interfaceRef, - const char* interfaceName, - ClassRef constructorRef, - const char* parentName = IObject::WINDOW_OBJECT(), - IObjectType type = IObjectType::Object); +IObjectPtr createObjectWithInterface( + const char* name, + ClassRef interfaceRef, + const char* interfaceName, + ClassRef constructorRef, + const char* parentName = IObject::WINDOW_OBJECT(), + IObjectType type = IObjectType::Object); } } #endif diff --git a/src/plugins-api-support/Plugin.cpp b/src/plugins-api-support/Plugin.cpp index a3c1d04..6303c32 100644 --- a/src/plugins-api-support/Plugin.cpp +++ b/src/plugins-api-support/Plugin.cpp @@ -21,12 +21,10 @@ */ #include "Plugin.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { void Plugin::AddObject(const IObjectPtr& object) { - m_objects->push_back(object); + m_objects->push_back(object); } IObjectsListPtr Plugin::GetObjects() const @@ -35,11 +33,8 @@ IObjectsListPtr Plugin::GetObjects() const } Plugin::~Plugin() -{ -} +{} Plugin::Plugin() : m_objects(new IObjectsList()) -{ -} - +{} } diff --git a/src/plugins-api-support/Plugin.h b/src/plugins-api-support/Plugin.h index 3cee0a2..5458714 100644 --- a/src/plugins-api-support/Plugin.h +++ b/src/plugins-api-support/Plugin.h @@ -25,12 +25,10 @@ #include #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { class Plugin { -public: + public: void AddObject(const IObjectPtr& object); IObjectsListPtr GetObjects() const; @@ -39,10 +37,9 @@ public: virtual ~Plugin(); -private: + private: IObjectsListPtr m_objects; }; - } #endif diff --git a/src/plugins-api-support/PluginRegistration.cpp b/src/plugins-api-support/PluginRegistration.cpp index dadd367..089fdec 100644 --- a/src/plugins-api-support/PluginRegistration.cpp +++ b/src/plugins-api-support/PluginRegistration.cpp @@ -24,9 +24,7 @@ #include "Plugin.h" #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { PluginRegistration::PluginRegistration(Impl* impl) : m_impl(impl) { Assert(impl != 0 && "impl is NULL"); @@ -49,12 +47,11 @@ void PluginRegistration::AddPlugin(Plugin& plugin) } #define EXPLICIT_INSTATIATE_PLUGIN_REGISTRATION(SignalSignature) \ - template void PluginRegistration::Connect( \ - const typename SignalSignature::Type&) + template void PluginRegistration::Connect( \ + const typename SignalSignature::Type &) EXPLICIT_INSTATIATE_PLUGIN_REGISTRATION(OnWidgetStart); EXPLICIT_INSTATIATE_PLUGIN_REGISTRATION(OnWidgetStop); EXPLICIT_INSTATIATE_PLUGIN_REGISTRATION(OnFrameLoad); EXPLICIT_INSTATIATE_PLUGIN_REGISTRATION(OnFrameUnload); - } diff --git a/src/plugins-api-support/PluginRegistration.h b/src/plugins-api-support/PluginRegistration.h index ea7972f..e871a76 100644 --- a/src/plugins-api-support/PluginRegistration.h +++ b/src/plugins-api-support/PluginRegistration.h @@ -25,12 +25,10 @@ #include "Plugin.h" #include "PluginSignals.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { class PluginRegistration { -public: + public: class Impl; explicit PluginRegistration(PluginRegistration::Impl* impl); @@ -42,10 +40,9 @@ public: void AddPlugin(Plugin& plugin); -private: + private: std::unique_ptr m_impl; }; - } #endif diff --git a/src/plugins-api-support/PluginRegistrationImpl.h b/src/plugins-api-support/PluginRegistrationImpl.h index 3e1c752..1c17859 100644 --- a/src/plugins-api-support/PluginRegistrationImpl.h +++ b/src/plugins-api-support/PluginRegistrationImpl.h @@ -26,15 +26,13 @@ #include "Plugin.h" #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { class PluginRegistration::Impl { -public: - Impl(SignalsSupport& registry, const std::string& libraryName) - : m_registry(registry), - m_libraryName(libraryName) + public: + Impl(SignalsSupport& registry, const std::string& libraryName) : + m_registry(registry), + m_libraryName(libraryName) {} void AddPlugin(Plugin& plugin) @@ -53,11 +51,10 @@ public: m_registry.Disconnect(m_libraryName); } -private: + private: SignalsSupport& m_registry; std::string m_libraryName; }; - } #endif diff --git a/src/plugins-api-support/PluginRegistry.cpp b/src/plugins-api-support/PluginRegistry.cpp index 761ba9d..5c6b8e1 100644 --- a/src/plugins-api-support/PluginRegistry.cpp +++ b/src/plugins-api-support/PluginRegistry.cpp @@ -33,22 +33,18 @@ #include #include - namespace { const char* DLL_ENTRY_POINT_NAME = "dll_api"; } -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { void PluginRegistry::AddPlugin(const std::string& libraryName, Plugin& plugin) { LogDebug("Adding plugin for library: " << libraryName); auto libraryIt = m_plugins.find(libraryName); - if (m_plugins.end() == libraryIt) - { + if (m_plugins.end() == libraryIt) { m_plugins[libraryName] = &plugin; } } @@ -56,12 +52,10 @@ void PluginRegistry::AddPlugin(const std::string& libraryName, Plugin* PluginRegistry::GetPlugin(const std::string& libraryName) { auto it = m_plugins.find(libraryName); - if (it == m_plugins.end()) - { - if (!LoadFromFile(libraryName)) - { - LogError("Failed to load lib" << libraryName); - ThrowMsg(PluginNotFound, "Failed to load plugin"); + if (it == m_plugins.end()) { + if (!LoadFromFile(libraryName)) { + LogError("Failed to load lib" << libraryName); + ThrowMsg(PluginNotFound, "Failed to load plugin"); } return m_plugins[libraryName]; @@ -74,10 +68,8 @@ void PluginRegistry::RemovePlugin(const std::string& libraryName, Plugin& plugin) { auto it = m_plugins.find(libraryName); - if (it != m_plugins.end()) - { - if (&plugin == it->second) - { + if (it != m_plugins.end()) { + if (&plugin == it->second) { m_plugins.erase(it); } } @@ -87,13 +79,12 @@ void PluginRegistry::UnloadAll() { LogDebug("Unload all plugins"); - typedef void (*UnregisterFunction) (PluginRegistration&, Plugin&); + typedef void (*UnregisterFunction)(PluginRegistration&, Plugin&); FOREACH(libraryIt, m_libraries) { auto pluginIt = m_plugins.find(libraryIt->first); - if (m_plugins.end() != pluginIt) - { + if (m_plugins.end() != pluginIt) { void* handle = dlopen(libraryIt->first.c_str(), RTLD_NOW); if (!handle) { LogError("Error: " << dlerror()); @@ -102,14 +93,12 @@ void PluginRegistry::UnloadAll() ExportedApi* entryPoint = static_cast - (dlsym(handle, GetExportedSymbolName())); - if (NULL == entryPoint) - { + (dlsym(handle, GetExportedSymbolName())); + if (NULL == entryPoint) { LogError("Error: " << dlerror()); continue; } - if (entryPoint->Unregister == NULL) - { + if (entryPoint->Unregister == NULL) { LogError("Error Unregister function not set"); continue; } @@ -136,35 +125,30 @@ bool PluginRegistry::LoadFromFile(const std::string& libraryName) ExportedApi* entryPoint = static_cast(dlsym(handle, GetExportedSymbolName())); - if (NULL == entryPoint) - { + if (NULL == entryPoint) { LogError("Error: " << dlerror()); return false; } - if (entryPoint->Register == NULL) - { + if (entryPoint->Register == NULL) { LogError("Error Register function not set"); return false; } - if (entryPoint->Unregister== NULL) - { + if (entryPoint->Unregister == NULL) { LogError("Error Unregister function not set"); return false; } PluginRegistration registration( - new PluginRegistration::Impl(*this, libraryName)); + new PluginRegistration::Impl(*this, libraryName)); entryPoint->Register(registration); return true; } - PluginRegistry::~PluginRegistry() { //TODO discuss ... when the unload should be called -// UnloadAll(); + // UnloadAll(); } - } diff --git a/src/plugins-api-support/PluginRegistry.h b/src/plugins-api-support/PluginRegistry.h index d3e66b4..5db1ea4 100644 --- a/src/plugins-api-support/PluginRegistry.h +++ b/src/plugins-api-support/PluginRegistry.h @@ -28,30 +28,28 @@ #include "Plugin.h" #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { typedef std::list PluginsList; typedef std::shared_ptr PluginsListPtr; typedef std::map< std::string, PluginsListPtr> PluginsSet; class PluginRegistry : public SignalsSupport { -public: + public: DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) DECLARE_EXCEPTION_TYPE(Base, PluginNotFound) - template - void Call(Args... args) + template + void Call(Args ... args) { - Invoke(args...); + Invoke(args ...); } - template + template void CallGroup(const typename CallbackSupport::GroupType& type, - Args... args) + Args ... args) { - InvokeGroup(type, args...); + InvokeGroup(type, args ...); } void AddPlugin(const std::string& libraryName, Plugin& plugin); @@ -66,7 +64,8 @@ public: void UnloadAll(); ~PluginRegistry(); -private: + + private: bool LoadFromFile(const std::string& libraryName); typedef void* Symbol; @@ -76,7 +75,6 @@ private: }; typedef std::shared_ptr PluginRegistryPtr; - } #endif diff --git a/src/plugins-api-support/PluginSignals.h b/src/plugins-api-support/PluginSignals.h index ab22da1..556d620 100644 --- a/src/plugins-api-support/PluginSignals.h +++ b/src/plugins-api-support/PluginSignals.h @@ -23,17 +23,14 @@ #include "SignalSignature.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { struct OnWidgetStart : SignalSignature {}; struct OnWidgetStop : SignalSignature {}; -struct OnFrameLoad: SignalSignature {}; +struct OnFrameLoad : SignalSignature {}; struct OnFrameUnload : SignalSignature {}; - } #endif diff --git a/src/plugins-api-support/SignalSignature.h b/src/plugins-api-support/SignalSignature.h index 19fce6c..b43747e 100644 --- a/src/plugins-api-support/SignalSignature.h +++ b/src/plugins-api-support/SignalSignature.h @@ -23,18 +23,15 @@ #include -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { template struct SignalSignature; -template -struct SignalSignature +template +struct SignalSignature { - typedef R (*Signature) (Args...); - typedef std::function Type; + typedef R (*Signature)(Args ...); + typedef std::function Type; }; - } #endif diff --git a/src/plugins-api-support/SignalsSupport.h b/src/plugins-api-support/SignalsSupport.h index 56e7e67..870c40e 100644 --- a/src/plugins-api-support/SignalsSupport.h +++ b/src/plugins-api-support/SignalsSupport.h @@ -30,19 +30,17 @@ #include "PluginSignals.h" #include "Plugin.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { class SignalsSupport { -public: + public: virtual ~SignalsSupport() {} template void Connect(const std::string& libraryName, const typename T::Type& slot) { - Tuple::get_by_type>(m_slots).Connect(libraryName, - slot); + Tuple::get_by_type >(m_slots).Connect(libraryName, + slot); } void Disconnect(const std::string& libraryName) @@ -52,50 +50,49 @@ public: virtual void AddPlugin(const std::string& libraryName, Plugin& plugin) = 0; -protected: - template - void Invoke(const Args&... args) + protected: + template + void Invoke(const Args& ... args) { - Tuple::get_by_type>(m_slots).Invoke(args...); + Tuple::get_by_type >(m_slots).Invoke(args ...); } - template - void InvokeGroup(const std::string& libraryName, const Args&... args) + template + void InvokeGroup(const std::string& libraryName, const Args& ... args) { - Tuple::get_by_type>(m_slots).InvokeGroup(libraryName, - args...); + Tuple::get_by_type >(m_slots).InvokeGroup( + libraryName, + args ...); } -private: - template - void DisconnectSlot(std::tuple& slots, + private: + template + void DisconnectSlot(std::tuple& slots, const std::string& libraryName, typename std::enable_if<(N >= 0)>::type* = NULL) { std::get(slots).Disconnect(libraryName); - DisconnectSlot(slots, libraryName); + DisconnectSlot(slots, libraryName); } - template - void DisconnectSlot(std::tuple& slots, + template + void DisconnectSlot(std::tuple& slots, const std::string& libraryName, typename std::enable_if<(N == -1)>::type* = NULL) - { - } + {} - template - void DisconnectGroup(std::tuple& slots, + template + void DisconnectGroup(std::tuple& slots, const std::string& libraryName) { - DisconnectSlot(slots, libraryName); + DisconnectSlot(slots, libraryName); } std::tuple, CallbackSupport, CallbackSupport, - CallbackSupport> m_slots; + CallbackSupport > m_slots; }; - } #endif diff --git a/src/plugins-api-support/SoFeatures.h b/src/plugins-api-support/SoFeatures.h index 54b1bd7..a42963e 100644 --- a/src/plugins-api-support/SoFeatures.h +++ b/src/plugins-api-support/SoFeatures.h @@ -55,7 +55,6 @@ typedef struct feature_mapping_s size_t featuresCount; } feature_mapping_t; - typedef feature_mapping_t* pfeature_mapping_t; typedef pfeature_mapping_t (*features_getter)(void); diff --git a/src/plugins-api-support/detail/traits.h b/src/plugins-api-support/detail/traits.h index 912e286..7ab56db 100644 --- a/src/plugins-api-support/detail/traits.h +++ b/src/plugins-api-support/detail/traits.h @@ -24,30 +24,29 @@ namespace WrtPluginsApi { namespace Traits { namespace Detail { - -template +template struct index_of_; /* * CurrentArgType is not equal to RequiredType, check next tuple's argument */ template -struct index_of_ + typename RequiredType, + typename CurrentArgType, + typename ... TupleArgTypes> +struct index_of_ { static const size_t value = index_of_::value; + TupleArgTypes ...>::value; }; /* * RequiredType found on tuple's args list * return position on tuple's list */ -template -struct index_of_ +template +struct index_of_ { static const size_t value = n; }; @@ -59,7 +58,7 @@ struct index_of_ template struct index_of_ { - static const size_t value = n; + static const size_t value = n; }; /* @@ -70,7 +69,6 @@ struct index_of_ { static const size_t value = -1; }; - } } } diff --git a/src/plugins-api-support/js_types.h b/src/plugins-api-support/js_types.h index 69181ee..387c5bc 100644 --- a/src/plugins-api-support/js_types.h +++ b/src/plugins-api-support/js_types.h @@ -26,19 +26,16 @@ //forward declaration extern "C" { - typedef struct OpaqueJSContext* JSGlobalContextRef; - typedef struct OpaqueJSValue* JSObjectRef; +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSValue* JSObjectRef; } -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { struct JavaScriptObject { JSObjectRef instance; std::string name; }; - } #endif diff --git a/src/plugins-api-support/traits.h b/src/plugins-api-support/traits.h index 7635a0a..286c510 100644 --- a/src/plugins-api-support/traits.h +++ b/src/plugins-api-support/traits.h @@ -23,24 +23,19 @@ #include "detail/traits.h" -namespace WrtPluginsApi -{ - +namespace WrtPluginsApi { namespace Traits { - /** * Gets index of specified type in the type list. */ -template +template struct index_of { static const size_t value = Detail::index_of_<0, - RequiredType, - TupleArgTypes...>::value; + RequiredType, + TupleArgTypes ...>::value; }; - } - } #endif diff --git a/src/plugins-api-support/tuple.h b/src/plugins-api-support/tuple.h index ef3b62c..ec7c3b3 100644 --- a/src/plugins-api-support/tuple.h +++ b/src/plugins-api-support/tuple.h @@ -26,13 +26,11 @@ namespace WrtPluginsApi { namespace Tuple { - -template -T& get_by_type(std::tuple& tuple) +template +T& get_by_type(std::tuple& tuple) { - return std::get::value>(tuple); + return std::get::value>(tuple); } - } } diff --git a/src/plugins-installer/plugin_installer.cpp b/src/plugins-installer/plugin_installer.cpp index a2c668d..40d2108 100644 --- a/src/plugins-installer/plugin_installer.cpp +++ b/src/plugins-installer/plugin_installer.cpp @@ -63,8 +63,8 @@ const std::string DIRECTORY_SEPARATOR = std::string("/"); const int PluginsInstaller::INSTALLATION_ERROR = -1; -PluginsInstaller::PluginsInstaller() - : m_initialized(false) +PluginsInstaller::PluginsInstaller() : + m_initialized(false) { LogInfo("PluginsInstaller created."); } @@ -124,7 +124,7 @@ void PluginsInstaller::deinitialize() } PluginsInstaller::ReturnStatus PluginsInstaller::installPlugin( - const std::string& libPath) + const std::string& libPath) { if (!m_initialized) { LogError("Plugins installer not initialized."); @@ -132,23 +132,25 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPlugin( } LogInfo("Plugin installation started. Checking path: " << libPath); - if (!PluginUtils::checkPath(libPath)) + if (!PluginUtils::checkPath(libPath)) { return ReturnStatus::WrongPluginPath; + } LogInfo("Plugin path ok. Searching for config file..."); std::string metaFileName = libPath + DIRECTORY_SEPARATOR + std::string(WrtDB::GlobalConfig::GetPluginMetafileName()); - if (PluginUtils::checkFileExistance(metaFileName)) - { + if (PluginUtils::checkFileExistance(metaFileName)) { return installPluginFromMetafile(libPath, metaFileName); } PluginMetafileData pluginInfo; pluginInfo.m_libraryName = getLibraryName(libPath); - LogInfo("Config file done. Lib name: " << pluginInfo.m_libraryName - << ". Searching for installed plugin..."); + LogInfo( + "Config file done. Lib name: " << pluginInfo.m_libraryName + << + ". Searching for installed plugin..."); if (WrtDB::PluginDAO::isPluginInstalled(pluginInfo.m_libraryName)) { LogInfo("Plugin already installed."); @@ -181,11 +183,11 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPlugin( FOREACH(o, *plugin->GetObjects()) { libraryObjects->addObjects(CAST(*o)->GetParentName(), - CAST(*o)->GetName()); + CAST(*o)->GetName()); LogDebug("[Parent << Object] " << CAST(*o)->GetParentName() - << " << " - << CAST(*o)->GetName()); + << " << " + << CAST(*o)->GetName()); registerObjects(libraryObjects, plugin->GetObjects()); } @@ -217,9 +219,10 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPlugin( LogInfo("Registration done. Resolving dependencies..."); //TODO: can it be replaced with resolvePluginDependencies(handle) - if (!registerAndUpdateInstallation(pluginHandle, libraryObjects)) + if (!registerAndUpdateInstallation(pluginHandle, libraryObjects)) { return ReturnStatus::InstallationWaiting; - } Catch (DPL::Exception) { + } + } Catch(DPL::Exception) { LogError("Failed to make database entry."); return ReturnStatus::DatabaseError; } @@ -229,15 +232,15 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPlugin( } PluginObjectsPtr PluginsInstaller::loadLibraryFromMetafile( - const std::string& libName) const + const std::string& libName) const { LogInfo("Loading library: " << libName); void *dlHandle = dlopen(libName.c_str(), RTLD_NOW); - if (dlHandle == NULL ) { + if (dlHandle == NULL) { LogError( - "Failed to load plugin: " << libName << - ". Reason: " << dlerror()); + "Failed to load plugin: " << libName << + ". Reason: " << dlerror()); ThrowMsg(PluginInstall::Exceptions::LibraryException, "Library error"); } @@ -246,14 +249,14 @@ PluginObjectsPtr PluginsInstaller::loadLibraryFromMetafile( getWidgetEntityMapProcPtr = reinterpret_cast(dlsym(dlHandle, - PLUGIN_GET_CLASS_MAP_PROC_NAME)); + PLUGIN_GET_CLASS_MAP_PROC_NAME)); if (getWidgetEntityMapProcPtr) { rawEntityList = (*getWidgetEntityMapProcPtr)(); } else { rawEntityList = static_cast(dlsym(dlHandle, - PLUGIN_CLASS_MAP_NAME)); + PLUGIN_CLASS_MAP_NAME)); } if (rawEntityList == NULL) { @@ -270,14 +273,14 @@ PluginObjectsPtr PluginsInstaller::loadLibraryFromMetafile( LogInfo("#####"); while (rawEntityListIterator->parent_name != NULL && - rawEntityListIterator->object_name != NULL) + rawEntityListIterator->object_name != NULL) { LogInfo("##### [" << rawEntityListIterator->object_name << "]: "); LogInfo("##### Parent: " << rawEntityListIterator->parent_name); LogInfo("#####"); libraryObjects->addObjects(rawEntityListIterator->parent_name, - rawEntityListIterator->object_name); + rawEntityListIterator->object_name); ++rawEntityListIterator; } @@ -295,9 +298,8 @@ PluginObjectsPtr PluginsInstaller::loadLibraryFromMetafile( return libraryObjects; } - PluginsInstaller::ReturnStatus PluginsInstaller::installPluginFromMetafile( - const std::string& path, const std::string& metaFilePath) + const std::string& path, const std::string& metaFilePath) { if (!m_initialized) { LogError("Plugins installer not initialized."); @@ -308,7 +310,7 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPluginFromMetafile( { pluginData = parseMetafile(metaFilePath); } - Catch (PluginInstall::Exceptions::XMLFileParsingException) + Catch(PluginInstall::Exceptions::XMLFileParsingException) { LogError("Parsing metafile failed."); return ReturnStatus::MetafileError; @@ -322,10 +324,11 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPluginFromMetafile( return ReturnStatus::AlreadyInstalled; } Try { - - LogError("path is: " << path << ", libraryName: " << pluginData->m_libraryName); + LogError( + "path is: " << path << ", libraryName: " << + pluginData->m_libraryName); PluginObjectsPtr objects = loadLibraryFromMetafile( - path + DIRECTORY_SEPARATOR + pluginData->m_libraryName); + path + DIRECTORY_SEPARATOR + pluginData->m_libraryName); PluginHandle pluginHandle = PluginDAO::registerPlugin(*pluginData, path); @@ -344,9 +347,10 @@ PluginsInstaller::ReturnStatus PluginsInstaller::installPluginFromMetafile( LogInfo("Objects registered. Finishing..."); - if (!registerAndUpdateInstallation(pluginHandle, objects)) + if (!registerAndUpdateInstallation(pluginHandle, objects)) { return ReturnStatus::InstallationWaiting; - } Catch (DPL::Exception) { + } + } Catch(DPL::Exception) { LogError("Failed to make database entry."); return ReturnStatus::DatabaseError; } @@ -381,7 +385,8 @@ int PluginsInstaller::installAllPlugins() while ((libdir = readdir(dir)) != 0) { if (strcmp(libdir->d_name, ".") == 0 || - strcmp(libdir->d_name, "..") == 0) { + strcmp(libdir->d_name, "..") == 0) + { continue; } @@ -411,8 +416,9 @@ int PluginsInstaller::installAllPlugins() LogDebug("Plugins to install: " << pluginsPaths.size()); - for (int k = 0; k <= pluginsPaths.size(); ++k) + for (int k = 0; k <= pluginsPaths.size(); ++k) { printf(" "); + } printf("]\r["); int installedPluginsCount = 0; ReturnStatus ret = ReturnStatus::Unknown; @@ -434,7 +440,7 @@ int PluginsInstaller::installAllPlugins() installedPluginsCount += installWaitingPlugins(); m_registry.UnloadAll(); LogInfo("Installed " << installedPluginsCount - << " plugins of total: " << pluginsPaths.size()); + << " plugins of total: " << pluginsPaths.size()); return installedPluginsCount; } @@ -448,8 +454,9 @@ int PluginsInstaller::installWaitingPlugins() int pluginsInstalled = 0; FOREACH(it, *waitingPlugins) { - if (resolvePluginDependencies(*it)) + if (resolvePluginDependencies(*it)) { ++pluginsInstalled; + } } return pluginsInstalled; } @@ -486,31 +493,29 @@ bool PluginsInstaller::resolvePluginDependencies(PluginHandle handle) void PluginsInstaller::registerObjects(const PluginObjectsPtr& libObj, const IObjectsListPtr& objects) const { - LogDebug("registerObjects invoked"); - - FOREACH(o, *objects) - { - auto children = CAST(*o)->GetChildren(); - - if(children) - { - FOREACH(c, *children) - { - libObj->addObjects(CAST(*o)->GetName(), CAST(*c)->GetName()); - - LogDebug("[Parent << Object] " << CAST(*c)->GetName() - << " << " - << CAST(*o)->GetName()); - } - - registerObjects(libObj, children); - } - } -} + LogDebug("registerObjects invoked"); + + FOREACH(o, *objects) + { + auto children = CAST(*o)->GetChildren(); + + if (children) { + FOREACH(c, *children) + { + libObj->addObjects(CAST(*o)->GetName(), CAST(*c)->GetName()); + + LogDebug("[Parent << Object] " << CAST(*c)->GetName() + << " << " + << CAST(*o)->GetName()); + } + registerObjects(libObj, children); + } + } +} PluginsInstaller::OptionalPluginMetafileData PluginsInstaller::parseMetafile( - const std::string& path) const + const std::string& path) const { LogInfo("Plugin Config file::" << path); Try @@ -532,7 +537,7 @@ PluginsInstaller::OptionalPluginMetafileData PluginsInstaller::parseMetafile( Catch(ValidationCore::ParserSchemaException::Base) { LogError("Error during file processing " << path); ThrowMsg(PluginInstall::Exceptions::XMLFileParsingException, - "Parsing metafile failed"); + "Parsing metafile failed"); } } @@ -541,12 +546,9 @@ std::string PluginsInstaller::getLibraryName(const std::string& dirPath) const std::string pluginPath = dirPath; size_t indexpos = pluginPath.find_last_of('/'); - if (std::string::npos == indexpos) - { + if (std::string::npos == indexpos) { indexpos = 0; - } - else - { + } else { indexpos += 1; // move after '/' } @@ -558,8 +560,8 @@ std::string PluginsInstaller::getLibraryName(const std::string& dirPath) const } bool PluginsInstaller::registerAndUpdateInstallation( - const WrtDB::DbPluginHandle& pluginHandle, - const PluginObjectsPtr& libraries) + const WrtDB::DbPluginHandle& pluginHandle, + const PluginObjectsPtr& libraries) { PluginHandleSetPtr handles = PluginHandleSetPtr(new PluginHandleSet); @@ -597,26 +599,30 @@ bool PluginsInstaller::fillMappingInterfaces(PluginMetafileData& pluginData, { void *dlHandle = dlopen(filename.c_str(), RTLD_NOW); if (dlHandle == NULL) { - LogError("Failed to load plugin: " << filename << ". Reason: " << dlerror()); + LogError( + "Failed to load plugin: " << filename << ". Reason: " << dlerror()); return false; } Try { ExportedApi* entryPoint = - static_cast (dlsym(dlHandle, GetExportedSymbolName())); + static_cast(dlsym(dlHandle, GetExportedSymbolName())); if (NULL == entryPoint) { LogError("Error: " << dlerror()); - ThrowMsg(PluginInstall::Exceptions::LibraryException, "Library error"); + ThrowMsg(PluginInstall::Exceptions::LibraryException, + "Library error"); } // obtain feature -> dev-cap mapping - feature_mapping_interface_t mappingInterface = {NULL, NULL, NULL}; + feature_mapping_interface_t mappingInterface = { NULL, NULL, NULL }; entryPoint->GetProvidedFeatures(&mappingInterface); if (!mappingInterface.featGetter || !mappingInterface.release || - !mappingInterface.dcGetter) { + !mappingInterface.dcGetter) + { LogError("Failed to obtain mapping interface from .so"); - ThrowMsg(PluginInstall::Exceptions::LibraryException, "Library error"); + ThrowMsg(PluginInstall::Exceptions::LibraryException, + "Library error"); } feature_mapping_t* devcapMapping = mappingInterface.featGetter(); @@ -630,8 +636,10 @@ bool PluginsInstaller::fillMappingInterfaces(PluginMetafileData& pluginData, LogDebug("Feature: " << feature.m_name); const devcaps_t* dc = - mappingInterface.dcGetter(devcapMapping, - devcapMapping->features[i].feature_name); + mappingInterface.dcGetter( + devcapMapping, + devcapMapping->features[i]. + feature_name); LogDebug("device=cap: " << dc); @@ -648,7 +656,7 @@ bool PluginsInstaller::fillMappingInterfaces(PluginMetafileData& pluginData, } mappingInterface.release(devcapMapping); - } Catch (PluginInstall::Exceptions::PluginsInstallerException) + } Catch(PluginInstall::Exceptions::PluginsInstallerException) { LogError("Exception while feature mapping"); dlclose(dlHandle); @@ -664,10 +672,12 @@ bool PluginsInstaller::fillMappingInterfaces(PluginMetafileData& pluginData, return true; } -void PluginsInstaller::registerPluginObjects(const WrtDB::DbPluginHandle& handle, - const PluginObjectsPtr libObjects) const +void PluginsInstaller::registerPluginObjects( + const WrtDB::DbPluginHandle& handle, + const PluginObjectsPtr libObjects) +const { - //register implemented objects + //register implemented objects PluginObjects::ObjectsPtr objects = libObjects->getImplementedObject(); diff --git a/src/plugins-installer/plugin_installer.h b/src/plugins-installer/plugin_installer.h index 899be3c..2ad33b0 100644 --- a/src/plugins-installer/plugin_installer.h +++ b/src/plugins-installer/plugin_installer.h @@ -33,7 +33,7 @@ class PluginsInstaller { -public: + public: static const int INSTALLATION_ERROR; enum class ReturnStatus { @@ -62,7 +62,8 @@ public: bool resolvePluginDependencies(PluginHandle handle); bool isInitialized(); -private: + + private: friend class DPL::Singleton; PluginsInstaller(); @@ -91,6 +92,5 @@ private: typedef DPL::Singleton PluginsInstallerSingleton; - #endif /* WRT_PLUGINS_INSTALLER_PLUGIN_INSTALLER_H */ diff --git a/src/plugins-installer/plugin_installer_errors.h b/src/plugins-installer/plugin_installer_errors.h index 55aa39b..9a94a79 100644 --- a/src/plugins-installer/plugin_installer_errors.h +++ b/src/plugins-installer/plugin_installer_errors.h @@ -28,11 +28,9 @@ namespace PluginInstall { namespace Exceptions { - DECLARE_EXCEPTION_TYPE(DPL::Exception, PluginsInstallerException) DECLARE_EXCEPTION_TYPE(PluginsInstallerException, LibraryException) DECLARE_EXCEPTION_TYPE(PluginsInstallerException, XMLFileParsingException) - } //namespace } //namespace diff --git a/src/plugins-installer/plugin_metafile_reader.cpp b/src/plugins-installer/plugin_metafile_reader.cpp index ac500e8..b65c2e3 100644 --- a/src/plugins-installer/plugin_metafile_reader.cpp +++ b/src/plugins-installer/plugin_metafile_reader.cpp @@ -57,8 +57,7 @@ PluginMetafileReader::PluginMetafileReader() : m_parserSchema(this) } void PluginMetafileReader::blankFunction(PluginMetafileData & /* data */) -{ -} +{} void PluginMetafileReader::tokenEndLibraryName(PluginMetafileData &data) { diff --git a/src/plugins-installer/plugin_objects.cpp b/src/plugins-installer/plugin_objects.cpp index 2ded4f5..ae65b0f 100644 --- a/src/plugins-installer/plugin_objects.cpp +++ b/src/plugins-installer/plugin_objects.cpp @@ -37,11 +37,12 @@ std::string normalizeName(const std::string& objectName) } if (!objectName.compare(0, GLOBAL_OBJECT_NAME.size(), - GLOBAL_OBJECT_NAME)) { + GLOBAL_OBJECT_NAME)) + { return objectName; } if (!objectName.compare(0, OLD_GLOBAL_OBJECT_NAME.size(), - OLD_GLOBAL_OBJECT_NAME)) + OLD_GLOBAL_OBJECT_NAME)) { return GLOBAL_OBJECT_NAME; } @@ -51,7 +52,7 @@ std::string normalizeName(const std::string& objectName) } std::string normalizeName(const std::string& objectName, - const std::string& parentName) + const std::string& parentName) { if (objectName.empty() || parentName.empty()) { LogError("Normalize name, name size or parent name size is 0"); @@ -83,12 +84,14 @@ PluginObjects::ObjectsPtr PluginObjects::getDependentObjects() const } void PluginObjects::addObjects(const std::string& parentName, - const std::string& name) + const std::string& name) { - LogDebug("\n Parent: " << parentName - << "\n Name: " << name - << "\n After: Implemented: " << normalizeName(name, parentName) - << "\n After Dependent: " << normalizeName(parentName) + LogDebug("\n Parent: " << parentName + << "\n Name: " << name + << "\n After: Implemented: " << + normalizeName(name, parentName) + << "\n After Dependent: " << + normalizeName(parentName) ); addImplementedObject(normalizeName(name, parentName)); diff --git a/src/plugins-installer/plugin_objects.h b/src/plugins-installer/plugin_objects.h index c4cda28..eda28a3 100644 --- a/src/plugins-installer/plugin_objects.h +++ b/src/plugins-installer/plugin_objects.h @@ -43,7 +43,7 @@ class PluginObjects : public WrtDB::PluginObjectsDAO //add object declaration void addObjects(const std::string& parentName, - const std::string& name); + const std::string& name); //check if library implemements object given as name bool hasObject(const std::string& name) const; diff --git a/src/plugins-installer/plugin_utils.cpp b/src/plugins-installer/plugin_utils.cpp index dbf50ae..42cc49d 100644 --- a/src/plugins-installer/plugin_utils.cpp +++ b/src/plugins-installer/plugin_utils.cpp @@ -29,7 +29,6 @@ using namespace WrtDB; namespace PluginUtils { - //checks if file exists and is regular file bool checkFileExistance(const std::string& filename) { @@ -41,7 +40,8 @@ bool checkFileExistance(const std::string& filename) return false; } -std::string cutOffFileName(const std::string& path) { +std::string cutOffFileName(const std::string& path) +{ size_t found = path.find_last_of("/"); if (found == std::string::npos) { return path; @@ -50,7 +50,8 @@ std::string cutOffFileName(const std::string& path) { } } -bool checkPath(const std::string& path) { +bool checkPath(const std::string& path) +{ struct stat st; if (0 == stat(path.c_str(), &st) && S_ISDIR(st.st_mode)) { return true; @@ -63,27 +64,26 @@ bool checkPaths() { bool if_ok = true; if_ok &= (checkPath(cutOffFileName( - GlobalConfig::GetWrtDatabaseFilePath()))); + GlobalConfig::GetWrtDatabaseFilePath()))); if (!if_ok) { LogError( - "Path <" << GlobalConfig::GetWrtDatabaseFilePath() << - "> does not exist."); + "Path <" << GlobalConfig::GetWrtDatabaseFilePath() << + "> does not exist."); } if_ok &= (checkPath(GlobalConfig::GetDevicePluginPath())); if (!if_ok) { LogError( - "Path <" << GlobalConfig::GetDevicePluginPath() << - "> does not exist."); + "Path <" << GlobalConfig::GetDevicePluginPath() << + "> does not exist."); } if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath())); if (!if_ok) { LogError( - "Path <" << GlobalConfig::GetUserInstalledWidgetPath() << - "> does not exist."); + "Path <" << GlobalConfig::GetUserInstalledWidgetPath() << + "> does not exist."); } return if_ok; } - } //namespace PluginUtils diff --git a/src/plugins-installer/plugin_utils.h b/src/plugins-installer/plugin_utils.h old mode 100755 new mode 100644 index 3109ab3..a542e28 --- a/src/plugins-installer/plugin_utils.h +++ b/src/plugins-installer/plugin_utils.h @@ -26,12 +26,10 @@ #include namespace PluginUtils { - bool checkFileExistance(const std::string& filename); std::string cutOffFileName(const std::string& path); bool checkPath(const std::string& path); bool checkPaths(); - } #endif // PLUGIN_UTILS_H diff --git a/src/standards/W3C/Widget/JSPreferences.cpp b/src/standards/W3C/Widget/JSPreferences.cpp index c461fc8..42465fb 100644 --- a/src/standards/W3C/Widget/JSPreferences.cpp +++ b/src/standards/W3C/Widget/JSPreferences.cpp @@ -44,57 +44,55 @@ using namespace WrtDeviceApis::StorageEvent::Api; #define LOCAL_STORAGE_PROPERTY_LENGTH "length" #define CATCH_EXCEPTION_NO_MODIFABLE \ - Catch(Commons::LocalStorageValueNoModifableException) {\ - LogError("The item is read only");\ - return JSDOMExceptionFactory::\ - NoModificationAllowedException.make(context, exception);\ + Catch(Commons::LocalStorageValueNoModifableException) { \ + LogError("The item is read only"); \ + return JSDOMExceptionFactory:: \ + NoModificationAllowedException.make(context, exception); \ } #define CATCH_EXCEPTION_CONVERSION \ - Catch(Commons::ConversionException) {\ - LogError("Error on conversion");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::ConversionException) { \ + LogError("Error on conversion"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_NULL_PTR \ - Catch(Commons::NullPointerException) {\ - LogError("Error on pointer, null value");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::NullPointerException) { \ + LogError("Error on pointer, null value"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_PLATFORM_ERROR \ - Catch(Commons::PlatformException){\ - LogError("PlatformException occured");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::PlatformException){ \ + LogError("PlatformException occured"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_SECURITY \ - Catch(Commons::SecurityException){\ - LogError("Security exception occured");\ - return JSDOMExceptionFactory::\ - SecurityException.make(context, exception);\ + Catch(Commons::SecurityException){ \ + LogError("Security exception occured"); \ + return JSDOMExceptionFactory:: \ + SecurityException.make(context, exception); \ } #define CATCH_EXCEPTION_OUT_OF_RANGE \ - Catch(Commons::OutOfRangeException) {\ - LogError("OutOfRangeException");\ - return JSDOMExceptionFactory::\ - QuotaExceededException.make(context, exception);\ + Catch(Commons::OutOfRangeException) { \ + LogError("OutOfRangeException"); \ + return JSDOMExceptionFactory:: \ + QuotaExceededException.make(context, exception); \ } #define CATCH_EXCEPTION_INVALID_ARG \ - Catch(Commons::InvalidArgumentException) {\ - LogError("Pair for given key doesnt exist");\ - return JSValueMakeNull(context);\ + Catch(Commons::InvalidArgumentException) { \ + LogError("Pair for given key doesnt exist"); \ + return JSValueMakeNull(context); \ } namespace WrtPlugins { namespace W3C { - - ILocalStoragePtr getIStorage(JSObjectRef arg) { LogWarning("get localstorage object"); @@ -125,10 +123,10 @@ JSObjectRef getWidgetObject(JSObjectRef arg) } return priv->widgetObject; - } -enum class ModificationType{ +enum class ModificationType +{ RemoveItem, SetItem }; @@ -142,16 +140,11 @@ IStorageEventPtr modifyItemAndCreateEvent(ModificationType type, DPL::Optional oldValue = getIStorage(thisObject)->getValue(key); - if (ModificationType::SetItem == type) - { + if (ModificationType::SetItem == type) { getIStorage(thisObject)->setItem(key, value, false); - } - else if (ModificationType::RemoveItem == type) - { + } else if (ModificationType::RemoveItem == type) { getIStorage(thisObject)->removeItem(key); - } - else - { + } else { Assert(0 && "Wrong Modification type"); } @@ -164,16 +157,18 @@ IStorageEventPtr modifyItemAndCreateEvent(ModificationType type, //key storageEvent->setKey(key); //oldvalue - if (!!oldValue) { storageEvent->setOldValue(*oldValue); } + if (!!oldValue) { + storageEvent->setOldValue(*oldValue); + } //newValue - if(!!newValue){ storageEvent->setNewValue(*newValue); } + if (!!newValue) { + storageEvent->setNewValue(*newValue); + } return storageEvent; } - -JSClassDefinition JSPreferences::m_classInfo = -{ +JSClassDefinition JSPreferences::m_classInfo = { 0, kJSClassAttributeNone, PREFERENCES_PLUGIN_NAME, @@ -185,12 +180,12 @@ JSClassDefinition JSPreferences::m_classInfo = hasProperty, getProperty, setProperty, - NULL,//DeleteProperty, - NULL,//GetPropertyNames, - NULL,//CallAsFunction, - NULL,//CallAsConstructor, - NULL,//HasInstance, - NULL,//ConvertToType, + NULL, //DeleteProperty, + NULL, //GetPropertyNames, + NULL, //CallAsFunction, + NULL, //CallAsConstructor, + NULL, //HasInstance, + NULL, //ConvertToType, }; JSStaticFunction JSPreferences::m_function[] = { @@ -202,12 +197,11 @@ JSStaticFunction JSPreferences::m_function[] = { { 0, 0, 0 } }; -JSStaticValue JSPreferences::m_property[] = -{ - {LOCAL_STORAGE_PROPERTY_LENGTH, - JSPreferences::getLength, - NULL, - kJSPropertyAttributeReadOnly}, +JSStaticValue JSPreferences::m_property[] = { + { LOCAL_STORAGE_PROPERTY_LENGTH, + JSPreferences::getLength, + NULL, + kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -228,12 +222,12 @@ JSClassRef JSPreferences::m_jsClassRef = JSClassCreate(JSPreferences::getClassInfo()); void JSPreferences::initialize(JSContextRef context, - JSObjectRef object) + JSObjectRef object) { LogDebug("entered. Context: " << context); LocalStoragePrivateData* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate(object)); Assert(priv && "private object of preferences is NULL"); } @@ -242,7 +236,7 @@ void JSPreferences::finalize(JSObjectRef object) { LogDebug("entered"); LocalStoragePrivateData* priv = - static_cast(JSObjectGetPrivate(object)); + static_cast(JSObjectGetPrivate(object)); delete priv; LogDebug("private object is realised"); @@ -267,7 +261,7 @@ JSValueRef JSPreferences::removeItem(JSContextRef context, key); auto iframe = IFrameSupport:: - getIFrameObjectForWidget(getWidgetObject(thisObject)); + getIFrameObjectForWidget(getWidgetObject(thisObject)); Assert(iframe && "Iframe is NULL"); @@ -281,7 +275,7 @@ JSValueRef JSPreferences::removeItem(JSContextRef context, CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSPreferences::setItem(JSContextRef context, @@ -307,7 +301,7 @@ JSValueRef JSPreferences::setItem(JSContextRef context, value); auto iframe = IFrameSupport:: - getIFrameObjectForWidget(getWidgetObject(thisObject)); + getIFrameObjectForWidget(getWidgetObject(thisObject)); Assert(iframe && "Iframe is NULL"); AddEventListenerSupport:: @@ -322,10 +316,9 @@ JSValueRef JSPreferences::setItem(JSContextRef context, CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR CATCH_EXCEPTION_SECURITY - CATCH_EXCEPTION_OUT_OF_RANGE + CATCH_EXCEPTION_OUT_OF_RANGE } - JSValueRef JSPreferences::clear(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, @@ -338,9 +331,8 @@ JSValueRef JSPreferences::clear(JSContextRef context, Try { getIStorage(thisObject)->clear(false); - auto iframe = IFrameSupport:: - getIFrameObjectForWidget(getWidgetObject(thisObject)); + getIFrameObjectForWidget(getWidgetObject(thisObject)); Assert(iframe && "Iframe is NULL"); @@ -356,7 +348,7 @@ JSValueRef JSPreferences::clear(JSContextRef context, } CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSPreferences::getItem(JSContextRef context, @@ -378,16 +370,17 @@ JSValueRef JSPreferences::getItem(JSContextRef context, DPL::Optional value = getIStorage(thisObject)->getValue(key); - if (!value) + if (!value) { return JSValueMakeNull(context); - else + } else { return converter.toJSValueRef(*value); + } } CATCH_EXCEPTION_INVALID_ARG CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY } JSValueRef JSPreferences::key(JSContextRef context, @@ -399,8 +392,8 @@ JSValueRef JSPreferences::key(JSContextRef context, { LogDebug("entered"); - Try{ - if (argumentCount<1) { + Try { + if (argumentCount < 1) { LogError("No argument found"); Throw(Commons::InvalidArgumentException); } @@ -419,7 +412,7 @@ JSValueRef JSPreferences::key(JSContextRef context, CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR CATCH_EXCEPTION_SECURITY - CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_INVALID_ARG } JSValueRef JSPreferences::getLength(JSContextRef context, @@ -440,21 +433,21 @@ JSValueRef JSPreferences::getLength(JSContextRef context, CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR CATCH_EXCEPTION_SECURITY - CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_INVALID_ARG } bool JSPreferences::hasProperty(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName) + JSObjectRef object, + JSStringRef propertyName) { LogDebug("enter"); - Try{ + Try { Converter converter(context); std::string key = converter.toString(propertyName); - if(!getIStorage(object)->getValue(key)) { + if (!getIStorage(object)->getValue(key)) { return false; } else { return true; @@ -486,7 +479,7 @@ JSValueRef JSPreferences::getProperty(JSContextRef context, { LogDebug("enter"); - Try{ + Try { Converter converter(context); std::string key = converter.toString(propertyName); @@ -496,16 +489,17 @@ JSValueRef JSPreferences::getProperty(JSContextRef context, LogDebug("end"); - if (!value) + if (!value) { return JSValueMakeNull(context); - else + } else { return converter.toJSValueRef(*value); + } } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_INVALID_ARG } bool JSPreferences::setProperty(JSContextRef context, @@ -516,7 +510,7 @@ bool JSPreferences::setProperty(JSContextRef context, { LogDebug("enter"); - Try{ + Try { Converter converter(context); std::string key = converter.toString(propertyName); @@ -528,7 +522,7 @@ bool JSPreferences::setProperty(JSContextRef context, value); auto iframe = IFrameSupport:: - getIFrameObjectForWidget(getWidgetObject(object)); + getIFrameObjectForWidget(getWidgetObject(object)); Assert(iframe && "Iframe is NULL"); AddEventListenerSupport:: @@ -544,7 +538,7 @@ bool JSPreferences::setProperty(JSContextRef context, CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR CATCH_EXCEPTION_PLATFORM_ERROR - CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_SECURITY return false; } @@ -556,6 +550,5 @@ bool JSPreferences::setProperty(JSContextRef context, #undef CATCH_EXCEPTION_SECURITY #undef CATCH_EXCEPTION_OUT_OF_RANGE #undef CATCH_EXCEPTION_INVALID_ARG - } } diff --git a/src/standards/W3C/Widget/JSPreferences.h b/src/standards/W3C/Widget/JSPreferences.h index c91d4c5..62edf7b 100644 --- a/src/standards/W3C/Widget/JSPreferences.h +++ b/src/standards/W3C/Widget/JSPreferences.h @@ -30,8 +30,7 @@ namespace WrtPlugins { namespace W3C { - -struct LocalStoragePrivateData{ +struct LocalStoragePrivateData { WrtDeviceApis::LocalStorage::Api::ILocalStoragePtr istorage; //parent JSObjectRef widgetObject; @@ -39,7 +38,7 @@ struct LocalStoragePrivateData{ class JSPreferences { -public: + public: /** * This method initializes this in the JS Engine. */ @@ -50,7 +49,7 @@ public: */ static const JSClassDefinition* getClassInfo(); -private: + private: /** * The callback invoked when an object is first created. */ @@ -121,7 +120,6 @@ private: JSStringRef propertyName, JSValueRef value, JSValueRef* exception); - }; } } diff --git a/src/standards/W3C/Widget/JSWidget.cpp b/src/standards/W3C/Widget/JSWidget.cpp index 9daec95..9531cef 100644 --- a/src/standards/W3C/Widget/JSWidget.cpp +++ b/src/standards/W3C/Widget/JSWidget.cpp @@ -33,53 +33,52 @@ #include #include - #define CATCH_EXCEPTION_NO_MODIFABLE \ - Catch(Commons::LocalStorageValueNoModifableException) {\ - LogError("The item is read only");\ - return JSDOMExceptionFactory::\ - NoModificationAllowedException.make(context, exception);\ + Catch(Commons::LocalStorageValueNoModifableException) { \ + LogError("The item is read only"); \ + return JSDOMExceptionFactory:: \ + NoModificationAllowedException.make(context, exception); \ } #define CATCH_EXCEPTION_CONVERSION \ - Catch(Commons::ConversionException) {\ - LogError("Error on conversion");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::ConversionException) { \ + LogError("Error on conversion"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_NULL_PTR \ - Catch(Commons::NullPointerException) {\ - LogError("Error on pointer, null value");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::NullPointerException) { \ + LogError("Error on pointer, null value"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_PLATFORM_ERROR \ - Catch(Commons::PlatformException){\ - LogError("PlatformException occured");\ - return JSDOMExceptionFactory::\ - UnknownException.make(context, exception);\ + Catch(Commons::PlatformException){ \ + LogError("PlatformException occured"); \ + return JSDOMExceptionFactory:: \ + UnknownException.make(context, exception); \ } #define CATCH_EXCEPTION_SECURITY \ - Catch(Commons::SecurityException){\ - LogError("Security exception occured");\ - return JSDOMExceptionFactory::\ - SecurityException.make(context, exception);\ + Catch(Commons::SecurityException){ \ + LogError("Security exception occured"); \ + return JSDOMExceptionFactory:: \ + SecurityException.make(context, exception); \ } #define CATCH_EXCEPTION_OUT_OF_RANGE \ - Catch(Commons::OutOfRangeException) {\ - LogError("OutOfRangeException");\ - return JSDOMExceptionFactory::\ - QuotaExceededException.make(context, exception);\ + Catch(Commons::OutOfRangeException) { \ + LogError("OutOfRangeException"); \ + return JSDOMExceptionFactory:: \ + QuotaExceededException.make(context, exception); \ } #define CATCH_EXCEPTION_INVALID_ARG \ - Catch(Commons::InvalidArgumentException) {\ - LogError("Pair for given key doesnt exist");\ - return JSValueMakeNull(context);\ + Catch(Commons::InvalidArgumentException) { \ + LogError("Pair for given key doesnt exist"); \ + return JSValueMakeNull(context); \ } #define WIDGET_PLUGIN_NAME "Widget" @@ -97,13 +96,11 @@ namespace WrtPlugins { namespace W3C { - using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; using namespace WrtDeviceApis::Widget; - struct WidgetPrivateObject { Widget::Api::IWidgetPtr iwidget; @@ -115,7 +112,7 @@ struct WidgetPrivateObject typedef std::shared_ptr WidgetPrivateObjectPtr; typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT - ::Type JSWidgetPrivateObject; +::Type JSWidgetPrivateObject; WrtDeviceApis::Widget::Api::IWidgetPtr getIWidget(JSObjectRef arg) { @@ -131,7 +128,6 @@ WrtDeviceApis::Widget::Api::IWidgetPtr getIWidget(JSObjectRef arg) return priv->getObject()->iwidget; } - LocalStorage::Api::ILocalStoragePtr getLocalStorage(int widgetId) { LocalStorage::Api::ILocalStoragePtr storage( @@ -168,7 +164,7 @@ JSObjectRef createPreferencesObject(JSContextRef context, JSPreferences::getClassRef(), priv); - if(!preferences){ + if (!preferences) { LogError("Preferences object is null"); delete priv; } @@ -176,8 +172,7 @@ JSObjectRef createPreferencesObject(JSContextRef context, JSValueProtect(context, preferences); return preferences; -}; - +} JSClassDefinition JSWidget::m_classInfo = { 0, @@ -241,7 +236,7 @@ JSClassRef JSWidget::m_jsClassRef = JSClassCreate(JSWidget::getClassInfo()); JSContextRef JSWidget::m_globalContext = NULL; void JSWidget::initialize(JSContextRef context, - JSObjectRef object) + JSObjectRef object) { LogDebug("entered. Context : " << context); LogDebug("Object: " << object); @@ -262,7 +257,7 @@ void JSWidget::initialize(JSContextRef context, createPreferencesObject(context, object, widgetId); - if(!preferences){ + if (!preferences) { LogError("Failed to create preferences object"); } @@ -273,7 +268,6 @@ void JSWidget::initialize(JSContextRef context, priv = new JSWidgetPrivateObject(context, widgetPriv); JSObjectSetPrivate(object, priv); LogDebug("private object created"); - } Catch(Commons::InvalidArgumentException){ LogError("You should register widget id in ON_WIDGET_START"); @@ -283,7 +277,6 @@ void JSWidget::initialize(JSContextRef context, LogError("Failed to create private object for JSWidget"); return; } - } } @@ -306,8 +299,8 @@ void JSWidget::finalize(JSObjectRef object) } void JSWidget::acquireGlobalContext(java_script_context_t global_context, - js_object_instance_t iframe, - js_object_instance_t object) + js_object_instance_t iframe, + js_object_instance_t object) { IFrameSupport::RegisterWidget(global_context, iframe, object); if (!m_globalContext) { @@ -319,9 +312,9 @@ void JSWidget::acquireGlobalContext(java_script_context_t global_context, } JSValueRef JSWidget::getAuthor(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { LogDebug("entered"); @@ -331,13 +324,13 @@ JSValueRef JSWidget::getAuthor(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getAuthorEmail(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -345,13 +338,13 @@ JSValueRef JSWidget::getAuthorEmail(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getAuthorHref(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -359,13 +352,13 @@ JSValueRef JSWidget::getAuthorHref(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getDescription(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -373,13 +366,13 @@ JSValueRef JSWidget::getDescription(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getId(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -387,13 +380,13 @@ JSValueRef JSWidget::getId(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getName(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -401,13 +394,13 @@ JSValueRef JSWidget::getName(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getShortName(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -415,13 +408,13 @@ JSValueRef JSWidget::getShortName(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getVersion(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -429,13 +422,13 @@ JSValueRef JSWidget::getVersion(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getHeight(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -447,13 +440,13 @@ JSValueRef JSWidget::getHeight(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } JSValueRef JSWidget::getWidth(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { Try { Converter converter(context); @@ -465,7 +458,7 @@ JSValueRef JSWidget::getWidth(JSContextRef context, } CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_PLATFORM_ERROR } bool JSWidget::hasProperty(JSContextRef context, @@ -474,7 +467,7 @@ bool JSWidget::hasProperty(JSContextRef context, { LogDebug("enter"); - Try{ + Try { Converter converter(context); std::string key = converter.toString(propertyName); @@ -512,11 +505,10 @@ JSValueRef JSWidget::getProperty(JSContextRef context, std::string key = converter.toString(propertyName); - if (key=="preferences") { + if (key == "preferences") { Converter converter(context); JSObjectRef pref = getPreferences(object); - if (!pref) - { + if (!pref) { LogError("Preferences object is NULL"); return JSValueMakeUndefined(context); } @@ -528,7 +520,7 @@ JSValueRef JSWidget::getProperty(JSContextRef context, CATCH_EXCEPTION_CONVERSION CATCH_EXCEPTION_NULL_PTR - CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_INVALID_ARG } bool JSWidget::setProperty(JSContextRef context, @@ -539,18 +531,18 @@ bool JSWidget::setProperty(JSContextRef context, { LogDebug("enter"); - Try{ + Try { Converter converter(context); std::string key = converter.toString(propertyName); - if (key == "preferences"){ + if (key == "preferences") { LogError("Object is read only"); return true; } } CATCH_EXCEPTION_INVALID_ARG CATCH_EXCEPTION_CONVERSION - CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_NULL_PTR return false; } @@ -564,7 +556,7 @@ JSObjectRef JSWidget::callAsConstructor(JSContextRef context, LogDebug("widget constructor"); if (!m_globalContext) { LogError("Global context not set. Creating 'widget' object with " - "local context!"); + "local context!"); return JSObjectMake(context, JSWidget::getClassRef(), NULL); } return JSObjectMake(m_globalContext, JSWidget::getClassRef(), NULL); @@ -577,6 +569,5 @@ JSObjectRef JSWidget::callAsConstructor(JSContextRef context, #undef CATCH_EXCEPTION_SECURITY #undef CATCH_EXCEPTION_OUT_OF_RANGE #undef CATCH_EXCEPTION_INVALID_ARG - } } diff --git a/src/standards/W3C/Widget/JSWidget.h b/src/standards/W3C/Widget/JSWidget.h index 3be203a..b8ac2af 100644 --- a/src/standards/W3C/Widget/JSWidget.h +++ b/src/standards/W3C/Widget/JSWidget.h @@ -30,8 +30,6 @@ namespace WrtPlugins { namespace W3C { - - class JSWidget { public: @@ -60,15 +58,15 @@ class JSWidget * called in finalize may fail because of invalid context. */ static void acquireGlobalContext(java_script_context_t global_context, - js_object_instance_t iframe, - js_object_instance_t object); + js_object_instance_t iframe, + js_object_instance_t object); private: /** * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -81,7 +79,8 @@ class JSWidget static JSStaticValue m_property[]; /** - * This structure contains properties and callbacks that define a type of object. + * This structure contains properties and callbacks that define a type of + * object. */ static JSClassDefinition m_classInfo; @@ -148,7 +147,6 @@ class JSWidget JSStringRef propertyName, JSValueRef value, JSValueRef* exception); - }; } } diff --git a/src/standards/W3C/Widget/plugin_config.cpp b/src/standards/W3C/Widget/plugin_config.cpp index 581bec5..8588aca 100644 --- a/src/standards/W3C/Widget/plugin_config.cpp +++ b/src/standards/W3C/Widget/plugin_config.cpp @@ -17,29 +17,24 @@ namespace WrtPlugins { namespace W3C { - template <> WidgetDeclarations::ParamsMap WidgetDeclarations::m_params = - WrtPlugins::W3C::WidgetDeclarations::ParamsMap(); + WrtPlugins::W3C::WidgetDeclarations::ParamsMap(); template <> WidgetDeclarations::DeviceCapsMaps WidgetDeclarations::m_deviceCaps = - WrtPlugins::W3C::WidgetDeclarations::DeviceCapsMaps(); - + WrtPlugins::W3C::WidgetDeclarations::DeviceCapsMaps(); template <> -WidgetDeclarations::FeaturesMap WidgetDeclarations::m_features = -{ +WidgetDeclarations::FeaturesMap WidgetDeclarations::m_features = { { "http://w3cWidgetInterface.com/w3c-widget-interface", - { - } + {} } }; template <> WidgetDeclarations::FunctionsMap WidgetDeclarations::m_functions = - WrtPlugins::W3C::WidgetDeclarations::FunctionsMap(); - + WrtPlugins::W3C::WidgetDeclarations::FunctionsMap(); } // namespace Wac2_0 } // namespace WrtPlugins diff --git a/src/standards/W3C/Widget/plugin_config.h b/src/standards/W3C/Widget/plugin_config.h index f0f8326..13de247 100644 --- a/src/standards/W3C/Widget/plugin_config.h +++ b/src/standards/W3C/Widget/plugin_config.h @@ -20,21 +20,19 @@ namespace WrtPlugins { namespace W3C { +enum class WidgetParamId +{}; -enum class WidgetParamId { -}; +enum class WidgetDeviceCapId +{}; -enum class WidgetDeviceCapId { -}; - -enum class WidgetFunctionId { -}; +enum class WidgetFunctionId +{}; typedef WrtDeviceApis::CommonsJavaScript::StaticDeclarations < - WidgetParamId, - WidgetDeviceCapId, - WidgetFunctionId> WidgetDeclarations; - + WidgetParamId, + WidgetDeviceCapId, + WidgetFunctionId> WidgetDeclarations; } } diff --git a/src/standards/W3C/Widget/plugin_initializer.cpp b/src/standards/W3C/Widget/plugin_initializer.cpp index 6042af9..6b64770 100644 --- a/src/standards/W3C/Widget/plugin_initializer.cpp +++ b/src/standards/W3C/Widget/plugin_initializer.cpp @@ -41,10 +41,8 @@ using namespace WrtPlugins::W3C; using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; -namespace Options{ - -class_definition_options_t WidgetOptions = -{ +namespace Options { +class_definition_options_t WidgetOptions = { JS_CLASS, CREATE_INSTANCE, ALWAYS_NOTICE, @@ -54,8 +52,7 @@ class_definition_options_t WidgetOptions = NULL }; -class_definition_options_t WidgetInterfaceOptions = -{ +class_definition_options_t WidgetInterfaceOptions = { JS_INTERFACE, CREATE_INSTANCE, ALWAYS_NOTICE, @@ -64,7 +61,6 @@ class_definition_options_t WidgetInterfaceOptions = NULL, NULL }; - }; void on_widget_init_callback(feature_mapping_interface_t *mapping) @@ -82,7 +78,7 @@ void on_widget_start_callback(int widgetId) { WrtAccessSingleton::Instance().initialize(widgetId); } - Catch (Commons::Exception) + Catch(Commons::Exception) { LogError("Wrt wrapper registration failed"); return; @@ -96,12 +92,11 @@ void on_widget_stop_callback(int widgetId) { WrtAccessSingleton::Instance().deinitialize(widgetId); } - Catch (Commons::Exception) + Catch(Commons::Exception) { LogError("Wrt wrapper registration failed"); return; } - } PLUGIN_ON_WIDGET_START(on_widget_start_callback) @@ -110,16 +105,17 @@ PLUGIN_ON_WIDGET_INIT(on_widget_init_callback) PLUGIN_CLASS_MAP_BEGIN PLUGIN_CLASS_MAP_ADD_INTERFACE( - WRT_JS_EXTENSION_OBJECT_GLOBAL, - INTERFACE_WIDGET_NAME, - (js_class_template_getter)WrtPlugins::W3C::JSWidget::getClassRef, - reinterpret_cast(WrtPlugins::W3C::JSWidget::callAsConstructor), - &Options::WidgetInterfaceOptions) + WRT_JS_EXTENSION_OBJECT_GLOBAL, + INTERFACE_WIDGET_NAME, + (js_class_template_getter) WrtPlugins::W3C::JSWidget::getClassRef, + reinterpret_cast(WrtPlugins::W3C::JSWidget:: + callAsConstructor), + &Options::WidgetInterfaceOptions) PLUGIN_CLASS_MAP_ADD_INTERFACE_PRODUCT( - WRT_JS_EXTENSION_OBJECT_GLOBAL, - OBJECT_WIDGET, - INTERFACE_WIDGET_NAME, - &Options::WidgetOptions) + WRT_JS_EXTENSION_OBJECT_GLOBAL, + OBJECT_WIDGET, + INTERFACE_WIDGET_NAME, + &Options::WidgetOptions) PLUGIN_CLASS_MAP_END diff --git a/src/wrt-popup/ace/popup-bin/Popup.cpp b/src/wrt-popup/ace/popup-bin/Popup.cpp index 16b0640..a3baeb6 100644 --- a/src/wrt-popup/ace/popup-bin/Popup.cpp +++ b/src/wrt-popup/ace/popup-bin/Popup.cpp @@ -20,7 +20,8 @@ */ /* - * This is just a example pop-up that shows how to use a new C-API in wrt-security. + * This is just a example pop-up that shows how to use a new C-API in + * wrt-security. * This pop-up should be re-implemented by members of NGWAP. */ @@ -42,10 +43,9 @@ #include "Popup.h" namespace { // anonymous - -static void set_validity_from_checkbox(struct ace_popup_data *pdp) { - - if(NULL == pdp){ +static void set_validity_from_checkbox(struct ace_popup_data *pdp) +{ + if (NULL == pdp) { LogError("pdp is NULL; return"); return; } @@ -65,20 +65,23 @@ static void set_validity_from_checkbox(struct ace_popup_data *pdp) { return; } -static void on_done(void) { +static void on_done(void) +{ // Quit the efl-mainloop LogDebug("elm_exit()"); elm_exit(); } -static void grant_answer(void *data, Evas_Object * /* obj */, void * /* event_info */) { - +static void grant_answer(void *data, + Evas_Object * /* obj */, + void * /* event_info */) +{ LogDebug("grant_answer"); - if(NULL == data){ + if (NULL == data) { LogError("data is NULL; return"); return; } - struct ace_popup_data *pdp = static_cast (data); + struct ace_popup_data *pdp = static_cast (data); set_validity_from_checkbox(pdp); @@ -96,14 +99,16 @@ static void grant_answer(void *data, Evas_Object * /* obj */, void * /* event_in on_done(); } -static void deny_answer(void *data, Evas_Object * /* obj */, void * /* event_info */) { - +static void deny_answer(void *data, + Evas_Object * /* obj */, + void * /* event_info */) +{ LogDebug("deny_answer"); - if(NULL == data){ + if (NULL == data) { LogError("data is NULL; return"); return; } - struct ace_popup_data *pdp = static_cast (data); + struct ace_popup_data *pdp = static_cast (data); set_validity_from_checkbox(pdp); @@ -121,11 +126,12 @@ static void deny_answer(void *data, Evas_Object * /* obj */, void * /* event_inf on_done(); } -static int _ace_params_deserializer(ace_param_list_t* ace_param_list, Wrt::Popup::BinaryStream *stream){ - +static int _ace_params_deserializer(ace_param_list_t* ace_param_list, + Wrt::Popup::BinaryStream *stream) +{ LogDebug("_ace_params_deserializer"); - if(NULL == ace_param_list || NULL == stream){ + if (NULL == ace_param_list || NULL == stream) { LogError("ace_param_list or stream is NULL; return -1"); return -1; } @@ -138,26 +144,28 @@ static int _ace_params_deserializer(ace_param_list_t* ace_param_list, Wrt::Popup std::string name; std::string value; - if(count == 0){ + if (count == 0) { ace_param_list->items = NULL; return 0; } - ace_param_list->items = static_cast (malloc(count * sizeof(ace_param_t))); + ace_param_list->items = + static_cast (malloc(count * sizeof(ace_param_t))); memset(ace_param_list->items, 0, count * sizeof(ace_param_t)); - for(size_t i=0; i < count; ++i){ + for (size_t i = 0; i < count; ++i) { DPL::Deserialization::Deserialize(*stream, name); ace_param_list->items[i].name = - strdup(const_cast (name.c_str())); + strdup(const_cast (name.c_str())); DPL::Deserialization::Deserialize(*stream, value); ace_param_list->items[i].value = - strdup(const_cast (value.c_str())); + strdup(const_cast (value.c_str())); } return 0; } -static void _ace_params_finalize(ace_param_list_t* ace_param_list) { +static void _ace_params_finalize(ace_param_list_t* ace_param_list) +{ if (!ace_param_list || !ace_param_list->items) { LogDebug("List is null, nothing to do"); return; @@ -171,25 +179,26 @@ static void _ace_params_finalize(ace_param_list_t* ace_param_list) { ace_param_list->count = 0; } -static void show_popup(struct ace_popup_data *pdp) { +static void show_popup(struct ace_popup_data *pdp) +{ LogDebug("show_popup()"); - if(NULL == pdp){ + if (NULL == pdp) { LogError("pdp is NULL; return"); return; } - const char *resource_type = static_cast (pdp->resource_name); + const char *resource_type = static_cast (pdp->resource_name); - Evas_Object *win = NULL; - Evas_Object *cb_session = NULL; - Evas_Object *cb_always = NULL; - Evas_Object *box = NULL; - Evas_Object *label = NULL; + Evas_Object *win = NULL; + Evas_Object *cb_session = NULL; + Evas_Object *cb_always = NULL; + Evas_Object *box = NULL; + Evas_Object *label = NULL; Evas_Object *grant_button = NULL; - Evas_Object *deny_button = NULL; - pdp->per_session = EINA_FALSE; - pdp->always = EINA_FALSE; + Evas_Object *deny_button = NULL; + pdp->per_session = EINA_FALSE; + pdp->always = EINA_FALSE; win = elm_win_add(NULL, "The wrt-client popup", ELM_WIN_NOTIFICATION); elm_win_autodel_set(win, EINA_TRUE); @@ -207,7 +216,10 @@ static void show_popup(struct ace_popup_data *pdp) { elm_object_style_set(label, "popup_description/default"); elm_label_line_wrap_set(label, ELM_WRAP_MIXED); char *buff = NULL; - if(-1 == asprintf(&buff, "Application need an access to %s.
Grant or deny?", resource_type)){ + if (-1 == + asprintf(&buff, "Application need an access to %s.
Grant or deny?", + resource_type)) + { LogError("asprintf failed - returned -1"); evas_object_del(label); evas_object_del(pdp->popup); @@ -228,8 +240,12 @@ static void show_popup(struct ace_popup_data *pdp) { elm_object_text_set(cb_session, "Remember choice for this session"); elm_check_state_pointer_set(cb_session, &(pdp->per_session)); evas_object_smart_callback_add(cb_session, "changed", NULL, NULL); - evas_object_size_hint_align_set(cb_session, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(cb_session, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cb_session, + EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(cb_session, + EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(cb_session); elm_box_pack_end(box, cb_session); @@ -239,8 +255,12 @@ static void show_popup(struct ace_popup_data *pdp) { elm_object_text_set(cb_always, "Remember choice forever"); elm_check_state_pointer_set(cb_always, &(pdp->always)); evas_object_smart_callback_add(cb_always, "changed", NULL, NULL); - evas_object_size_hint_align_set(cb_always, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(cb_always, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(cb_always, + EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_size_hint_weight_set(cb_always, + EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); evas_object_show(cb_always); elm_box_pack_end(box, cb_always); } @@ -266,23 +286,21 @@ static void show_popup(struct ace_popup_data *pdp) { // Run the efl mainloop elm_run(); } - } // anonymous - EAPI_MAIN int -elm_main(int argc , char ** argv) +elm_main(int argc, char ** argv) { UNHANDLED_EXCEPTION_HANDLER_BEGIN { -// int pipe_in and int pipe_out should be passed to Popup via args. + // int pipe_in and int pipe_out should be passed to Popup via args. -// These parameters should be passed to Popup via pipe: -// ace_popup_t popup_type -// const ace_resource_t resource_name -// const ace_session_id_t session_id -// ace_widget_handle_t handle -// const ace_param_list_t param_list + // These parameters should be passed to Popup via pipe: + // ace_popup_t popup_type + // const ace_resource_t resource_name + // const ace_session_id_t session_id + // ace_widget_handle_t handle + // const ace_param_list_t param_list try { DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-POPUP-BIN"); @@ -290,31 +308,34 @@ elm_main(int argc , char ** argv) //cannot run logger return ACE_INTERNAL_ERROR; } - LogDebug("############################ popup binary ################################"); + LogDebug( + "############################ popup binary ################################"); - if(argc < 3){ - LogError("To few args passed in exec to popup-bin - should be at least 3:"); + if (argc < 3) { + LogError( + "To few args passed in exec to popup-bin - should be at least 3:"); LogError("(binary-name, pipe_in, pipe_out)"); LogError("return ACE_INTERNAL_ERROR"); return ACE_INTERNAL_ERROR; } - LogDebug("Passed args: " << argv[0] <<", " << argv[1] << ", " << argv[2]); + LogDebug("Passed args: " << argv[0] << ", " << argv[1] << ", " << + argv[2]); int pipe_in; int pipe_out; // Parsing args (pipe_in, pipe_out) - if ( 0 == sscanf(argv[1], "%d", &pipe_in) ){ + if (0 == sscanf(argv[1], "%d", &pipe_in) ) { LogError("Error while parsing pipe_in; return ACE_INTERNAL_ERROR"); return ACE_INTERNAL_ERROR; } - if ( 0 == sscanf(argv[2], "%d", &pipe_out) ){ + if (0 == sscanf(argv[2], "%d", &pipe_out) ) { LogError("Error while parsing pipe_out; return ACE_INTERNAL_ERROR"); return ACE_INTERNAL_ERROR; } - LogDebug("Parsed pipes: IN: " << pipe_in <<", OUT: " << pipe_out); + LogDebug("Parsed pipes: IN: " << pipe_in << ", OUT: " << pipe_out); - int buff_size = 1024; + int buff_size = 1024; char line[buff_size]; struct ace_popup_data pd; @@ -330,26 +351,27 @@ elm_main(int argc , char ** argv) // timeout is set for 10 seconds do { count = TEMP_FAILURE_RETRY(read(pipe_in, line, buff_size)); - if ( timeout < difftime(time(NULL), time_start) ) { + if (timeout < difftime(time(NULL), time_start) ) { LogError("Timeout reached! Exit popup - ACE_INTERNAL_ERROR"); close(pipe_in); close(pipe_out); return ACE_INTERNAL_ERROR; } } while (0 == count); - if(count < 0){ + if (count < 0) { close(pipe_in); close(pipe_out); - LogError("read returned a negative value (" << count <<")"); - LogError("errno: " << strerror( errno ) ); + LogError("read returned a negative value (" << count << ")"); + LogError("errno: " << strerror(errno) ); LogError("Exit popup - ACE_INTERNAL_ERROR"); return ACE_INTERNAL_ERROR; } - LogDebug("Read bytes : " << count << " (in " << difftime(time_start, time(NULL)) << " seconds)"); + LogDebug("Read bytes : " << count << " (in " << + difftime(time_start, time(NULL)) << " seconds)"); close(pipe_in); // cleanup Wrt::Popup::BinaryStream stream; - stream.Write(count, static_cast (line)); + stream.Write(count, static_cast (line)); int popup_type = ACE_ONESHOT; std::string resource_name_str; std::string session_id_str; @@ -361,23 +383,23 @@ elm_main(int argc , char ** argv) DPL::Deserialization::Deserialize(stream, popup_type); LogDebug("popup_type_int : " << popup_type); - pdp->popup_type = static_cast (popup_type); + pdp->popup_type = static_cast (popup_type); DPL::Deserialization::Deserialize(stream, resource_name_str); LogDebug("resource_name_char : " << resource_name_str.c_str()); pdp->resource_name = - strdup(const_cast (resource_name_str.c_str())); + strdup(const_cast (resource_name_str.c_str())); DPL::Deserialization::Deserialize(stream, session_id_str); LogDebug("session_id_char : " << session_id_str.c_str()); pdp->session_id = - strdup(const_cast (session_id_str.c_str())); + strdup(const_cast (session_id_str.c_str())); DPL::Deserialization::Deserialize(stream, handle); LogDebug("handle_int : " << handle); - pdp->handle = static_cast (handle); + pdp->handle = static_cast (handle); - if(_ace_params_deserializer(&(pdp->param_list), &stream)){ + if (_ace_params_deserializer(&(pdp->param_list), &stream)) { return ACE_INTERNAL_ERROR; } @@ -394,7 +416,10 @@ elm_main(int argc , char ** argv) int validation_result_int = (int) pdp->validation_result; LogDebug("validation_result_int : " << validation_result_int); DPL::Serialization::Serialize(stream_out, validation_result_int); - if(-1 == TEMP_FAILURE_RETRY(write(pipe_out, stream_out.char_pointer(), stream_out.size()))){ + if (-1 == + TEMP_FAILURE_RETRY(write(pipe_out, stream_out.char_pointer(), + stream_out.size()))) + { LogError("Write to pipe failed!"); close(pipe_out); return ACE_INTERNAL_ERROR; @@ -403,27 +428,26 @@ elm_main(int argc , char ** argv) if (pdp->validation_return == ACE_OK) { LogDebug("ACE_OK"); - } - else if (pdp->validation_return == ACE_INVALID_ARGUMENTS) { + } else if (pdp->validation_return == ACE_INVALID_ARGUMENTS) { LogError("ACE_INVALID_ARGUMENTS"); - } - else if (pdp->validation_return == ACE_INTERNAL_ERROR) { + } else if (pdp->validation_return == ACE_INTERNAL_ERROR) { LogError("ACE_INTERNAL_ERROR"); - } - else if (pdp->validation_return == ACE_ACE_UNKNOWN_ERROR) { + } else if (pdp->validation_return == ACE_ACE_UNKNOWN_ERROR) { LogError("ACE_ACE_UNKNOWN_ERROR"); - } - else { + } else { LogError("Really unknown error!!!"); } - LogDebug("############################ /popup binary ################################"); + LogDebug( + "############################ /popup binary ################################"); // Shutdown elementary //LogDebug("elm_shutdown()"); //elm_shutdown(); - // This is commented because, it causes that popup exits with 139 code (Segmentatation violation). - // Not calling elm_shutdown() should not have any negative consequences because this binary ends + // This is commented because, it causes that popup exits with 139 code + // (Segmentatation violation). + // Not calling elm_shutdown() should not have any negative consequences + // because this binary ends // in next line, and system should clear the memory. _ace_params_finalize(&(pdp->param_list)); diff --git a/src/wrt-popup/ace/popup-bin/Popup.h b/src/wrt-popup/ace/popup-bin/Popup.h index 8c841d6..388c921 100644 --- a/src/wrt-popup/ace/popup-bin/Popup.h +++ b/src/wrt-popup/ace/popup-bin/Popup.h @@ -23,17 +23,17 @@ #include struct ace_popup_data { - ace_popup_t popup_type; - ace_resource_t resource_name; - ace_session_id_t session_id; - ace_param_list_t param_list; - ace_widget_handle_t handle; - ace_bool_t validation_result; - ace_return_t validation_return; + ace_popup_t popup_type; + ace_resource_t resource_name; + ace_session_id_t session_id; + ace_param_list_t param_list; + ace_widget_handle_t handle; + ace_bool_t validation_result; + ace_return_t validation_return; Evas_Object *popup; - Eina_Bool per_session; - Eina_Bool always; + Eina_Bool per_session; + Eina_Bool always; - ace_validity_t remember_choice; + ace_validity_t remember_choice; }; diff --git a/src/wrt-popup/ace/popup-runner/popup-runner.cpp b/src/wrt-popup/ace/popup-runner/popup-runner.cpp index 0068bcc..6bd34c4 100644 --- a/src/wrt-popup/ace/popup-runner/popup-runner.cpp +++ b/src/wrt-popup/ace/popup-runner/popup-runner.cpp @@ -20,7 +20,8 @@ */ /* - * This is just a example pop-up that shows how to use a new C-API in wrt-security. + * This is just a example pop-up that shows how to use a new C-API in + * wrt-security. * This pop-up should be re-implemented by members of NGWAP. */ @@ -37,24 +38,24 @@ #include "popup-runner.h" namespace { // anonymous - const char *POPUP_EXEC = "/usr/bin/wrt-popup-ace-runtime"; -void _ace_params_serializer (const ace_param_list_t* ace_param_list, Wrt::Popup::BinaryStream *stream){ - +void _ace_params_serializer (const ace_param_list_t* ace_param_list, + Wrt::Popup::BinaryStream *stream) +{ LogDebug("_ace_params_serializer"); - if(NULL == ace_param_list || NULL == stream){ + if (NULL == ace_param_list || NULL == stream) { LogError("*ace_param_list or *stream is NULL; return"); return; } LogDebug("Param count : " << ace_param_list->count); // serialize ace_param_list->count; - size_t count = static_cast (ace_param_list->count); + size_t count = static_cast (ace_param_list->count); DPL::Serialization::Serialize(*stream, count); - for(size_t i=0; i < count; ++i){ + for (size_t i = 0; i < count; ++i) { std::string name(ace_param_list->items[i].name); DPL::Serialization::Serialize(*stream, name); @@ -62,58 +63,60 @@ void _ace_params_serializer (const ace_param_list_t* ace_param_list, Wrt::Popup: DPL::Serialization::Serialize(*stream, value); } } - } // anonymous namespace namespace Wrt { namespace Popup { - // BinaryStream class implementation -void BinaryStream::Read(size_t num, void * bytes) { +void BinaryStream::Read(size_t num, void * bytes) +{ size_t max_size = m_data.size(); for (size_t i = 0; i < num; ++i) { - if( i + m_readPosition >= max_size){ + if (i + m_readPosition >= max_size) { return; } - static_cast (bytes)[i] = m_data[i + m_readPosition]; + static_cast (bytes)[i] = m_data[i + m_readPosition]; } m_readPosition += num; } -void BinaryStream::Write(size_t num, const void * bytes) { +void BinaryStream::Write(size_t num, const void * bytes) +{ for (size_t i = 0; i < num; ++i) { - m_data.push_back(static_cast (bytes)[i]); + m_data.push_back(static_cast (bytes)[i]); } } -BinaryStream::BinaryStream() { +BinaryStream::BinaryStream() +{ m_readPosition = 0; } -BinaryStream::~BinaryStream() { -} +BinaryStream::~BinaryStream() {} -const unsigned char* BinaryStream::char_pointer() const { +const unsigned char* BinaryStream::char_pointer() const +{ return &m_data[0]; } -size_t BinaryStream::size() const { +size_t BinaryStream::size() const +{ return m_data.size(); } // BinaryStream ace_return_t run_popup( - ace_popup_t popup_type, - const ace_resource_t resource_name, - const ace_session_id_t session_id, - const ace_param_list_t* ace_param_list, - ace_widget_handle_t handle, - ace_bool_t* validation_result) + ace_popup_t popup_type, + const ace_resource_t resource_name, + const ace_session_id_t session_id, + const ace_param_list_t* ace_param_list, + ace_widget_handle_t handle, + ace_bool_t* validation_result) { - if ( NULL == resource_name || - NULL == session_id || - NULL == ace_param_list || - NULL == validation_result ) + if (NULL == resource_name || + NULL == session_id || + NULL == ace_param_list || + NULL == validation_result) { LogError("run_popup : ACE_INVALID_ARGUMENTS"); return ACE_INVALID_ARGUMENTS; @@ -123,10 +126,10 @@ ace_return_t run_popup( LogDebug("session_id : " << session_id); LogDebug("widget handle : " << handle); - int popup_type_int = static_cast (popup_type); - char *resource_name_char = static_cast (resource_name); - char *session_id_char = static_cast (session_id); - int handle_int = static_cast (handle); + int popup_type_int = static_cast (popup_type); + char *resource_name_char = static_cast (resource_name); + char *session_id_char = static_cast (session_id); + int handle_int = static_cast (handle); // serialization Wrt::Popup::BinaryStream stream; @@ -140,17 +143,17 @@ ace_return_t run_popup( DPL::Serialization::Serialize(stream, handle_int); - _ace_params_serializer (ace_param_list, &stream); + _ace_params_serializer(ace_param_list, &stream); - int fd_send_to_child[2]; - int fd_send_to_parent[2]; + int fd_send_to_child[2]; + int fd_send_to_parent[2]; pid_t childpid; - if(0 != pipe(fd_send_to_child)){ + if (0 != pipe(fd_send_to_child)) { LogError("Cannot create pipes!"); return ACE_INTERNAL_ERROR; } - if(0 != pipe(fd_send_to_parent)){ + if (0 != pipe(fd_send_to_parent)) { LogError("Cannot create pipes!"); return ACE_INTERNAL_ERROR; } @@ -160,7 +163,7 @@ ace_return_t run_popup( return ACE_ACE_UNKNOWN_ERROR; } - if(childpid == 0) { // Child process + if (childpid == 0) { // Child process LogDebug("Child"); // read data from parent @@ -171,31 +174,37 @@ ace_return_t run_popup( std::stringstream pipe_in_buff; std::stringstream pipe_out_buff; - pipe_in_buff << fd_send_to_parent[1]; + pipe_in_buff << fd_send_to_parent[1]; pipe_out_buff << fd_send_to_child[0]; - std::string pipe_in = pipe_in_buff.str(); + std::string pipe_in = pipe_in_buff.str(); std::string pipe_out = pipe_out_buff.str(); - LogDebug("Passed file descriptors: " << fd_send_to_child[0] << ", "<< fd_send_to_parent[1]); + LogDebug( + "Passed file descriptors: " << fd_send_to_child[0] << ", " << + fd_send_to_parent[1]); - if (execl(POPUP_EXEC, POPUP_EXEC, pipe_out.c_str(), pipe_in.c_str(), NULL) < 0){ + if (execl(POPUP_EXEC, POPUP_EXEC, pipe_out.c_str(), pipe_in.c_str(), + NULL) < 0) + { LogError("execlp FAILED"); } LogError("This should not happened!!!"); - } // end of child process - from now you can use DEBUG LOGS else { // Parent process LogDebug("Parent"); - int buff_size = 1024; + int buff_size = 1024; char result[buff_size]; // send data to child close(fd_send_to_child[0]); //writing to child LogDebug("Sending message to popup-bin process"); - if(-1 == TEMP_FAILURE_RETRY(write(fd_send_to_child[1], stream.char_pointer(), stream.size()))){ + if (-1 == + TEMP_FAILURE_RETRY(write(fd_send_to_child[1], stream.char_pointer(), + stream.size()))) + { LogError("Write to pipe failed!"); return ACE_INTERNAL_ERROR; } @@ -208,8 +217,7 @@ ace_return_t run_popup( int status; wait(&status); LogDebug("STATUS EXIT ON POPUP (CHILD): " << status); - switch (status){ - + switch (status) { case ACE_OK: LogDebug("ACE_OK"); break; @@ -217,26 +225,26 @@ ace_return_t run_popup( case ACE_INVALID_ARGUMENTS: LogDebug("ACE_INVALID_ARGUMENTS"); close(fd_send_to_parent[0]); - return static_cast (status); + return static_cast (status); break; case ACE_INTERNAL_ERROR: LogDebug("ACE_INTERNAL_ERROR"); close(fd_send_to_parent[0]); - return static_cast (status); + return static_cast (status); break; case ACE_ACE_UNKNOWN_ERROR: LogDebug("ACE_ACE_UNKNOWN_ERROR"); close(fd_send_to_parent[0]); - return static_cast (status); + return static_cast (status); break; default: LogDebug("UNKNOWN_ERROR"); close(fd_send_to_parent[0]); status = (int) ACE_ACE_UNKNOWN_ERROR; - return static_cast (status); + return static_cast (status); break; } @@ -245,15 +253,15 @@ ace_return_t run_popup( close(fd_send_to_parent[0]); // cleanup int validation_result_int; - if(0 < count){ + if (0 < count) { BinaryStream stream_in; stream_in.Write(count, result); LogDebug("RESULT FROM POPUP (CHILD) : [ " << count << " ]"); DPL::Deserialization::Deserialize(stream_in, validation_result_int); - *validation_result = static_cast (validation_result_int); + *validation_result = static_cast (validation_result_int); LogDebug("validation_result :"); - switch (*validation_result){ + switch (*validation_result) { case ACE_FALSE: LogDebug("ACE_FALSE"); break; @@ -264,8 +272,7 @@ ace_return_t run_popup( LogDebug("UNKNOWN - DEFAULT"); break; } - } - else { + } else { LogDebug("count = " << count); LogDebug("UNKNOWN_ERROR"); return ACE_ACE_UNKNOWN_ERROR; @@ -278,6 +285,5 @@ ace_return_t run_popup( LogError("This should not happend!!!"); return ACE_ACE_UNKNOWN_ERROR; } - } // Popup } // Wrt diff --git a/src/wrt-popup/ace/popup-runner/popup-runner.h b/src/wrt-popup/ace/popup-runner/popup-runner.h index e3cf0ad..d136fb1 100644 --- a/src/wrt-popup/ace/popup-runner/popup-runner.h +++ b/src/wrt-popup/ace/popup-runner/popup-runner.h @@ -26,10 +26,10 @@ namespace Wrt { namespace Popup { - -class BinaryStream : public DPL::IStream { +class BinaryStream : public DPL::IStream +{ public: - void Read (size_t num, void * bytes); + void Read (size_t num, void * bytes); void Write(size_t num, const void * bytes); BinaryStream(); @@ -44,13 +44,12 @@ class BinaryStream : public DPL::IStream { }; ace_return_t run_popup( - ace_popup_t popup_type, - const ace_resource_t resource_name, - const ace_session_id_t session_id, - const ace_param_list_t* ace_param_list, - ace_widget_handle_t handle, - ace_bool_t* validation_result - ); - + ace_popup_t popup_type, + const ace_resource_t resource_name, + const ace_session_id_t session_id, + const ace_param_list_t* ace_param_list, + ace_widget_handle_t handle, + ace_bool_t* validation_result + ); } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/PopupSerializer.cpp b/src/wrt-popup/wrt/PopupSerializer.cpp index 481519a..e9dd99f 100644 --- a/src/wrt-popup/wrt/PopupSerializer.cpp +++ b/src/wrt-popup/wrt/PopupSerializer.cpp @@ -20,7 +20,6 @@ namespace Wrt { namespace PopupSerializer { - void appendArg(int arg, DPL::BinaryQueue &buffer) { size_t argSize = sizeof(arg); @@ -54,6 +53,5 @@ std::string getStringArg(DPL::BinaryQueue &buffer) buffer.FlattenConsume(str.get(), size); return std::string(str.get(), str.get() + size); } - } } // Wrt diff --git a/src/wrt-popup/wrt/PopupSerializer.h b/src/wrt-popup/wrt/PopupSerializer.h index 27094fd..70407ec 100644 --- a/src/wrt-popup/wrt/PopupSerializer.h +++ b/src/wrt-popup/wrt/PopupSerializer.h @@ -22,13 +22,11 @@ namespace Wrt { namespace PopupSerializer { - void appendArg(int arg, DPL::BinaryQueue &buffer); void appendArg(const std::string &arg, DPL::BinaryQueue &buffer); int getIntArg(DPL::BinaryQueue &buffer); std::string getStringArg(DPL::BinaryQueue &buffer); - } } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/InfoPopup.cpp b/src/wrt-popup/wrt/popup-bin/InfoPopup.cpp index 2b9cc37..5a58fa2 100644 --- a/src/wrt-popup/wrt/popup-bin/InfoPopup.cpp +++ b/src/wrt-popup/wrt/popup-bin/InfoPopup.cpp @@ -29,7 +29,6 @@ namespace Wrt { namespace Popup { - void InfoPopup::show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent) { LogDebug("Entered"); @@ -69,6 +68,5 @@ void InfoPopup::responseCallback(const Renderer::AnswerCallbackData &answer) PopupSerializer::appendArg(answer.buttonAnswer, retValue); m_parent->response(retValue); } - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/InfoPopup.h b/src/wrt-popup/wrt/popup-bin/InfoPopup.h index 7c83b59..8d28341 100644 --- a/src/wrt-popup/wrt/popup-bin/InfoPopup.h +++ b/src/wrt-popup/wrt/popup-bin/InfoPopup.h @@ -27,18 +27,16 @@ namespace Wrt { namespace Popup { - class InfoPopup : public IPopup { -public: + public: virtual void show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent); -private: + private: void responseCallback(const Renderer::AnswerCallbackData &answer); WrtPopup* m_parent; }; - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp b/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp index 4a7e597..ea743a6 100644 --- a/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp +++ b/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.cpp @@ -13,19 +13,18 @@ namespace Wrt { namespace Popup { - YesNoCheckPopup::~YesNoCheckPopup() -{ -} +{} -Renderer::CtrlPopupPtr YesNoCheckPopup::createPopup(DPL::BinaryQueueAutoPtr data) +Renderer::CtrlPopupPtr YesNoCheckPopup::createPopup( + DPL::BinaryQueueAutoPtr data) { std::string title = PopupSerializer::getStringArg(*data); std::string message = PopupSerializer::getStringArg(*data); std::string checkboxLabel = PopupSerializer::getStringArg(*data); Assert(data->Empty()); LogDebug("title: " << title << " message: " << message << " checkbox: " << - checkboxLabel); + checkboxLabel); Renderer::CtrlPopupPtr popup = Renderer::PopupControllerSingleton::Instance().CreatePopup(); @@ -38,7 +37,7 @@ Renderer::CtrlPopupPtr YesNoCheckPopup::createPopup(DPL::BinaryQueueAutoPtr data } void YesNoCheckPopup::responseCallback( - const Renderer::AnswerCallbackData &answer) + const Renderer::AnswerCallbackData &answer) { bool result = (POPUP_YES_VALUE == answer.buttonAnswer); DPL::BinaryQueue retValue; @@ -47,7 +46,5 @@ void YesNoCheckPopup::responseCallback( PopupSerializer::appendArg(answer.chackState, retValue); m_parent->response(retValue); } - - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.h b/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.h index 710fc6c..9012df5 100644 --- a/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.h +++ b/src/wrt-popup/wrt/popup-bin/YesNoCheckPopup.h @@ -17,7 +17,8 @@ * @file YesNoCheckPopup.cpp * @author Przmeyslaw Ciezkowsko (p.ciezkowski@samsung.com) * @version 1.0 - * @brief Popup that contains 'Yes' and 'No' buttons and checkbox. Inplementation + * @brief Popup that contains 'Yes' and 'No' buttons and checkbox. + * Inplementation */ #include "YesNoPopup.h" @@ -28,16 +29,15 @@ namespace Wrt { namespace Popup { - -class YesNoCheckPopup: public YesNoPopup { -public: +class YesNoCheckPopup : public YesNoPopup +{ + public: virtual ~YesNoCheckPopup(); -protected: + + protected: virtual Renderer::CtrlPopupPtr createPopup(DPL::BinaryQueueAutoPtr data); virtual void responseCallback(const Renderer::AnswerCallbackData &answer); - }; - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp b/src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp index 9951954..f2953a8 100644 --- a/src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp +++ b/src/wrt-popup/wrt/popup-bin/YesNoPopup.cpp @@ -28,7 +28,6 @@ namespace Wrt { namespace Popup { - void YesNoPopup::show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent) { LogDebug("Entered"); @@ -57,8 +56,7 @@ void YesNoPopup::responseCallback(const Renderer::AnswerCallbackData &answer) } YesNoPopup::~YesNoPopup() -{ -} +{} Renderer::CtrlPopupPtr YesNoPopup::createPopup(DPL::BinaryQueueAutoPtr data) { @@ -76,6 +74,5 @@ Renderer::CtrlPopupPtr YesNoPopup::createPopup(DPL::BinaryQueueAutoPtr data) popup->Append(new Renderer::PopupObject::Button(NO_LABEL, POPUP_NO_VALUE)); return popup; } - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/YesNoPopup.h b/src/wrt-popup/wrt/popup-bin/YesNoPopup.h index 8b07ba7..5dbe2f8 100644 --- a/src/wrt-popup/wrt/popup-bin/YesNoPopup.h +++ b/src/wrt-popup/wrt/popup-bin/YesNoPopup.h @@ -27,7 +27,6 @@ namespace Wrt { namespace Popup { - const char YES_LABEL[] = "Yes"; const char NO_LABEL[] = "No"; const int POPUP_YES_VALUE = 1; @@ -35,15 +34,15 @@ const int POPUP_NO_VALUE = 2; class YesNoPopup : public IPopup { -public: + public: virtual void show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent); virtual ~YesNoPopup(); -protected: + + protected: virtual Renderer::CtrlPopupPtr createPopup(DPL::BinaryQueueAutoPtr data); virtual void responseCallback(const Renderer::AnswerCallbackData &answer); WrtPopup* m_parent; }; - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/evas_object.cpp b/src/wrt-popup/wrt/popup-bin/renderer/evas_object.cpp index 9510c83..13b38c1 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/evas_object.cpp +++ b/src/wrt-popup/wrt/popup-bin/renderer/evas_object.cpp @@ -17,18 +17,17 @@ * @file evas_object.cpp * @author Lukasz Wrzosek (l.wrzosel@samsung.com) * @version 1.0 - * @brief This file is the implementation for Evas_Object wrapper from Efl. + * @brief This file is the implementation for Evas_Object wrapper from + * Efl. */ #include "evas_object.h" #include #include - namespace Wrt { namespace Popup { namespace Renderer { - Evas_Object* EvasObject::IConnection::GetEvasObject() { return m_object->GetObject(); @@ -41,12 +40,11 @@ void EvasObject::IConnection::Disconnect() EvasObject::IConnection::IConnection(EvasObject::EvasObjectShared* object) : m_object(object) -{ -} +{} void EvasObject::IConnection::SmartCallbackWrapper(void* data, - Evas_Object* /*object*/, - void* event_info) + Evas_Object* /*object*/, + void* event_info) { Assert(data); IConnection* Calle = static_cast(data); @@ -54,9 +52,9 @@ void EvasObject::IConnection::SmartCallbackWrapper(void* data, } void EvasObject::IConnection::EvasCallbackWrapper(void* data, - Evas* /*evas*/, - Evas_Object* /*object*/, - void* event_info) + Evas* /*evas*/, + Evas_Object* /*object*/, + void* event_info) { Assert(data); IConnection* Calle = static_cast(data); @@ -69,12 +67,11 @@ Evas_Object* EvasObject::EvasObjectShared::GetObject() } EvasObject::EvasObjectShared::SmartConnectionBase::SmartConnectionBase( - const std::string& name, - EvasObject::EvasObjectShared* object) : + const std::string& name, + EvasObject::EvasObjectShared* object) : IConnection(object), m_callbackName(name) -{ -} +{} void EvasObject::EvasObjectShared::SmartConnectionBase::ConnectPrv() { @@ -91,12 +88,11 @@ void EvasObject::EvasObjectShared::SmartConnectionBase::DisconnectPrv() } EvasObject::EvasObjectShared::EvasConnectionBase::EvasConnectionBase( - Evas_Callback_Type type, - EvasObject::EvasObjectShared* object) : + Evas_Callback_Type type, + EvasObject::EvasObjectShared* object) : IConnection(object), m_callbackType(type) -{ -} +{} void EvasObject::EvasObjectShared::EvasConnectionBase::ConnectPrv() { @@ -114,8 +110,7 @@ void EvasObject::EvasObjectShared::EvasConnectionBase::DisconnectPrv() EvasObject::EvasObjectShared::EvasObjectShared() : m_object(NULL) -{ -} +{} EvasObject::EvasObjectShared::EvasObjectShared(Evas_Object* object) : m_object(object) @@ -172,9 +167,9 @@ void EvasObject::EvasObjectShared::DisconnectAll() } void EvasObject::EvasObjectShared::StaticOnDelEvent(void* data, - Evas* /*e*/, - Evas_Object* /*o*/, - void* /*ev*/) + Evas* /*e*/, + Evas_Object* /*o*/, + void* /*ev*/) { Assert(data); EvasObjectShared* This = static_cast(data); @@ -189,23 +184,19 @@ void EvasObject::EvasObjectShared::StaticOnDelEvent(void* data, EvasObject::EvasObject() : m_object(new EvasObjectShared()) -{ -} +{} EvasObject::EvasObject(Evas_Object* object) : m_object(new EvasObjectShared(object)) -{ -} +{} EvasObject::EvasObject(const EvasObject& other) : m_object(other.m_object) -{ -} +{} //this destructor must be here to let pimpl with shared_ptr work without warning EvasObject::~EvasObject() -{ -} +{} EvasObject& EvasObject::operator=(const EvasObject& other) { @@ -238,7 +229,6 @@ EvasObject::operator Evas_Object *() Assert(m_object); return m_object->GetObject(); } - } } // namespace DPL } // namespace Popup diff --git a/src/wrt-popup/wrt/popup-bin/renderer/evas_object.h b/src/wrt-popup/wrt/popup-bin/renderer/evas_object.h index b7ccda1..2758fa1 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/evas_object.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/evas_object.h @@ -38,7 +38,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - class EvasObject { class EvasObjectShared; @@ -54,17 +53,16 @@ class EvasObject private: IConnection(EvasObjectShared* object); virtual ~IConnection() - { - } + {} virtual void Call(void* /*event_info*/) = 0; static void SmartCallbackWrapper(void* data, - Evas_Object* /*object*/, - void* event_info); + Evas_Object* /*object*/, + void* event_info); static void EvasCallbackWrapper(void* data, - Evas* /*evas*/, - Evas_Object* /*object*/, - void* event_info); + Evas* /*evas*/, + Evas_Object* /*object*/, + void* event_info); virtual void ConnectPrv() = 0; virtual void DisconnectPrv() = 0; @@ -87,7 +85,7 @@ class EvasObject { public: SmartConnectionBase(const std::string& name, - EvasObjectShared* object); + EvasObjectShared* object); virtual void ConnectPrv(); virtual void DisconnectPrv(); @@ -103,18 +101,16 @@ class EvasObject Args ... args); SmartConnection(const std::string& name, - CbType callback, - EvasObjectShared* object, - Args ... args) : + CbType callback, + EvasObjectShared* object, + Args ... args) : SmartConnectionBase(name, object), m_callback(callback), m_args(args ...) - { - } + {} virtual ~SmartConnection() - { - } + {} virtual void Call(void* event_info) { @@ -138,20 +134,18 @@ class EvasObject void* event_info, ArgType1 *arg1); SmartMemberConnection1(const std::string& name, - CbType callback, - ThisType* callee, - ArgType1* arg1, - EvasObjectShared* object) : + CbType callback, + ThisType* callee, + ArgType1* arg1, + EvasObjectShared* object) : SmartConnectionBase(name, object), m_callback(callback), m_callee(callee), m_arg1(arg1) - { - } + {} virtual ~SmartMemberConnection1() - { - } + {} virtual void Call(void* event_info) { @@ -173,22 +167,20 @@ class EvasObject ArgType2* arg2); SmartMemberConnection2(const std::string& name, - CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : + CbType callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2, + EvasObjectShared* object) : SmartConnectionBase(name, object), m_callback(callback), m_callee(callee), m_arg1(arg1), m_arg2(arg2) - { - } + {} virtual ~SmartMemberConnection2() - { - } + {} virtual void Call(void* event_info) { @@ -206,7 +198,7 @@ class EvasObject { public: EvasConnectionBase(Evas_Callback_Type type, - EvasObjectShared* object); + EvasObjectShared* object); virtual void ConnectPrv(); virtual void DisconnectPrv(); @@ -222,18 +214,16 @@ class EvasObject ArgType1 *arg1); EvasConnection1(Evas_Callback_Type type, - CbType callback, - ArgType1* arg1, - EvasObjectShared* object) : + CbType callback, + ArgType1* arg1, + EvasObjectShared* object) : EvasConnectionBase(type, object), m_callback(callback), m_arg1(arg1) - { - } + {} virtual ~EvasConnection1() - { - } + {} virtual void Call(void* event_info) { @@ -253,20 +243,18 @@ class EvasObject ArgType1 *arg1, ArgType2 *arg2); EvasConnection2(Evas_Callback_Type type, - CbType callback, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : + CbType callback, + ArgType1* arg1, + ArgType2* arg2, + EvasObjectShared* object) : EvasConnectionBase(type, object), m_callback(callback), m_arg1(arg1), m_arg2(arg2) - { - } + {} virtual ~EvasConnection2() - { - } + {} virtual void Call(void* event_info) { @@ -287,20 +275,18 @@ class EvasObject void* event_info, ArgType1 *arg1); EvasMemberConnection1(Evas_Callback_Type type, - CbType callback, - ThisType* callee, - ArgType1* arg1, - EvasObjectShared* object) : + CbType callback, + ThisType* callee, + ArgType1* arg1, + EvasObjectShared* object) : EvasConnectionBase(type, object), m_callback(callback), m_callee(callee), m_arg1(arg1) - { - } + {} virtual ~EvasMemberConnection1() - { - } + {} virtual void Call(void* event_info) { @@ -322,22 +308,20 @@ class EvasObject ArgType2* arg2); EvasMemberConnection2(Evas_Callback_Type type, - CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2, - EvasObjectShared* object) : + CbType callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2, + EvasObjectShared* object) : EvasConnectionBase(type, object), m_callback(callback), m_callee(callee), m_arg1(arg1), m_arg2(arg2) - { - } + {} virtual ~EvasMemberConnection2() - { - } + {} virtual void Call(void* event_info) { @@ -357,9 +341,11 @@ class EvasObject ~EvasObjectShared(); template - IConnection* ConnectSmartCallback(const char* callbackName, - typename SmartConnection::CbType callback, - Args ... args) + IConnection* ConnectSmartCallback( + const char* callbackName, + typename SmartConnection:: + CbType callback, + Args ... args) { Assert(m_object); Assert(callbackName); @@ -376,12 +362,12 @@ class EvasObject template IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename SmartMemberConnection2::CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) + const char* callbackName, + typename SmartMemberConnection2::CbType callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); Assert(callee); @@ -402,11 +388,11 @@ class EvasObject template IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename SmartMemberConnection1::CbType callback, - ThisType* callee, - ArgType1* arg1) + const char* callbackName, + typename SmartMemberConnection1::CbType callback, + ThisType* callee, + ArgType1* arg1) { Assert(m_object); Assert(callee); @@ -425,9 +411,11 @@ class EvasObject template IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType, - typename EvasConnection2::CbType callback, - ArgType1* arg1, - ArgType2* arg2) + typename EvasConnection2:: + CbType callback, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); Assert(callbackType); @@ -444,9 +432,11 @@ class EvasObject } template - IConnection* ConnectEvasCallback(Evas_Callback_Type callbackType, - typename EvasConnection1::CbType callback, - ArgType1* arg1) + IConnection* ConnectEvasCallback( + Evas_Callback_Type callbackType, + typename EvasConnection1:: + CbType callback, + ArgType1* arg1) { Assert(m_object); Assert(callbackType); @@ -463,12 +453,12 @@ class EvasObject template IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasMemberConnection2::CbType callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) + Evas_Callback_Type callbackType, + typename EvasMemberConnection2::CbType callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); Assert(callee); @@ -489,11 +479,11 @@ class EvasObject template IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasMemberConnection1::CbType callback, - ThisType* callee, - ArgType1* arg1) + Evas_Callback_Type callbackType, + typename EvasMemberConnection1::CbType callback, + ThisType* callee, + ArgType1* arg1) { Assert(m_object); Assert(callee); @@ -514,9 +504,9 @@ class EvasObject void DisconnectAll(); static void StaticOnDelEvent(void* data, - Evas* /*e*/, - Evas_Object* /*o*/, - void* /*ev*/); + Evas* /*e*/, + Evas_Object* /*o*/, + void* /*ev*/); IConnectionsSet m_connections; Evas_Object* m_object; @@ -544,10 +534,10 @@ class EvasObject template IConnection* ConnectSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartConnection::CbType - callback, - Args ... args) + const char* callbackName, + typename EvasObjectShared::SmartConnection::CbType + callback, + Args ... args) { Assert(m_object); return m_object->ConnectSmartCallback(callbackName, callback, args ...); @@ -555,14 +545,14 @@ class EvasObject template IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartMemberConnection2::CbType - callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) + const char* callbackName, + typename EvasObjectShared::SmartMemberConnection2::CbType + callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); Assert(callee); @@ -576,12 +566,12 @@ class EvasObject template IConnection* ConnectMemberSmartCallback( - const char* callbackName, - typename EvasObjectShared::SmartMemberConnection1::CbType - callback, - ThisType* callee, - ArgType1* arg1) + const char* callbackName, + typename EvasObjectShared::SmartMemberConnection1::CbType + callback, + ThisType* callee, + ArgType1* arg1) { Assert(m_object); Assert(callee); @@ -594,11 +584,11 @@ class EvasObject template IConnection* ConnectEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasConnection1::CbType - callback, - ArgType1* arg1, - ArgType2* arg2) + Evas_Callback_Type callbackType, + typename EvasObjectShared::EvasConnection1::CbType + callback, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); return m_object->ConnectEvasCallback(callbackType, callback, arg1, arg2); @@ -606,10 +596,10 @@ class EvasObject template IConnection* ConnectEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasConnection1::CbType - callback, - ArgType1* arg1) + Evas_Callback_Type callbackType, + typename EvasObjectShared::EvasConnection1::CbType + callback, + ArgType1* arg1) { Assert(m_object); return m_object->ConnectEvasCallback(callbackType, callback, arg1); @@ -617,12 +607,12 @@ class EvasObject template IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasMemberConnection1::CbType - callback, - ThisType* callee, - ArgType1* arg1) + Evas_Callback_Type callbackType, + typename EvasObjectShared::EvasMemberConnection1::CbType + callback, + ThisType* callee, + ArgType1* arg1) { Assert(m_object); Assert(callee); @@ -635,13 +625,13 @@ class EvasObject template IConnection* ConnectMemberEvasCallback( - Evas_Callback_Type callbackType, - typename EvasObjectShared::EvasMemberConnection2::CbType - callback, - ThisType* callee, - ArgType1* arg1, - ArgType2* arg2) + Evas_Callback_Type callbackType, + typename EvasObjectShared::EvasMemberConnection2::CbType + callback, + ThisType* callee, + ArgType1* arg1, + ArgType2* arg2) { Assert(m_object); Assert(callee); @@ -656,11 +646,9 @@ class EvasObject private: EvasObjectSharedPtr m_object; }; - } -}//namespace -}//namespace - +} //namespace +} //namespace #endif //WRT_SRC_DOMAIN_EFL_EVAS_OBJECT_H diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup.h b/src/wrt-popup/wrt/popup-bin/renderer/popup.h index 3b2e867..149b7eb 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup.h @@ -33,7 +33,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - struct AnswerCallbackData { int buttonAnswer; @@ -56,16 +55,14 @@ class IPopup : public std::enable_shared_from_this typedef void (*PopupCallbackType)(const AnswerCallbackData& answer, void *data); virtual void Show(PopupCallbackType callback, - void* data) = 0; + void* data) = 0; virtual ~IPopup() - { - } + {} private: friend class PopupManager; friend class std::shared_ptr; }; - } } // namespace Popup } // namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.cpp b/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.cpp index eaafaff..b9bb5b3 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.cpp +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.cpp @@ -31,7 +31,6 @@ IMPLEMENT_SINGLETON(Wrt::Popup::Renderer::PopupController) namespace Wrt { namespace Popup { namespace Renderer { - void CtrlPopup::SetTitle(const std::string &title) { Assert(m_popup); @@ -52,8 +51,7 @@ CtrlPopup::CtrlPopup(IPopupPtr popup) : } CtrlPopup::~CtrlPopup() -{ -} +{} void CtrlPopup::EmitAnswer(const AnswerCallbackData & answer) { @@ -63,8 +61,7 @@ void CtrlPopup::EmitAnswer(const AnswerCallbackData & answer) } PopupController::PopupController() : m_canvas(NULL) -{ -} +{} CtrlPopupPtr PopupController::CreatePopup() const { @@ -88,7 +85,7 @@ void PopupController::OnEventReceived(const ShowPopupEventShort& event) } void PopupController::StaticOnAnswerReceived(const AnswerCallbackData & answer, - CtrlPopupPtr* popup) + CtrlPopupPtr* popup) { Assert(popup != NULL); (*popup)->EmitAnswer(answer); @@ -101,14 +98,14 @@ void PopupControllerUser::OnEventReceived(const PopupAnswerEvent& event) PopupAnswerCallback answerCall = event.GetArg1(); AnswerCallbackData answer = event.GetArg2(); answerCall.Call(answer); - event.GetArg0()->DPL::Event::EventSupport::RemoveListener(this); + event.GetArg0()->DPL::Event::EventSupport::RemoveListener( + this); } void PopupControllerUser::ListenForAnswer(CtrlPopupPtr popup) { popup->DPL::Event::EventSupport::AddListener(this); } - } } //namespace Popup } //namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.h b/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.h index eea2d0d..066fd2d 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_controller.h @@ -23,8 +23,8 @@ /** * To display a popup from a given class: * - **class ABC - **{ + * class ABC + * { * void AskUser() * { * } @@ -32,12 +32,12 @@ * void DoSomeLogicWithAnswer() * { * } - **}; + * }; * * ... update the class to something simmilar: * - **class ABC : Popup::PopupControllerUser - **{ + * class ABC : Popup::PopupControllerUser + * { * void AskUser() { * using namespace Popup; * CtrlPopupPtr popup = @@ -59,7 +59,7 @@ * else if (answer == 2) * ;//name2 pressed * } - **}; + * }; **/ #ifndef WRT_SRC_POPUP_CONTROLLER_POPUP_CONTROLLER_H_ @@ -79,7 +79,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - typedef int LabelId; struct PopupAnswerCallback @@ -89,7 +88,7 @@ struct PopupAnswerCallback void* callee; MemberPtr member; void (*callTranslator)(PopupAnswerCallback* callData, - const AnswerCallbackData& answer); + const AnswerCallbackData& answer); void Call(const AnswerCallbackData& answer) { @@ -119,6 +118,7 @@ class CtrlPopup : public DPL::Event::EventSupport, void Append(PopupObject::IPopupObject *object); ~CtrlPopup(); + private: friend class PopupController; friend class std::shared_ptr; @@ -152,7 +152,7 @@ class PopupController : private: static void StaticOnAnswerReceived(const AnswerCallbackData& answer, - CtrlPopupPtr* popup); + CtrlPopupPtr* popup); }; class PopupControllerUser : DPL::Event::EventListener @@ -168,7 +168,7 @@ class PopupControllerUser : DPL::Event::EventListener }; static PopupAnswerCallback Create(Type* callee, - MemberPtr callback) + MemberPtr callback) { PopupAnswerCallback callData; @@ -185,7 +185,7 @@ class PopupControllerUser : DPL::Event::EventListener } static void MemberCallbackTranslator(PopupAnswerCallback* callData, - const AnswerCallbackData& answer) + const AnswerCallbackData& answer) { Type* typedThis = static_cast(callData->callee); Caster caster; @@ -201,15 +201,14 @@ class PopupControllerUser : DPL::Event::EventListener template PopupAnswerCallback MakeAnswerCallback(Type* This, - void (Type::*callback) - (const AnswerCallbackData &)) + void (Type::*callback) + (const AnswerCallbackData &)) { return PopupAnswerCallbackCreator::Create(This, callback); } }; typedef DPL::Singleton PopupControllerSingleton; - } } //namespace Popup } //namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.cpp b/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.cpp index e50c530..040f445 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.cpp +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.cpp @@ -32,7 +32,6 @@ IMPLEMENT_SINGLETON(Wrt::Popup::Renderer::PopupManager) namespace Wrt { namespace Popup { namespace Renderer { - void PopupManager::Initialize(PopupRendererPtr renderer) { Assert(!m_initialized); @@ -54,7 +53,6 @@ IPopupPtr PopupManager::CreatePopup() Assert(m_initialized); return m_popupRenderer->CreatePopup(); } - } } // namespace Popup } // namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.h b/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.h index 4b90ace..125ac22 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_manager.h @@ -35,7 +35,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - class PopupManager : DPL::Noncopyable { template @@ -58,9 +57,11 @@ class PopupManager : DPL::Noncopyable IPopupPtr CreatePopup(); template - void RunAsyncWithArgType(IPopupPtr popup, - typename TemplatedPopupCallback::Type callback, - ArgType* argument) + void RunAsyncWithArgType( + IPopupPtr popup, + typename TemplatedPopupCallback::Type + callback, + ArgType* argument) { Assert(callback); WrapCbAndArg* wrapped = @@ -69,8 +70,8 @@ class PopupManager : DPL::Noncopyable } void Show(IPopupPtr popup, - IPopup::PopupCallbackType callback, - void* userdata) + IPopup::PopupCallbackType callback, + void* userdata) { popup->Show(callback, userdata); } @@ -86,11 +87,10 @@ class PopupManager : DPL::Noncopyable struct WrapCbAndArg { WrapCbAndArg(typename TemplatedPopupCallback::Type cb, - ArgType* arg) : + ArgType* arg) : callback(cb), argument(arg) - { - } + {} typename TemplatedPopupCallback::Type callback; ArgType* argument; @@ -98,7 +98,7 @@ class PopupManager : DPL::Noncopyable template static void CallbackArgTypeTranslator(const AnswerCallbackData & answer, - void* data) + void* data) { WrapCbAndArg* wrapped = static_cast< WrapCbAndArg* >(data); @@ -111,7 +111,6 @@ class PopupManager : DPL::Noncopyable }; typedef DPL::Singleton PopupManagerSingleton; - } } // namespace Popup } // namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_object.h b/src/wrt-popup/wrt/popup-bin/renderer/popup_object.h index 090b874..86f7484 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_object.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_object.h @@ -31,7 +31,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - namespace PopupObject { class IPopupObject; class PopupObjectBase; @@ -56,8 +55,7 @@ class IPopupObject virtual Check* asCheck() = 0; virtual PopupType getType() const = 0; virtual ~IPopupObject() - { - } + {} }; class PopupObjectBase : public IPopupObject @@ -86,8 +84,7 @@ class PopupObjectBase : public IPopupObject protected: PopupObjectBase(PopupType type) : m_type(type) - { - } + {} PopupType m_type; }; @@ -96,12 +93,11 @@ class Button : public PopupObjectBase { public: Button(const std::string& label, - int labelId) : + int labelId) : PopupObjectBase(BUTTON), m_label(label), m_labelId(labelId) - { - } + {} Button* asButton() { @@ -129,8 +125,7 @@ class Label : public PopupObjectBase Label(const std::string &label) : PopupObjectBase(LABEL), m_label(label) - { - } + {} Label* asLabel() { @@ -152,8 +147,7 @@ class Check : public PopupObjectBase Check(const std::string &label) : PopupObjectBase(CHECK), m_checkLabel(label) - { - } + {} Check* asCheck() { @@ -169,9 +163,8 @@ class Check : public PopupObjectBase std::string m_checkLabel; }; } /*PopupObject*/ - } -}//namespace Popup -}//namespace Wrt +} //namespace Popup +} //namespace Wrt #endif //WRT_SRC_POPUP_POPUPOBJECT_H_ diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.cpp b/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.cpp index ed00236..68290ae 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.cpp +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.cpp @@ -34,7 +34,6 @@ #include "evas_object.h" namespace Wrt { - namespace { using namespace Popup; const char* EDJ_NAME = "/usr/share/edje/ace/generic_popup.edj"; @@ -68,7 +67,6 @@ Evas_Object* create_layout_main(Evas_Object* parent, int totalV) namespace Popup { namespace Renderer { - class PopupRenderer::Impl { public: @@ -76,8 +74,7 @@ class PopupRenderer::Impl m_popupsToRender(), m_current(), m_initialized(false) - { - } + {} ~Impl() { @@ -103,8 +100,8 @@ class PopupRenderer::Impl } void ButtonCallback(EvasObject::IConnection* /*connection*/, - void* /*event_info*/, - void* data) + void* /*event_info*/, + void* data) { LogInfo("ButtonCallback"); Assert(m_initialized); @@ -128,8 +125,8 @@ class PopupRenderer::Impl } void CheckCallback(EvasObject::IConnection* connection, - void* /*event_info*/, - void* /* unused */) + void* /*event_info*/, + void* /* unused */) { m_checkState = elm_check_state_get(connection->GetEvasObject()); @@ -143,9 +140,9 @@ class PopupRenderer::Impl } void DoRender(const PopupObject::Label& object, - EvasObject& parent, - EvasObject& layout, - int themeIndex) + EvasObject& parent, + EvasObject& layout, + int themeIndex) { EvasObject label(elm_label_add(parent)); @@ -164,9 +161,9 @@ class PopupRenderer::Impl } void DoRender(const PopupObject::Check& object, - EvasObject& parent, - EvasObject& layout, - int themeIndex) + EvasObject& parent, + EvasObject& layout, + int themeIndex) { EvasObject check(elm_check_add(parent)); @@ -188,7 +185,7 @@ class PopupRenderer::Impl } void DoRender(const PopupObject::Button& object, - EvasObject &parent) + EvasObject &parent) { EvasObject btn(elm_button_add(parent)); @@ -197,13 +194,14 @@ class PopupRenderer::Impl btn.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, &Impl::ButtonCallback, this, - reinterpret_cast(object.getLabelId())); + reinterpret_cast(object. + getLabelId())); m_createdObjects.push_back(btn); } void DoRender(const PopupObject::Button& object1, - const PopupObject::Button& object2, - EvasObject &parent) + const PopupObject::Button& object2, + EvasObject &parent) { DoRender(object1, parent); @@ -214,14 +212,15 @@ class PopupRenderer::Impl btn2.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, &Impl::ButtonCallback, this, - reinterpret_cast(object2.getLabelId())); + reinterpret_cast(object2. + getLabelId())); m_createdObjects.push_back(btn2); } void DoRender(const PopupObject::Button& object1, - const PopupObject::Button& object2, - const PopupObject::Button& object3, - EvasObject &parent) + const PopupObject::Button& object2, + const PopupObject::Button& object3, + EvasObject &parent) { DoRender(object1, object2, parent); @@ -232,7 +231,8 @@ class PopupRenderer::Impl btn3.ConnectMemberSmartCallback(BUTTON_CLICKED_CALLBACK_NAME, &Impl::ButtonCallback, this, - reinterpret_cast(object3.getLabelId())); + reinterpret_cast(object3. + getLabelId())); m_createdObjects.push_back(btn3); } @@ -274,12 +274,12 @@ class PopupRenderer::Impl m_themeIndexV = 0; // preprocessing - std::vector countPopupObjects = {0 /* PopupObject::BUTTON */, - 0 /* PopupObject::LABEL */, - 0 /* PopupObject::CHECK */}; + std::vector countPopupObjects = { 0 /* PopupObject::BUTTON */, + 0 /* PopupObject::LABEL */, + 0 /* PopupObject::CHECK */ }; FOREACH(it, m_current->GetPopupObjects()) { Assert((*it)->getType() < countPopupObjects.size() && - "Wrong PopupObject assigned"); + "Wrong PopupObject assigned"); countPopupObjects[(*it)->getType()]++; } int needsIndexV = countPopupObjects[PopupObject::LABEL] + @@ -326,7 +326,7 @@ class PopupRenderer::Impl layout); // show buution - switch(buttonObjectList.size()) { + switch (buttonObjectList.size()) { case 0: LogInfo("no button"); break; @@ -401,7 +401,7 @@ void PopupRenderer::Deinitialize() IPopupPtr PopupRenderer::CreatePopup() { return std::static_pointer_cast(IPopupPtr - (new Popup(shared_from_this()))); + (new Popup(shared_from_this()))); } void PopupRenderer::Render(PopupPtr popup) @@ -413,7 +413,6 @@ void PopupRenderer::setExternalCanvas(void* externalCanvas) { m_impl->setExternalCanvas(externalCanvas); } - } } // namespace Popup } // namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.h b/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.h index 0a34547..3538bbb 100644 --- a/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.h +++ b/src/wrt-popup/wrt/popup-bin/renderer/popup_renderer.h @@ -36,7 +36,6 @@ namespace Wrt { namespace Popup { namespace Renderer { - class PopupRenderer : public std::enable_shared_from_this { public: @@ -46,6 +45,7 @@ class PopupRenderer : public std::enable_shared_from_this void Deinitialize(); IPopupPtr CreatePopup(); virtual void setExternalCanvas(void* externalCanvas); + protected: class Popup; typedef std::shared_ptr PopupPtr; @@ -67,7 +67,7 @@ class PopupRenderer : public std::enable_shared_from_this } virtual void Show(IPopup::PopupCallbackType callback, - void* data) + void* data) { Assert(callback); m_data = data; @@ -98,8 +98,7 @@ class PopupRenderer : public std::enable_shared_from_this friend class PopupObjectTheme; Popup(std::shared_ptr renderer) : m_renderer(renderer) - { - } + {} void ForwardAnswer(const AnswerCallbackData & answer) const { @@ -121,7 +120,6 @@ class PopupRenderer : public std::enable_shared_from_this }; typedef std::shared_ptr PopupRendererPtr; - } } // namespace Popup } // namespace Wrt diff --git a/src/wrt-popup/wrt/popup-bin/wrt-popup.cpp b/src/wrt-popup/wrt/popup-bin/wrt-popup.cpp index 3023302..c1dd04a 100644 --- a/src/wrt-popup/wrt/popup-bin/wrt-popup.cpp +++ b/src/wrt-popup/wrt/popup-bin/wrt-popup.cpp @@ -30,7 +30,6 @@ namespace Wrt { namespace Popup { - bool WrtPopup::openPipes() { Try @@ -61,8 +60,7 @@ void WrtPopup::closePipes() { Try { - if (m_pipesOpened) - { + if (m_pipesOpened) { DPL::WaitableHandleWatchSupport::InheritedContext()-> RemoveWaitableHandleWatch(this, m_input.WaitableReadHandle(), @@ -78,7 +76,7 @@ void WrtPopup::closePipes() } } -void WrtPopup::OnEventReceived(const QuitEvent &/* event */) +void WrtPopup::OnEventReceived(const QuitEvent & /* event */) { LogDebug("Quiting"); closePipes(); @@ -88,8 +86,7 @@ void WrtPopup::OnEventReceived(const QuitEvent &/* event */) void WrtPopup::OnWaitableHandleEvent(DPL::WaitableHandle waitableHandle, DPL::WaitMode::Type /*mode*/) { - if (waitableHandle == m_input.WaitableReadHandle()) - { + if (waitableHandle == m_input.WaitableReadHandle()) { readInputData(); } } @@ -100,7 +97,7 @@ void WrtPopup::readInputData() m_input.Read(std::numeric_limits::max()); int popupType = PopupSerializer::getIntArg(*data); LogDebug("popup type " << popupType); - switch(popupType) { + switch (popupType) { case YES_NO_PROMPT: m_popup.reset(new YesNoPopup()); m_popup->show(data, this); @@ -131,8 +128,7 @@ void WrtPopup::OnStop() void WrtPopup::OnCreate() { - if (!openPipes()) - { + if (!openPipes()) { PostEvent(QuitEvent()); } LogInfo("On Create"); @@ -174,7 +170,6 @@ WrtPopup::~WrtPopup() Renderer::PopupManagerSingleton::Instance().Deinitialize(); LogDebug("App Finished"); } - } } diff --git a/src/wrt-popup/wrt/popup-bin/wrt-popup.h b/src/wrt-popup/wrt/popup-bin/wrt-popup.h index 47ddaa1..ab9c519 100644 --- a/src/wrt-popup/wrt/popup-bin/wrt-popup.h +++ b/src/wrt-popup/wrt/popup-bin/wrt-popup.h @@ -30,32 +30,30 @@ namespace Wrt { namespace Popup { - DECLARE_GENERIC_EVENT_0(QuitEvent) class WrtPopup; class IPopup : public Renderer::PopupControllerUser { -public: + public: virtual void show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent) = 0; virtual ~IPopup() {} }; typedef std::unique_ptr IPopupPtr; - class WrtPopup : public DPL::WaitableHandleWatchSupport::WaitableHandleListener, public DPL::Application, private DPL::Event::Controller::Type> { -public: + public: WrtPopup(int argc, char **argv); virtual ~WrtPopup(); void response(DPL::BinaryQueue result); -protected: + protected: //DPL::Application functions virtual void OnStop(); virtual void OnCreate(); @@ -66,7 +64,8 @@ protected: virtual void OnEventReceived(const QuitEvent &event); virtual void OnWaitableHandleEvent(DPL::WaitableHandle waitableHandle, DPL::WaitMode::Type mode); -private: + + private: void showAcePrompt(DPL::BinaryQueueAutoPtr data); void communicationBoxResponse(int buttonAnswer, @@ -82,7 +81,6 @@ private: DPL::NamedInputPipe m_input; DPL::NamedOutputPipe m_output; }; - } } diff --git a/src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp b/src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp index 9b50a88..8e44eb3 100644 --- a/src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp +++ b/src/wrt-popup/wrt/popup-runner/PopupInvoker.cpp @@ -33,7 +33,6 @@ const char *POPUP_EXEC = "/usr/bin/wrt-popup-wrt-runtime"; namespace Wrt { namespace Popup { - PopupInvoker::PopupInvoker() : m_inputName(tmpnam(NULL)), m_outputName(tmpnam(NULL)) @@ -44,7 +43,7 @@ PopupInvoker::PopupInvoker() : m_output.Create(m_outputName); LogDebug("Pipes created"); } - Catch (DPL::Exception) + Catch(DPL::Exception) { LogError("Cannot create pipes"); } @@ -58,13 +57,14 @@ PopupInvoker::~PopupInvoker() m_output.Destroy(m_outputName); LogDebug("Pipes destroyed"); } - Catch (DPL::Exception) + Catch(DPL::Exception) { LogError("Cannot destroy pipes"); } } -bool PopupInvoker::askYesNo(const std::string& title, const std::string& message) +bool PopupInvoker::askYesNo(const std::string& title, + const std::string& message) { Try { @@ -135,7 +135,8 @@ void PopupInvoker::showInfo(const std::string& title, } PopupResponse PopupInvoker::askYesNoCheckbox(const std::string& title, - const std::string& message, const std::string& checkboxLabel) + const std::string& message, + const std::string& checkboxLabel) { Try { @@ -158,7 +159,8 @@ PopupResponse PopupInvoker::askYesNoCheckbox(const std::string& title, const int result = PopupSerializer::getIntArg(*resultData); const int rememberResult = PopupSerializer::getIntArg(*resultData); - LogDebug("Popup result is: " << result << " remeber: " << rememberResult); + LogDebug( + "Popup result is: " << result << " remeber: " << rememberResult); Assert(resultData->Empty()); tmp.Close(); @@ -189,14 +191,12 @@ PopupResponse PopupInvoker::askYesNoCheckbox(const std::string& title, void PopupInvoker::executePopup() { pid_t pid = fork(); - if (pid == -1) - { + if (pid == -1) { //error occured LogError("Cannot display popup!"); Assert(false); } - if (pid == 0) - { + if (pid == 0) { //child process int ret = execl(POPUP_EXEC, POPUP_EXEC, @@ -213,6 +213,5 @@ void PopupInvoker::executePopup() DPL::WaitableHandle handle = m_input.WaitableReadHandle(); DPL::WaitForSingleHandle(handle); } - } // Popup } // Wrt diff --git a/src/wrt-popup/wrt/popup-runner/PopupInvoker.h b/src/wrt-popup/wrt/popup-runner/PopupInvoker.h index 112028f..157640a 100644 --- a/src/wrt-popup/wrt/popup-runner/PopupInvoker.h +++ b/src/wrt-popup/wrt/popup-runner/PopupInvoker.h @@ -23,16 +23,15 @@ #include /* - - Example usage: - - bool result = PopupInvoker().askYesNo("title", "message"); - + * + * Example usage: + * + * bool result = PopupInvoker().askYesNo("title", "message"); + * */ namespace Wrt { namespace Popup { - enum PopupResponse { NO_DO_REMEMBER, NO_DONT_REMEMBER, @@ -42,7 +41,7 @@ enum PopupResponse { class PopupInvoker { -public: + public: class Exception { public: @@ -58,9 +57,10 @@ public: const std::string &message, const std::string &buttonLabel = std::string("OK")); PopupResponse askYesNoCheckbox(const std::string& title, - const std::string& message, const std::string& checkboxLabel); + const std::string& message, + const std::string& checkboxLabel); -private: + private: void executePopup(); @@ -69,7 +69,6 @@ private: const std::string m_inputName; const std::string m_outputName; }; - } // Popup } // Wrt diff --git a/tests/dao/TestInit.cpp b/tests/dao/TestInit.cpp index 0474752..77c4f52 100644 --- a/tests/dao/TestInit.cpp +++ b/tests/dao/TestInit.cpp @@ -35,9 +35,9 @@ int main (int argc, char *argv[]) system("/usr/bin/widgetdb_tests_prepare_db.sh stop"); return -1; } else if (WEXITSTATUS(ret)) { //wrong script command, nothing done - LogError("Preparation script has return error: " << ret - << ". Quitting"); - return -1; + LogError("Preparation script has return error: " << ret + << ". Quitting"); + return -1; } LogInfo("Starting tests"); diff --git a/tests/dao/WidgetDBTest.cpp b/tests/dao/WidgetDBTest.cpp index 1e87fde..e2b0d42 100644 --- a/tests/dao/WidgetDBTest.cpp +++ b/tests/dao/WidgetDBTest.cpp @@ -35,470 +35,420 @@ using namespace WrtDeviceApis::WidgetDB::Api; std::string temp(in); \ RUNNER_ASSERT_MSG(temp == (test), "Equals: [" << temp << "]"); \ } \ - while(0) + while (0) RUNNER_TEST_GROUP_INIT(WidgetDB) /* -Name: widgetDB_test_get_language1 -Description: check default widget language -Expected: default should be "en" -*/ + * Name: widgetDB_test_get_language1 + * Description: check default widget language + * Expected: default should be "en" + */ RUNNER_TEST(widgetDB_test_get_language1) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string lang = widget->getLanguage(); LogDebug("language is: " << lang); RUNNER_ASSERT_WHAT_EQUALS(lang, "en"); - - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_language2 -Description: check language returned by WidgetDB if widget does nto exists -Expected: result should be "" -*/ + * Name: widgetDB_test_get_language2 + * Description: check language returned by WidgetDB if widget does nto exists + * Expected: result should be "" + */ RUNNER_TEST(widgetDB_test_get_language2) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(1000); //widget not exist std::string lang = widget->getLanguage(); LogDebug("language is: " << lang); RUNNER_ASSERT_WHAT_EQUALS(lang, ""); - - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_id -Description: check GUID returned by WidgetDB -Expected: GUID should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_id + * Description: check GUID returned by WidgetDB + * Expected: GUID should match this, which was inserted into widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_id) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::ID); LogDebug("id is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_id_2000"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_version -Description: check version returned by WidgetDB -Expected: version should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_version + * Description: check version returned by WidgetDB + * Expected: version should match this, which was inserted into widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_version) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::VERSION); LogDebug("version is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "1.0.0"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_description -Description: check description returned by WidgetDB -Expected: description should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_description + * Description: check description returned by WidgetDB + * Expected: description should match this, which was inserted into widget + * database + */ RUNNER_TEST(widgetDB_test_get_config_value_description) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::DESCRIPTION); LogDebug("description is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_desc_2000_en"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_license -Description: check license returned by WidgetDB -Expected: license should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_license + * Description: check license returned by WidgetDB + * Expected: license should match this, which was inserted into widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_license) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::LICENSE); LogDebug("licence is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_lic_2000_en"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_license_href -Description: check license href returned by WidgetDB -Expected: license href should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_license_href + * Description: check license href returned by WidgetDB + * Expected: license href should match this, which was inserted into widget + * database + */ RUNNER_TEST(widgetDB_test_get_config_value_license_href) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::LICENSE_HREF); LogDebug("license href is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_lic_href_2000_en"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_author_name -Description: check author name href returned by WidgetDB -Expected: author name should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_author_name + * Description: check author name href returned by WidgetDB + * Expected: author name should match this, which was inserted into widget + * database + */ RUNNER_TEST(widgetDB_test_get_config_value_author_name) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::AUTHOR_NAME); LogDebug("author name is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "a_name_2000"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_author_href -Description: check author href returned by WidgetDB -Expected: author href should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_author_href + * Description: check author href returned by WidgetDB + * Expected: author href should match this, which was inserted into widget + * database + */ RUNNER_TEST(widgetDB_test_get_config_value_author_href) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::AUTHOR_HREF); LogDebug("author href is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "a_href_2000"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_author_email -Description: check author email returned by WidgetDB -Expected: author email should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_author_email + * Description: check author email returned by WidgetDB + * Expected: author email should match this, which was inserted into widget + * database + */ RUNNER_TEST(widgetDB_test_get_config_value_author_email) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::AUTHOR_EMAIL); LogDebug("author email is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "a_email_2000"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_name -Description: check localized widget name returned by WidgetDB -Expected: localized widget name should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_name + * Description: check localized widget name returned by WidgetDB + * Expected: localized widget name should match this, which was inserted into + * widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_name) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::NAME); LogDebug("name is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_name_2000_en"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_short_name -Description: check localized widget short name returned by WidgetDB -Expected: localized widget short name should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_short_name + * Description: check localized widget short name returned by WidgetDB + * Expected: localized widget short name should match this, which was inserted + * into widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_short_name) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::SHORT_NAME); LogDebug("short name is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "w_shortname_2000_en"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_access_network -Description: check network access returned by WidgetDB -Expected: network access should be set to "yes" -*/ + * Name: widgetDB_test_get_config_value_access_network + * Description: check network access returned by WidgetDB + * Expected: network access should be set to "yes" + */ RUNNER_TEST(widgetDB_test_get_config_value_access_network) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue( - ConfigAttribute::ACCESS_NETWORK); + ConfigAttribute::ACCESS_NETWORK); LogDebug("acces network is always true: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "yes"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_width -Description: check widget prefered width returned by WidgetDB -Expected: widget prefered width should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_width + * Description: check widget prefered width returned by WidgetDB + * Expected: widget prefered width should match this, which was inserted into + * widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_width) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::WIDTH); LogDebug("width is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "100"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_height -Description: check widget prefered height returned by WidgetDB -Expected: widget prefered height should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_height + * Description: check widget prefered height returned by WidgetDB + * Expected: widget prefered height should match this, which was inserted into + * widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_height) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::HEIGHT); LogDebug("height is: " << tmp); RUNNER_ASSERT_WHAT_EQUALS(tmp, "200"); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_paths -Description: check widget installation path returned by WidgetDB -Expected: widget installation path should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_get_config_value_paths + * Description: check widget installation path returned by WidgetDB + * Expected: widget installation path should match this, which was inserted into + * widget database + */ RUNNER_TEST(widgetDB_test_get_config_value_paths) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); std::string tmp = widget->getConfigValue(ConfigAttribute::INSTALL_PATH); LogDebug("install path is: " << tmp); tmp = widget->getConfigValue( - ConfigAttribute::PUBLIC_STORAGE_PATH); + ConfigAttribute::PUBLIC_STORAGE_PATH); LogDebug("public storage path is: " << tmp); - - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogDebug("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_get_config_value_empty -Description: check if requesting GUID from WidgetDB throw excpetion if widget does not exists -Expected: accessing GUID should throw WrtDeviceApis::Commons::SecurityException -*/ + * Name: widgetDB_test_get_config_value_empty + * Description: check if requesting GUID from WidgetDB throw excpetion if widget + * does not exists + * Expected: accessing GUID should throw + * WrtDeviceApis::Commons::SecurityException + */ RUNNER_TEST(widgetDB_test_get_config_value_empty) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2005); std::string tmp = widget->getConfigValue(ConfigAttribute::ID); //exception should be thrown RUNNER_ASSERT(false); - - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogDebug("OK. Exception thrown." << e.DumpToString()); } } /* -Name: widgetDB_test_check_installation_status_installed -Description: check if widget is installed by WidgetDB -Expected: plugin should be notified that widget is installed -*/ + * Name: widgetDB_test_check_installation_status_installed + * Description: check if widget is installed by WidgetDB + * Expected: plugin should be notified that widget is installed + */ RUNNER_TEST(widgetDB_test_check_installation_status_installed) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); InstallationStatus tmp = widget->checkInstallationStatus( - "w_id_2000", "w_name_2000_en", "2.0.0"); + "w_id_2000", "w_name_2000_en", "2.0.0"); RUNNER_ASSERT(tmp == InstallationStatus::STATUS_INSTALLED); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_check_installation_status_uninstalled -Description: check if widget is not installed by WidgetDB -Expected: plugin should be notified that widget is not installed -*/ + * Name: widgetDB_test_check_installation_status_uninstalled + * Description: check if widget is not installed by WidgetDB + * Expected: plugin should be notified that widget is not installed + */ RUNNER_TEST(widgetDB_test_check_installation_status_uninstalled) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); InstallationStatus tmp = widget->checkInstallationStatus( - "w_id_2011", "w_name_2000_en", "2.0.0"); + "w_id_2011", "w_name_2000_en", "2.0.0"); RUNNER_ASSERT(tmp == InstallationStatus::STATUS_UNINSTALLED); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_check_installation_status_latest -Description: check if widget installation information is taken from latest version -Expected: plugin installation status should be same is both calls of WidgetDB -*/ + * Name: widgetDB_test_check_installation_status_latest + * Description: check if widget installation information is taken from latest + * version + * Expected: plugin installation status should be same is both calls of WidgetDB + */ RUNNER_TEST(widgetDB_test_check_installation_status_latest) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); InstallationStatus tmp1 = widget->checkInstallationStatus( - "w_id_2000", "w_name_2000_en", "0.1.0"); + "w_id_2000", "w_name_2000_en", "0.1.0"); InstallationStatus tmp2 = widget->checkInstallationStatus( - "w_id_2000", "w_name_2000_en", "1.0.0"); + "w_id_2000", "w_name_2000_en", "1.0.0"); RUNNER_ASSERT(tmp1 == InstallationStatus::STATUS_LATEST); RUNNER_ASSERT(tmp2 == InstallationStatus::STATUS_LATEST); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_widget_feature -Description: check accessiblity of widget features and their values by WidgetDB -Expected: feature names and values should match this, which was inserted into widget database -*/ + * Name: widgetDB_test_widget_feature + * Description: check accessiblity of widget features and their values by + * WidgetDB + * Expected: feature names and values should match this, which was inserted into + * widget database + */ RUNNER_TEST(widgetDB_test_widget_feature) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2000); Features features = widget->getWidgetFeatures(); @@ -506,61 +456,48 @@ RUNNER_TEST(widgetDB_test_widget_feature) FOREACH(it, features) { - std::string name = (*it)->getName(); - if ("first_2000" == name) - { - RUNNER_ASSERT((*it)->getParams().size() == 4); - - RUNNER_ASSERT((*it)->isRequired()); - } - else if ("second_2000" == name) - { - RUNNER_ASSERT((*it)->getParams().size() == 1); - } - else if ("third_2000" == name) - { - IWidgetFeature::Params params = (*it)->getParams(); - - RUNNER_ASSERT(params.size() == 1); - RUNNER_ASSERT_WHAT_EQUALS("third_2000", params.begin()->first); - RUNNER_ASSERT_WHAT_EQUALS("thirdValue1", params.begin()->second); - RUNNER_ASSERT(!(*it)->isRequired()); - } - else if ("fourth_2000" == name) - { - RUNNER_ASSERT((*it)->getParams().size() == 0); - } - else if ("fifth_2000" == name) - { - RUNNER_ASSERT((*it)->getParams().size() == 0); - } - else - RUNNER_ASSERT(false); + std::string name = (*it)->getName(); + if ("first_2000" == name) { + RUNNER_ASSERT((*it)->getParams().size() == 4); + + RUNNER_ASSERT((*it)->isRequired()); + } else if ("second_2000" == name) { + RUNNER_ASSERT((*it)->getParams().size() == 1); + } else if ("third_2000" == name) { + IWidgetFeature::Params params = (*it)->getParams(); + + RUNNER_ASSERT(params.size() == 1); + RUNNER_ASSERT_WHAT_EQUALS("third_2000", params.begin()->first); + RUNNER_ASSERT_WHAT_EQUALS("thirdValue1", params.begin()->second); + RUNNER_ASSERT(!(*it)->isRequired()); + } else if ("fourth_2000" == name) { + RUNNER_ASSERT((*it)->getParams().size() == 0); + } else if ("fifth_2000" == name) { + RUNNER_ASSERT((*it)->getParams().size() == 0); + } else { + RUNNER_ASSERT(false); + } } - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogError("Exception thrown." << e.DumpToString()); RUNNER_ASSERT(false); } } /* -Name: widgetDB_test_widget_feature2 -Description: check if requesting features from WidgetDB throw excpetion if widget does not exists -Expected: exception should be raise if widget does not exists -*/ + * Name: widgetDB_test_widget_feature2 + * Description: check if requesting features from WidgetDB throw excpetion if + * widget does not exists + * Expected: exception should be raise if widget does not exists + */ RUNNER_TEST(widgetDB_test_widget_feature2) { - try - { + try { IWidgetDBPtr widget = getWidgetDB(2011); //no such widget Features features = widget->getWidgetFeatures(); RUNNER_ASSERT(false); - } - catch(const WrtDeviceApis::Commons::SecurityException &e) - { + } catch (const WrtDeviceApis::Commons::SecurityException &e) { LogDebug("OK. Exception thrown." << e.DumpToString()); } } diff --git a/uncrustify.cfg b/uncrustify.cfg new file mode 100644 index 0000000..2bf1d96 --- /dev/null +++ b/uncrustify.cfg @@ -0,0 +1,170 @@ +indent_align_string=true +indent_braces=false +indent_braces_no_func=false +indent_brace_parent=false +indent_namespace=false +indent_extern=false +indent_class=true +indent_class_colon=false +indent_else_if=false +indent_func_call_param=false +indent_func_def_param=false +indent_func_proto_param=false +indent_func_class_param=false +indent_func_ctor_var_param=false +indent_template_param=false +indent_func_param_double=false +indent_relative_single_line_comments=false +indent_col1_comment=true +indent_access_spec_body=false +indent_paren_nl=false +indent_comma_paren=false +indent_bool_paren=false +indent_square_nl=false +indent_preserve_sql=false +indent_align_assign=false +sp_balance_nested_parens=false +align_keep_tabs=false +align_with_tabs=false +align_on_tabstop=false +align_number_left=false +align_func_params=false +align_same_func_call_params=false +align_var_def_colon=false +align_var_def_attribute=false +align_var_def_inline=false +align_right_cmt_mix=false +align_on_operator=false +align_mix_var_proto=false +align_single_line_func=false +align_single_line_brace=false +align_nl_cont=false +align_left_shift=true +nl_collapse_empty_body=true +nl_assign_leave_one_liners=false +nl_class_leave_one_liners=false +nl_enum_leave_one_liners=false +nl_getset_leave_one_liners=false +nl_func_leave_one_liners=false +nl_if_leave_one_liners=false +nl_multi_line_cond=true +nl_multi_line_define=false +nl_before_case=false +nl_after_case=false +nl_after_return=false +nl_after_semicolon=true +nl_after_brace_open=false +nl_after_brace_open_cmt=false +nl_after_vbrace_open=false +nl_after_brace_close=false +nl_define_macro=false +nl_squeeze_ifdef=false +nl_ds_struct_enum_cmt=false +nl_ds_struct_enum_close_brace=false +nl_create_if_one_liner=false +nl_create_for_one_liner=false +nl_create_while_one_liner=false +ls_for_split_full=true +ls_func_split_full=true +nl_after_multiline_comment=false +eat_blanks_after_open_brace=true +eat_blanks_before_close_brace=true +mod_pawn_semicolon=false +mod_full_paren_if_bool=false +mod_remove_extra_semicolon=true +mod_sort_import=false +mod_sort_using=false +mod_sort_include=false +mod_move_case_break=false +mod_remove_empty_return=false +cmt_indent_multi=true +cmt_c_group=false +cmt_c_nl_start=false +cmt_c_nl_end=false +cmt_cpp_group=false +cmt_cpp_nl_start=false +cmt_cpp_nl_end=false +cmt_cpp_to_c=false +cmt_star_cont=true +cmt_multi_check_last=true +cmt_insert_before_preproc=false +pp_indent_at_level=false +pp_region_indent_code=false +pp_if_indent_code=false +pp_define_at_level=false +indent_columns=4 +indent_member=4 +indent_access_spec=-2 +code_width=80 +nl_max=2 +nl_before_access_spec=2 +cmt_width=80 +indent_with_tabs=0 +sp_arith=force +sp_assign=force +sp_enum_assign=force +sp_pp_concat=remove +sp_pp_stringify=remove +sp_bool=force +sp_compare=force +sp_paren_brace=force +sp_angle_paren=remove +sp_before_sparen=force +sp_inside_sparen=remove +sp_after_sparen=force +sp_sparen_brace=force +sp_before_semi=remove +sp_after_semi_for_empty=remove +sp_before_square=remove +sp_before_squares=remove +sp_inside_square=remove +sp_after_comma=force +sp_before_comma=remove +sp_after_class_colon=force +sp_before_class_colon=force +sp_before_case_colon=remove +sp_inside_braces=add +sp_inside_fparens=remove +sp_inside_fparen=remove +sp_func_call_paren=remove +sp_func_class_paren=remove +sp_else_brace=force +sp_brace_else=force +sp_catch_brace=force +sp_brace_catch=force +sp_try_brace=force +sp_before_dc=remove +sp_after_dc=remove +sp_not=remove +sp_inv=remove +sp_addr=remove +sp_member=remove +sp_deref=remove +sp_sign=remove +sp_incdec=remove +sp_cond_colon=force +sp_cond_question=force +sp_case_label=force +nl_assign_brace=remove +nl_if_brace=remove +nl_brace_else=remove +nl_elseif_brace=remove +nl_else_brace=remove +nl_else_if=remove +nl_try_brace=remove +nl_for_brace=remove +nl_catch_brace=remove +nl_brace_catch=remove +nl_while_brace=remove +nl_do_brace=remove +nl_brace_while=remove +nl_switch_brace=remove +nl_namespace_brace=remove +nl_class_brace=force +nl_fdef_brace=force +pos_class_comma=trail +pos_class_colon=trail +mod_full_brace_do=add +mod_full_brace_for=add +mod_full_brace_if=add +mod_full_brace_while=add diff --git a/uncrustify.sh b/uncrustify.sh new file mode 100755 index 0000000..49ad3cf --- /dev/null +++ b/uncrustify.sh @@ -0,0 +1 @@ +uncrustify -c uncrustify.cfg --no-backup `find . -regex "\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v "orm.h\|orm_generator.h\|3rdparty\|examples"` -- 2.7.4