From 9ddd5fea6278d06b8874988498c7c4c6508750ba Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 4 Feb 2021 14:12:27 +0000 Subject: [PATCH] Updated all header files to new format Change-Id: I68b3cf032fa1758fff92509f463101bdfd36cce1 --- dali-scene-loader/internal/gltf2-asset.h | 219 ++++----- dali-scene-loader/internal/hash.h | 18 +- dali-scene-loader/internal/json-reader.h | 143 +++--- dali-scene-loader/internal/json-util.h | 13 +- .../public-api/alpha-function-helper.h | 9 +- dali-scene-loader/public-api/animated-property.h | 17 +- .../public-api/animation-definition.h | 21 +- dali-scene-loader/public-api/api.h | 8 +- dali-scene-loader/public-api/blend-shape-details.h | 25 +- dali-scene-loader/public-api/camera-parameters.h | 22 +- dali-scene-loader/public-api/customization.h | 19 +- dali-scene-loader/public-api/dli-loader.h | 26 +- .../public-api/environment-definition.h | 19 +- dali-scene-loader/public-api/gltf2-loader.h | 8 +- dali-scene-loader/public-api/index.h | 7 +- dali-scene-loader/public-api/ktx-loader.h | 9 +- dali-scene-loader/public-api/light-parameters.h | 17 +- dali-scene-loader/public-api/load-result.h | 11 +- dali-scene-loader/public-api/material-definition.h | 76 ++-- dali-scene-loader/public-api/matrix-stack.h | 17 +- dali-scene-loader/public-api/mesh-definition.h | 103 ++--- dali-scene-loader/public-api/mesh-geometry.h | 13 +- dali-scene-loader/public-api/node-definition.h | 77 ++-- .../public-api/parse-renderer-state.h | 9 +- dali-scene-loader/public-api/renderer-state.h | 65 ++- dali-scene-loader/public-api/resource-bundle.h | 31 +- dali-scene-loader/public-api/scene-definition.h | 54 +-- .../public-api/shader-definition-factory.h | 9 +- dali-scene-loader/public-api/shader-definition.h | 13 +- dali-scene-loader/public-api/skeleton-definition.h | 11 +- dali-scene-loader/public-api/skinning-details.h | 8 +- dali-scene-loader/public-api/string-callback.h | 7 +- dali-scene-loader/public-api/utils.h | 65 ++- dali-scene-loader/public-api/view-projection.h | 37 +- dali-scene-loader/third-party/.clang-format | 5 + dali-toolkit/devel-api/controls/control-devel.h | 68 +-- .../controls/web-view/web-back-forward-list-item.h | 5 +- .../controls/web-view/web-back-forward-list.h | 8 +- .../devel-api/controls/web-view/web-context.h | 22 +- .../controls/web-view/web-cookie-manager.h | 15 +- .../devel-api/controls/web-view/web-settings.h | 23 +- .../devel-api/controls/web-view/web-view.h | 45 +- dali-toolkit/devel-api/layouting/flex-node.h | 4 +- .../devel-api/shader-effects/dissolve-effect.h | 6 +- .../devel-api/shader-effects/motion-blur-effect.h | 2 +- .../shader-effects/motion-stretch-effect.h | 2 +- dali-toolkit/devel-api/text/text-utils-devel.h | 4 +- .../accessibility-manager-impl.h | 19 +- .../internal/builder/builder-declarations.h | 32 +- dali-toolkit/internal/builder/builder-filesystem.h | 14 +- dali-toolkit/internal/builder/builder-get-is.inl.h | 191 ++++---- dali-toolkit/internal/builder/builder-impl-debug.h | 55 ++- dali-toolkit/internal/builder/builder-impl.h | 235 +++++----- .../internal/builder/builder-set-property.h | 34 +- dali-toolkit/internal/builder/dictionary.h | 32 +- dali-toolkit/internal/builder/json-parser-impl.h | 39 +- dali-toolkit/internal/builder/json-parser-state.h | 74 +-- dali-toolkit/internal/builder/optional-value.h | 111 +++-- dali-toolkit/internal/builder/replacement.h | 65 ++- dali-toolkit/internal/builder/style.h | 48 +- .../internal/builder/tree-node-manipulator.h | 45 +- .../internal/controls/alignment/alignment-impl.h | 37 +- .../internal/controls/bloom-view/bloom-view-impl.h | 87 ++-- .../controls/bubble-effect/bubble-effect.h | 15 +- .../controls/bubble-effect/bubble-emitter-impl.h | 92 ++-- .../controls/bubble-effect/bubble-renderer.h | 27 +- .../controls/bubble-effect/color-adjuster.h | 17 +- .../internal/controls/buttons/button-impl.h | 174 ++++--- .../controls/buttons/check-box-button-impl.h | 29 +- .../internal/controls/buttons/push-button-impl.h | 38 +- .../internal/controls/buttons/radio-button-impl.h | 21 +- .../internal/controls/buttons/toggle-button-impl.h | 65 ++- .../internal/controls/control/control-data-impl.h | 283 ++++++------ .../internal/controls/control/control-debug.h | 13 +- .../internal/controls/control/control-renderers.h | 13 +- .../controls/effects-view/effects-view-impl.h | 70 ++- .../controls/flex-container/flex-container-impl.h | 57 +-- .../gaussian-blur-view/gaussian-blur-view-impl.h | 78 ++-- .../internal/controls/image-view/image-view-impl.h | 53 +-- .../internal/controls/magnifier/magnifier-impl.h | 34 +- .../controls/model3d-view/model3d-view-impl.h | 48 +- .../internal/controls/model3d-view/obj-loader.h | 105 ++--- .../navigation-view/navigation-view-impl.h | 33 +- .../page-turn-view/page-turn-book-spine-effect.h | 13 +- .../controls/page-turn-view/page-turn-effect.h | 8 +- .../page-turn-view/page-turn-landscape-view-impl.h | 21 +- .../page-turn-view/page-turn-portrait-view-impl.h | 27 +- .../controls/page-turn-view/page-turn-view-impl.h | 203 ++++----- .../controls/popup/confirmation-popup-impl.h | 53 +-- dali-toolkit/internal/controls/popup/popup-impl.h | 177 ++++---- .../controls/progress-bar/progress-bar-impl.h | 99 ++-- .../internal/controls/scene3d-view/gltf-loader.h | 224 +++++---- .../controls/scene3d-view/scene3d-view-impl.h | 88 ++-- .../internal/controls/scroll-bar/scroll-bar-impl.h | 132 +++--- .../controls/scrollable/bouncing-effect-actor.h | 8 +- .../controls/scrollable/item-view/depth-layout.h | 22 +- .../controls/scrollable/item-view/grid-layout.h | 21 +- .../controls/scrollable/item-view/item-view-impl.h | 114 +++-- .../controls/scrollable/item-view/spiral-layout.h | 21 +- .../scrollable/scroll-view/scroll-base-impl.h | 51 +-- .../scroll-view/scroll-overshoot-indicator-impl.h | 68 +-- .../scroll-view/scroll-view-effect-impl.h | 16 +- .../scrollable/scroll-view/scroll-view-impl.h | 211 ++++----- .../scroll-view-page-path-effect-impl.h | 31 +- .../internal/controls/scrollable/scrollable-impl.h | 47 +- .../controls/shadow-view/shadow-view-impl.h | 62 ++- .../internal/controls/slider/slider-impl.h | 207 ++++----- .../super-blur-view/super-blur-view-impl.h | 52 +-- .../internal/controls/table-view/array-2d.h | 109 +++-- .../internal/controls/table-view/table-view-impl.h | 186 ++++---- .../controls/text-controls/text-editor-impl.h | 150 +++--- .../controls/text-controls/text-field-impl.h | 141 +++--- .../controls/text-controls/text-label-impl.h | 69 ++- .../text-controls/text-selection-popup-impl.h | 152 +++---- .../text-controls/text-selection-toolbar-impl.h | 72 ++- .../internal/controls/tool-bar/tool-bar-impl.h | 33 +- dali-toolkit/internal/controls/tooltip/tooltip.h | 63 ++- .../internal/controls/video-view/video-view-impl.h | 115 +++-- .../internal/controls/web-view/web-view-impl.h | 115 +++-- .../drag-and-drop-detector-impl.h | 40 +- dali-toolkit/internal/feedback/feedback-ids.h | 72 ++- dali-toolkit/internal/feedback/feedback-style.h | 27 +- .../internal/filters/blur-two-pass-filter.h | 39 +- dali-toolkit/internal/filters/emboss-filter.h | 33 +- dali-toolkit/internal/filters/image-filter.h | 48 +- dali-toolkit/internal/filters/spread-filter.h | 28 +- .../focus-manager/keyboard-focus-manager-impl.h | 70 ++- .../focus-manager/keyinput-focus-manager-impl.h | 22 +- dali-toolkit/internal/helpers/color-conversion.h | 17 +- dali-toolkit/internal/helpers/property-helper.h | 10 +- .../internal/helpers/round-robin-container-view.h | 16 +- .../image-loader/async-image-loader-impl.h | 51 +-- dali-toolkit/internal/image-loader/atlas-packer.h | 52 +-- .../internal/image-loader/image-atlas-impl.h | 82 ++-- .../internal/image-loader/image-load-thread.h | 115 +++-- dali-toolkit/internal/styling/style-manager-impl.h | 78 ++-- .../internal/text/bidirectional-line-info-run.h | 9 +- .../text/bidirectional-paragraph-info-run.h | 11 +- dali-toolkit/internal/text/bidirectional-support.h | 57 ++- dali-toolkit/internal/text/character-run.h | 23 +- .../internal/text/character-set-conversion.h | 17 +- dali-toolkit/internal/text/color-run.h | 5 +- dali-toolkit/internal/text/color-segmentation.h | 21 +- .../internal/text/cursor-helper-functions.h | 77 ++-- .../internal/text/decorator/text-decorator.h | 125 +++-- dali-toolkit/internal/text/embedded-item.h | 5 +- dali-toolkit/internal/text/font-description-run.h | 91 ++-- dali-toolkit/internal/text/font-run.h | 13 +- dali-toolkit/internal/text/glyph-metrics-helper.h | 39 +- dali-toolkit/internal/text/glyph-run.h | 5 +- dali-toolkit/internal/text/hidden-text.h | 30 +- dali-toolkit/internal/text/input-style.h | 201 ++++---- dali-toolkit/internal/text/layouts/layout-engine.h | 51 +-- .../internal/text/layouts/layout-parameters.h | 55 ++- dali-toolkit/internal/text/line-run.h | 7 +- dali-toolkit/internal/text/logical-model-impl.h | 43 +- .../internal/text/markup-processor-color.h | 7 +- .../internal/text/markup-processor-embedded-item.h | 7 +- dali-toolkit/internal/text/markup-processor-font.h | 7 +- .../text/markup-processor-helper-functions.h | 53 +-- dali-toolkit/internal/text/markup-processor.h | 20 +- dali-toolkit/internal/text/metrics.h | 44 +- .../text/multi-language-helper-functions.h | 25 +- .../internal/text/multi-language-support-impl.h | 69 ++- .../internal/text/multi-language-support.h | 37 +- dali-toolkit/internal/text/paragraph-run.h | 9 +- .../internal/text/property-string-parser.h | 9 +- .../rendering/atlas/atlas-glyph-manager-impl.h | 68 ++- .../text/rendering/atlas/atlas-glyph-manager.h | 75 ++- .../text/rendering/atlas/atlas-manager-impl.h | 111 +++-- .../internal/text/rendering/atlas/atlas-manager.h | 100 ++-- .../text/rendering/atlas/atlas-mesh-factory.h | 27 +- .../text/rendering/atlas/text-atlas-renderer.h | 23 +- .../internal/text/rendering/text-backend-impl.h | 19 +- .../internal/text/rendering/text-backend.h | 15 +- .../internal/text/rendering/text-renderer.h | 22 +- .../internal/text/rendering/text-typesetter.h | 56 +-- .../glyphy-shader/glyphy-common-glsl.h | 460 ++++++++++--------- .../vector-based/glyphy-shader/glyphy-sdf-glsl.h | 303 ++++++------- .../vector-based/glyphy-shader/glyphy-shader.h | 12 +- .../rendering/vector-based/vector-based-renderer.h | 23 +- .../vector-based/vector-blob-atlas-share.h | 10 +- .../rendering/vector-based/vector-blob-atlas.h | 56 +-- dali-toolkit/internal/text/rendering/view-model.h | 15 +- dali-toolkit/internal/text/script-run.h | 9 +- dali-toolkit/internal/text/segmentation.h | 21 +- dali-toolkit/internal/text/shaper.h | 27 +- .../internal/text/text-control-interface.h | 9 +- .../internal/text/text-controller-event-handler.h | 13 +- .../text/text-controller-impl-event-handler.h | 8 +- dali-toolkit/internal/text/text-controller-impl.h | 500 ++++++++++---------- .../text/text-controller-input-font-handler.h | 29 +- .../text/text-controller-placeholder-handler.h | 47 +- .../internal/text/text-controller-relayouter.h | 7 +- .../internal/text/text-controller-text-updater.h | 6 +- dali-toolkit/internal/text/text-controller.h | 307 ++++++------- dali-toolkit/internal/text/text-definitions.h | 23 +- .../text/text-editable-control-interface.h | 21 +- dali-toolkit/internal/text/text-effects-style.h | 76 ++-- .../internal/text/text-enumerations-impl.h | 15 +- dali-toolkit/internal/text/text-font-style.h | 105 ++--- dali-toolkit/internal/text/text-io.h | 15 +- dali-toolkit/internal/text/text-model-interface.h | 15 +- dali-toolkit/internal/text/text-model.h | 42 +- dali-toolkit/internal/text/text-run-container.h | 188 ++++---- .../internal/text/text-scroller-interface.h | 9 +- dali-toolkit/internal/text/text-scroller.h | 61 ++- .../text/text-selectable-control-interface.h | 12 +- .../text/text-selection-handle-controller.h | 7 +- .../internal/text/text-vertical-scroller.h | 21 +- dali-toolkit/internal/text/text-view-interface.h | 23 +- dali-toolkit/internal/text/text-view.h | 30 +- dali-toolkit/internal/text/visual-model-impl.h | 141 +++--- dali-toolkit/internal/text/xhtml-entities.h | 6 +- .../cube-transition-cross-effect-impl.h | 44 +- .../cube-transition-effect-impl.h | 102 ++--- .../cube-transition-fold-effect-impl.h | 39 +- .../cube-transition-wave-effect-impl.h | 42 +- .../animated-gradient/animated-gradient-visual.h | 73 ++- .../visuals/animated-image/animated-image-visual.h | 96 ++-- .../visuals/animated-image/fixed-image-cache.h | 31 +- .../internal/visuals/animated-image/image-cache.h | 34 +- .../animated-image/rolling-animated-image-cache.h | 63 ++- .../visuals/animated-image/rolling-image-cache.h | 37 +- .../animated-vector-image-visual.h | 87 ++-- .../vector-animation-manager.h | 34 +- .../animated-vector-image/vector-animation-task.h | 138 +++--- .../vector-animation-thread.h | 84 ++-- .../vector-rasterize-thread.h | 35 +- dali-toolkit/internal/visuals/arc/arc-visual.h | 52 +-- .../internal/visuals/border/border-visual.h | 29 +- dali-toolkit/internal/visuals/color/color-visual.h | 32 +- .../internal/visuals/gradient/gradient-visual.h | 37 +- dali-toolkit/internal/visuals/gradient/gradient.h | 31 +- .../internal/visuals/gradient/linear-gradient.h | 14 +- .../internal/visuals/gradient/radial-gradient.h | 14 +- .../internal/visuals/image-atlas-manager.h | 43 +- .../internal/visuals/image-visual-shader-factory.h | 11 +- dali-toolkit/internal/visuals/image/image-visual.h | 116 +++-- dali-toolkit/internal/visuals/mesh/mesh-visual.h | 51 +-- dali-toolkit/internal/visuals/npatch-data.h | 27 +- dali-toolkit/internal/visuals/npatch-loader.h | 33 +- .../internal/visuals/npatch/npatch-visual.h | 40 +- .../internal/visuals/primitive/primitive-visual.h | 104 ++--- dali-toolkit/internal/visuals/rendering-addon.h | 34 +- .../internal/visuals/svg/svg-rasterize-thread.h | 77 ++-- dali-toolkit/internal/visuals/svg/svg-visual.h | 43 +- dali-toolkit/internal/visuals/text/text-visual.h | 135 +++--- .../internal/visuals/texture-manager-impl.h | 505 ++++++++++----------- .../internal/visuals/texture-upload-observer.h | 18 +- .../internal/visuals/transition-data-impl.h | 59 ++- .../internal/visuals/visual-base-data-impl.h | 80 ++-- dali-toolkit/internal/visuals/visual-base-impl.h | 111 +++-- .../internal/visuals/visual-event-observer.h | 21 +- .../internal/visuals/visual-factory-cache.h | 45 +- .../internal/visuals/visual-factory-impl.h | 59 ++- .../internal/visuals/visual-string-constants.h | 215 +++++---- dali-toolkit/internal/visuals/visual-url.h | 19 +- .../internal/visuals/wireframe/wireframe-visual.h | 36 +- dali-toolkit/public-api/controls/control.h | 3 +- 260 files changed, 7024 insertions(+), 8148 deletions(-) create mode 100644 dali-scene-loader/third-party/.clang-format mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-context.h mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-settings.h mode change 100755 => 100644 dali-toolkit/devel-api/controls/web-view/web-view.h mode change 100755 => 100644 dali-toolkit/devel-api/text/text-utils-devel.h mode change 100755 => 100644 dali-toolkit/internal/builder/builder-filesystem.h mode change 100755 => 100644 dali-toolkit/internal/controls/control/control-data-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/flex-container/flex-container-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/scrollable/item-view/depth-layout.h mode change 100755 => 100644 dali-toolkit/internal/controls/scrollable/item-view/grid-layout.h mode change 100755 => 100644 dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.h mode change 100755 => 100644 dali-toolkit/internal/controls/table-view/table-view-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/text-controls/text-editor-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/text-controls/text-field-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/video-view/video-view-impl.h mode change 100755 => 100644 dali-toolkit/internal/controls/web-view/web-view-impl.h mode change 100755 => 100644 dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.h mode change 100755 => 100644 dali-toolkit/internal/text/bidirectional-support.h mode change 100755 => 100644 dali-toolkit/internal/text/embedded-item.h mode change 100755 => 100644 dali-toolkit/internal/text/layouts/layout-engine.h mode change 100755 => 100644 dali-toolkit/internal/text/layouts/layout-parameters.h mode change 100755 => 100644 dali-toolkit/internal/text/logical-model-impl.h mode change 100755 => 100644 dali-toolkit/internal/text/markup-processor-embedded-item.h mode change 100755 => 100644 dali-toolkit/internal/text/markup-processor-helper-functions.h mode change 100755 => 100644 dali-toolkit/internal/text/markup-processor.h mode change 100755 => 100644 dali-toolkit/internal/text/metrics.h mode change 100755 => 100644 dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager-impl.h mode change 100755 => 100644 dali-toolkit/internal/text/rendering/view-model.h mode change 100755 => 100644 dali-toolkit/internal/text/script-run.h mode change 100755 => 100644 dali-toolkit/internal/text/text-controller-impl.h mode change 100755 => 100644 dali-toolkit/internal/text/text-definitions.h mode change 100755 => 100644 dali-toolkit/internal/text/text-effects-style.h mode change 100755 => 100644 dali-toolkit/internal/text/text-model-interface.h mode change 100755 => 100644 dali-toolkit/internal/text/text-model.h mode change 100755 => 100644 dali-toolkit/internal/text/text-view-interface.h mode change 100755 => 100644 dali-toolkit/internal/text/text-view.h mode change 100755 => 100644 dali-toolkit/internal/text/visual-model-impl.h mode change 100755 => 100644 dali-toolkit/internal/text/xhtml-entities.h mode change 100755 => 100644 dali-toolkit/internal/visuals/animated-gradient/animated-gradient-visual.h mode change 100755 => 100644 dali-toolkit/internal/visuals/text/text-visual.h diff --git a/dali-scene-loader/internal/gltf2-asset.h b/dali-scene-loader/internal/gltf2-asset.h index 79a72db..1ec67e2 100644 --- a/dali-scene-loader/internal/gltf2-asset.h +++ b/dali-scene-loader/internal/gltf2-asset.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_GLTF2_ASSET_H_ #define DALI_SCENE_LOADER_GLTF2_ASSET_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,23 +18,22 @@ */ // INTERNAL INCLUDES -#include "dali-scene-loader/public-api/index.h" #include "dali-scene-loader/internal/json-reader.h" +#include "dali-scene-loader/public-api/index.h" // EXTERNAL INCLUDES -#include "dali/public-api/math/vector4.h" -#include "dali/public-api/math/quaternion.h" -#include "dali/public-api/common/vector-wrapper.h" -#include "dali/devel-api/common/map-wrapper.h" #include #include +#include "dali/devel-api/common/map-wrapper.h" +#include "dali/public-api/common/vector-wrapper.h" +#include "dali/public-api/math/quaternion.h" +#include "dali/public-api/math/vector4.h" namespace gltf2 { - using Index = Dali::SceneLoader::Index; -template +template class Ref { public: @@ -42,14 +41,18 @@ public: Ref(std::vector& v, Index i) : mVector(&v), mIndex(i) - {} + { + } /** * @return The index of the object into the vector. * @note It is client code responsibility to ensure that the vector is unambiguous. It should be in * a glTF document, since there's one vector for each type. */ - Index GetIndex() const { return mIndex; } + Index GetIndex() const + { + return mIndex; + } /** * @brief There may be scenarios in which the object, whose vector we're populating, changes, e.g. @@ -60,9 +63,18 @@ public: mVector = &v; } - operator bool() const { return mVector != nullptr; } - T* operator->() const { return &(*mVector)[mIndex]; } - T& operator*() const { return (*mVector)[mIndex]; } + operator bool() const + { + return mVector != nullptr; + } + T* operator->() const + { + return &(*mVector)[mIndex]; + } + T& operator*() const + { + return (*mVector)[mIndex]; + } bool operator==(const Ref& other) const { @@ -76,7 +88,7 @@ public: private: std::vector* mVector = nullptr; - Index mIndex = Dali::SceneLoader::INVALID_INDEX; + Index mIndex = Dali::SceneLoader::INVALID_INDEX; }; struct Asset @@ -88,16 +100,16 @@ struct Component { enum Type { - BYTE = 5120, - UNSIGNED_BYTE = 5121, - SHORT = 5122, + BYTE = 5120, + UNSIGNED_BYTE = 5121, + SHORT = 5122, UNSIGNED_SHORT = 5123, - UNSIGNED_INT = 5125, - FLOAT = 5126, - INVALID = -1 + UNSIGNED_INT = 5125, + FLOAT = 5126, + INVALID = -1 }; - static bool IsUnsigned(Type t); + static bool IsUnsigned(Type t); static uint32_t Size(Type t); Component() = delete; @@ -161,7 +173,7 @@ struct Attribute struct Buffer { - uint32_t mByteLength; + uint32_t mByteLength; std::string_view mUri; //TODO: extensions //TODO: extras @@ -174,7 +186,7 @@ struct BufferView enum Type { NONE, - ARRAY_BUFFER = 34962, + ARRAY_BUFFER = 34962, ELEMENT_ARRAY_BUFFER = 34963 }; @@ -182,10 +194,10 @@ struct BufferView }; Ref mBuffer; - uint32_t mByteOffset = 0; - uint32_t mByteLength; - uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated - uint32_t mTarget; + uint32_t mByteOffset = 0; + uint32_t mByteLength; + uint32_t mByteStride = 0; // if 0 after reading, it needs to be calculated + uint32_t mTarget; //TODO: extensions //TODO: extras }; @@ -193,7 +205,7 @@ struct BufferView struct BufferViewClient { Ref mBufferView; - uint32_t mByteOffset = 0; + uint32_t mByteOffset = 0; }; struct ComponentTypedBufferViewClient : BufferViewClient @@ -215,18 +227,18 @@ struct Accessor : ComponentTypedBufferViewClient, Named { struct Sparse { - uint32_t mCount; + uint32_t mCount; ComponentTypedBufferViewClient mIndices; - BufferViewClient mValues; + BufferViewClient mValues; //TODO: extensions //TODO: extras }; - uint32_t mCount; - bool mNormalized = false; - AccessorType::Type mType = AccessorType::INVALID; - std::vector mMin; - std::vector mMax; + uint32_t mCount; + bool mNormalized = false; + AccessorType::Type mType = AccessorType::INVALID; + std::vector mMin; + std::vector mMax; std::unique_ptr mSparse; //TODO: extensions //TODO: extras @@ -247,11 +259,11 @@ struct Accessor : ComponentTypedBufferViewClient, Named } }; -struct Image: Named +struct Image : Named { std::string_view mUri; std::string_view mMimeType; - Ref mBufferView; + Ref mBufferView; //TODO: extensions //TODO: extras }; @@ -260,12 +272,12 @@ struct Filter { enum Type { - NEAREST = 9728, - LINEAR = 9729, + NEAREST = 9728, + LINEAR = 9729, NEAREST_MIPMAP_NEAREST = 9984, - NEAREST_MIPMAP_LINEAR = 9985, - LINEAR_MIPMAP_NEAREST = 9986, - LINEAR_MIPMAP_LINEAR = 9987, + NEAREST_MIPMAP_LINEAR = 9985, + LINEAR_MIPMAP_NEAREST = 9986, + LINEAR_MIPMAP_LINEAR = 9987, }; Filter() = delete; @@ -275,8 +287,8 @@ struct Wrap { enum Type { - REPEAT = 10497, - CLAMP_TO_EDGE = 33071, + REPEAT = 10497, + CLAMP_TO_EDGE = 33071, MIRRORED_REPEAT = 33648, }; @@ -287,23 +299,23 @@ struct Sampler { Filter::Type mMinFilter = Filter::LINEAR; Filter::Type mMagFilter = Filter::LINEAR; - Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE; - Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE; + Wrap::Type mWrapS = Wrap::CLAMP_TO_EDGE; + Wrap::Type mWrapT = Wrap::CLAMP_TO_EDGE; //TODO: extensions //TODO: extras }; struct Texture { - Ref mSource; + Ref mSource; Ref mSampler; }; struct TextureInfo { Ref mTexture; - uint32_t mTexCoord = 0; - float mScale = 1.f; + uint32_t mTexCoord = 0; + float mScale = 1.f; operator bool() const { @@ -311,32 +323,32 @@ struct TextureInfo } }; -struct Material: Named +struct Material : Named { - struct Pbr//MetallicRoughness + struct Pbr //MetallicRoughness { Dali::Vector4 mBaseColorFactor = Dali::Vector4::ONE; - TextureInfo mBaseColorTexture; - float mMetallicFactor = 1.f; - float mRoughnessFactor = 1.f; - TextureInfo mMetallicRoughnessTexture; + TextureInfo mBaseColorTexture; + float mMetallicFactor = 1.f; + float mRoughnessFactor = 1.f; + TextureInfo mMetallicRoughnessTexture; //TODO: extensions //TODO: extras }; - Pbr mPbrMetallicRoughness; - TextureInfo mNormalTexture; - TextureInfo mOcclusionTexture; - TextureInfo mEmissiveTexture; - Dali::Vector3 mEmissiveFactor; - AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE; - float mAlphaCutoff = .5f; - bool mDoubleSided = false; + Pbr mPbrMetallicRoughness; + TextureInfo mNormalTexture; + TextureInfo mOcclusionTexture; + TextureInfo mEmissiveTexture; + Dali::Vector3 mEmissiveFactor; + AlphaMode::Type mAlphaMode = AlphaMode::OPAQUE; + float mAlphaCutoff = .5f; + bool mDoubleSided = false; //TODO: extensions //TODO: extras }; -struct Mesh: Named +struct Mesh : Named { struct Primitive { @@ -352,11 +364,11 @@ struct Mesh: Named INVALID }; - std::map> mAttributes; + std::map> mAttributes; std::vector>> mTargets; - Ref mIndices; - Ref mMaterial; - Mode mMode = TRIANGLES; + Ref mIndices; + Ref mMaterial; + Mode mMode = TRIANGLES; //TODO: [morph] targets //TODO: extras @@ -364,7 +376,7 @@ struct Mesh: Named }; std::vector mPrimitives; - std::vector mWeights; + std::vector mWeights; //TODO: extras //TODO: extensions }; @@ -373,14 +385,14 @@ struct Node; struct Skin : Named { - Ref mInverseBindMatrices; - Ref mSkeleton; + Ref mInverseBindMatrices; + Ref mSkeleton; std::vector> mJoints; //TODO: extras //TODO: extensions }; -struct Camera: Named +struct Camera : Named { struct Perspective { @@ -403,21 +415,21 @@ struct Camera: Named }; std::string_view mType; - Perspective mPerspective; - Orthographic mOrthographic; + Perspective mPerspective; + Orthographic mOrthographic; //TODO: extras //TODO: extensions }; -struct Node: Named +struct Node : Named { - Dali::Vector3 mTranslation = Dali::Vector3::ZERO; - Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY; - Dali::Vector3 mScale = Dali::Vector3::ONE; + Dali::Vector3 mTranslation = Dali::Vector3::ZERO; + Dali::Quaternion mRotation = Dali::Quaternion::IDENTITY; + Dali::Vector3 mScale = Dali::Vector3::ONE; - Ref mCamera; + Ref mCamera; std::vector> mChildren; - Ref mMesh; + Ref mMesh; Ref mSkin; //TODO: [morph] weights @@ -443,8 +455,8 @@ struct Animation : Named static Type FromString(const char* s, size_t len); }; - Ref mInput; - Ref mOutput; + Ref mInput; + Ref mOutput; Interpolation::Type mInterpolation; //TODO: extras @@ -467,11 +479,11 @@ struct Animation : Named static Type FromString(const char* s, size_t len); Ref mNode; - Type mPath; + Type mPath; }; Ref mSampler; - Target mTarget; + Target mTarget; //TODO: extras //TODO: extensions }; @@ -480,7 +492,7 @@ struct Animation : Named std::vector mChannels; }; -struct Scene: Named +struct Scene : Named { std::vector> mNodes; }; @@ -489,29 +501,29 @@ struct Document { Asset mAsset; - std::vector mBuffers; + std::vector mBuffers; std::vector mBufferViews; - std::vector mAccessors; + std::vector mAccessors; - std::vector mImages; - std::vector mSamplers; - std::vector mTextures; + std::vector mImages; + std::vector mSamplers; + std::vector mTextures; std::vector mMaterials; std::vector mMeshes; std::vector mSkins; std::vector mCameras; - std::vector mNodes; + std::vector mNodes; std::vector mAnimations; std::vector mScenes; - Ref mScene; + Ref mScene; - Document() = default; + Document() = default; Document(const Document&) = delete; - Document(Document&&) = default; + Document(Document&&) = default; Document& operator=(const Document&) = delete; Document& operator=(Document&&) = default; @@ -521,12 +533,12 @@ struct Document * @brief Provides a json::Property::ReadFn for interpreting unsigned integers * as a Ref into a std::vector data member of a type T. */ -template +template struct RefReader { static T* sObject; - template T::* V> + template T::*V> static Ref Read(const json_value_s& j) { uint32_t index = json::Read::Number(j); @@ -534,13 +546,13 @@ struct RefReader } }; -template +template T* RefReader::sObject = nullptr; /** * @brief Convenience method to set the object for RefReader. */ -template +template void SetRefReaderObject(T& object) { RefReader::sObject = &object; @@ -551,7 +563,7 @@ void SetRefReaderObject(T& object) * @note The enum must: 1, be called Type, nested to T, 2, provide a FromString static method taking a const char* * (string data) and a size_t (string length) and returning T::Type. */ -template // T must have a nested enum called Type and a static Type FromString(const char*) method. +template // T must have a nested enum called Type and a static Type FromString(const char*) method. typename T::Type ReadStringEnum(const json_value_s& j) { auto str = json::Read::StringView(j); @@ -564,12 +576,11 @@ typename T::Type ReadStringEnum(const json_value_s& j) * @note T must provide an AsFloat() member method returning the non-const array of its * float components. */ -template -inline -T ReadDaliVector(const json_value_s& j) +template +inline T ReadDaliVector(const json_value_s& j) { std::vector floats = json::Read::Array>(j); - T result; + T result; std::copy(floats.begin(), std::min(floats.end(), floats.begin() + sizeof(T) / sizeof(float)), result.AsFloat()); return result; } @@ -580,6 +591,6 @@ T ReadDaliVector(const json_value_s& j) */ Dali::Quaternion ReadQuaternion(const json_value_s& j); -} +} // namespace gltf2 #endif //DALI_SCENE_LOADER_GLTF2_ASSET_H_ diff --git a/dali-scene-loader/internal/hash.h b/dali-scene-loader/internal/hash.h index 32c69da..22b770e 100644 --- a/dali-scene-loader/internal/hash.h +++ b/dali-scene-loader/internal/hash.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_HASH_H_ #define DALI_SCENE_LOADER_HASH_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,14 @@ * */ -#include -#include #include +#include +#include namespace Dali { namespace SceneLoader { - /** * @brief Rudimentary hash generator that follows a builder pattern. */ @@ -94,7 +93,7 @@ public: * @brief Applies the bytes of an object @a value, to the hash. * @return Its updated self. */ - template + template Hash& AddObjectBytes(const T& value); operator uint64_t() const; @@ -105,13 +104,12 @@ private: uint64_t Concatenate(uint64_t value); }; - template -Hash& Hash::AddObjectBytes(const T & value) +Hash& Hash::AddObjectBytes(const T& value) { auto i0 = reinterpret_cast(&value); auto i1 = i0 + sizeof(T); - while (i0 != i1) + while(i0 != i1) { mValue = Concatenate(*i0); ++i0; @@ -119,7 +117,7 @@ Hash& Hash::AddObjectBytes(const T & value) return *this; } -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_HASH_H_ diff --git a/dali-scene-loader/internal/json-reader.h b/dali-scene-loader/internal/json-reader.h index 2f769a7..4fb6f7a 100644 --- a/dali-scene-loader/internal/json-reader.h +++ b/dali-scene-loader/internal/json-reader.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_JSON_READER_H_ #define DALI_SCENE_LOADER_JSON_READER_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +21,16 @@ #include "dali-scene-loader/third-party/json.h" // EXTERNAL INCLUDES -#include "dali/public-api/common/vector-wrapper.h" #include -#include -#include -#include #include +#include #include +#include +#include +#include "dali/public-api/common/vector-wrapper.h" namespace json { - /** * @brief Helper for freeing the memory allocated by json_parse() */ @@ -60,9 +59,8 @@ int StrCmp(const json_string_s& js, const std::string& s); * @brief Convenience function to compare json_string_s and other supported string type, * in swapped order. */ -template -inline -int StrCmp(String& s, const json_string_s& js) +template +inline int StrCmp(String& s, const json_string_s& js) { return -StrCmp(js, s); } @@ -77,28 +75,33 @@ namespace detail /** * @brief Compile-time type-enum mapping. */ -template +template struct Type2Enum -{}; - -#define TYPE2ENUM(x) template<> struct Type2Enum\ -{\ - enum { VALUE = json_type_## x };\ +{ }; +#define TYPE2ENUM(x) \ + template<> \ + struct Type2Enum \ + { \ + enum \ + { \ + VALUE = json_type_##x \ + }; \ + }; + TYPE2ENUM(object) TYPE2ENUM(array) TYPE2ENUM(string) TYPE2ENUM(number) #undef TYPE2ENUM -} +} // namespace detail /** * @brief Casts the payload of a json_value_s to the given type. */ -template -inline -const Out& Cast(const json_value_s& j) +template +inline const Out& Cast(const json_value_s& j) { Validate(j, static_cast(detail::Type2Enum::type>::VALUE)); return *static_cast(j.payload); @@ -108,9 +111,8 @@ const Out& Cast(const json_value_s& j) * @brief Casts the payload of a json_value_s to the given type. * @note std::runtime_error is thrown if the value is not the given type. */ -template -inline -Out& Cast(json_value_s& j) +template +inline Out& Cast(json_value_s& j) { Validate(j, static_cast(detail::Type2Enum::type>::VALUE)); return *static_cast(j.payload); @@ -129,11 +131,11 @@ struct Read { static bool Boolean(const json_value_s& j) { - if (j.type == json_type_true) + if(j.type == json_type_true) { return true; } - else if (j.type == json_type_false) + else if(j.type == json_type_false) { return false; } @@ -143,25 +145,25 @@ struct Read } } - template + template static T Number(const json_value_s& j) { - auto& jn = Cast(j); + auto& jn = Cast(j); std::stringstream ss; - for (auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0) + for(auto i0 = jn.number, i1 = i0 + jn.number_size; i0 != i1; ++i0) { ss.put(*i0); } T result; - if (ss >> result) + if(ss >> result) { return result; } throw std::runtime_error("Failed to convert value to number"); } - template + template static E Enum(const json_value_s& j) { size_t number = Number(j); @@ -180,14 +182,14 @@ struct Read return std::string(js.string, js.string_size); } - template + template static std::vector Array(const json_value_s& j) { - auto& ja = Cast(j); + auto& ja = Cast(j); std::vector result; result.reserve(ja.length); auto i = ja.start; - while (i) + while(i) { result.push_back(std::move(readElement(*i->value))); i = i->next; @@ -204,9 +206,13 @@ struct PropertyCore protected: explicit PropertyCore(const std::string& key) : mKey(key) - {} + { + } - const std::string& GetKey() const { return mKey; } + const std::string& GetKey() const + { + return mKey; + } private: std::string mKey; @@ -215,17 +221,19 @@ private: /** * @brief Base class for the properties of a type T. */ -template +template struct PropertyBase : PropertyCore { using PropertyCore::GetKey; explicit PropertyBase(const std::string& key) : PropertyCore(key) - {} + { + } virtual ~PropertyBase() - {} + { + } virtual void Read(const json_value_s& j, T& obj) = 0; }; @@ -233,28 +241,31 @@ struct PropertyBase : PropertyCore /** * @brief Concrete property of an object to read into from JSON with a given function. */ -template +template struct Property : PropertyBase { - using ReadFn = U(*)(const json_value_s&); - using MemberPtr = U T::*; + using ReadFn = U (*)(const json_value_s&); + using MemberPtr = U T::*; using SetterArgType = typename std::conditional::type; - using Setter = void (T::*)(SetterArgType); + using Setter = void (T::*)(SetterArgType); Property(const std::string& key, ReadFn read, MemberPtr ptr) : PropertyBase(key), mRead(read), mAccessor(new DirectAccessor(ptr)) - {} + { + } Property(const std::string& key, ReadFn read, Setter setter) : PropertyBase(key), mRead(read), mAccessor(new SetterAccessor(setter)) - {} + { + } ~Property() - {} + { + } void Read(const json_value_s& j, T& obj) override { @@ -265,7 +276,8 @@ private: struct AccessorBase { virtual ~AccessorBase() - {} + { + } virtual void Set(U value, T& obj) const = 0; }; @@ -274,7 +286,8 @@ private: { DirectAccessor(MemberPtr ptr) : mPointer(ptr) - {} + { + } void Set(U value, T& obj) const override { @@ -288,7 +301,8 @@ private: { SetterAccessor(Setter setter) : mSetter(setter) - {} + { + } void Set(U value, T& obj) const override { @@ -298,16 +312,15 @@ private: Setter mSetter; }; - ReadFn mRead; + ReadFn mRead; std::unique_ptr mAccessor; }; /** * @brief Helper function to make a Property for a member of type U, of object of type T. */ -template -Property* MakeProperty(const std::string& key, typename Property::ReadFn readFn, - U T::* ptr) +template +Property* MakeProperty(const std::string& key, typename Property::ReadFn readFn, U T::*ptr) { return new Property(key, readFn, ptr); } @@ -333,7 +346,7 @@ protected: * @brief Object Reader template for reading into an object of a given type, * with properties registered for the various members. */ -template +template class Reader : protected ReaderCore { public: @@ -347,7 +360,7 @@ public: ~Reader() { - for (auto& p : mProperties) + for(auto& p : mProperties) { delete Cast(p); } @@ -355,9 +368,8 @@ public: Reader& Register(PropertyBase& prop) { - auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop, - SortPredicate); - if (iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey()) + auto iInsert = std::lower_bound(mProperties.begin(), mProperties.end(), &prop, SortPredicate); + if(iInsert == mProperties.end() || Cast(*iInsert)->GetKey() != prop.GetKey()) { mProperties.insert(iInsert, &prop); } @@ -372,14 +384,13 @@ public: void Read(const json_object_s& jo, T& obj) const { auto i = jo.start; - while (i) + while(i) { - auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(), - *i->name, FindPredicate); - if (iFind != mProperties.end()) + auto iFind = std::lower_bound(mProperties.begin(), mProperties.end(), *i->name, FindPredicate); + if(iFind != mProperties.end()) { auto prop = Cast(*iFind); - if (0 == StrCmp(*i->name, prop->GetKey())) + if(0 == StrCmp(*i->name, prop->GetKey())) { prop->Read(*i->value, obj); } @@ -411,29 +422,29 @@ private: * @brief Wraps a Reader in a function usable as a Property::ReadFn, i.e. to facilitate * deserializing structures of nested objects. */ -template +template struct ObjectReader { static const Reader* sReader; static T Read(const json_value_s& j) { - T result; + T result; auto& jo = Cast(j); sReader->Read(jo, result); return result; } }; -template +template const Reader* ObjectReader::sReader = nullptr; -template +template void SetObjectReader(const Reader& r) { ObjectReader::sReader = &r; } -} // json +} // namespace json #endif //DALI_SCENE_LOADER_JSON_READER_H_ diff --git a/dali-scene-loader/internal/json-util.h b/dali-scene-loader/internal/json-util.h index 64a99cd..9121bcd 100644 --- a/dali-scene-loader/internal/json-util.h +++ b/dali-scene-loader/internal/json-util.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_JSON_UTIL_H_ #define DALI_SCENE_LOADER_JSON_UTIL_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +21,16 @@ #include "dali-scene-loader/public-api/index.h" // EXTERNAL INCLUDES -#include "dali/public-api/common/vector-wrapper.h" +#include "dali-toolkit/devel-api/builder/tree-node.h" #include "dali/public-api/animation/time-period.h" -#include "dali/public-api/object/property.h" +#include "dali/public-api/common/vector-wrapper.h" #include "dali/public-api/math/vector4.h" -#include "dali-toolkit/devel-api/builder/tree-node.h" +#include "dali/public-api/object/property.h" namespace Dali { namespace SceneLoader { - bool ReadBool(const Toolkit::TreeNode* node, bool& num); bool ReadInt(const Toolkit::TreeNode* node, int& num); @@ -89,7 +88,7 @@ Property::Value ReadPropertyValue(const Property::Type& propType, const Toolkit: */ Property::Value ReadPropertyValue(const Toolkit::TreeNode& tn); -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_JSON_UTIL_H_ diff --git a/dali-scene-loader/public-api/alpha-function-helper.h b/dali-scene-loader/public-api/alpha-function-helper.h index 1a6c9ad..a524b81 100644 --- a/dali-scene-loader/public-api/alpha-function-helper.h +++ b/dali-scene-loader/public-api/alpha-function-helper.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_ #define DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ #include "dali-scene-loader/public-api/api.h" -#include "dali/public-api/animation/alpha-function.h" #include +#include "dali/public-api/animation/alpha-function.h" namespace Dali { namespace SceneLoader { - /** * @return Given a name, provide a AlphaFunction; if the name was not * recognised, get the default one. @@ -39,7 +38,7 @@ AlphaFunction DALI_SCENE_LOADER_API GetAlphaFunction(const std::string& name, bo */ void DALI_SCENE_LOADER_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false); -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_ diff --git a/dali-scene-loader/public-api/animated-property.h b/dali-scene-loader/public-api/animated-property.h index 026b68a..085b977 100644 --- a/dali-scene-loader/public-api/animated-property.h +++ b/dali-scene-loader/public-api/animated-property.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_ANIMATED_PROPERTY_H #define DALI_SCENE_LOADER_ANIMATED_PROPERTY_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +21,16 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES +#include +#include #include "dali/public-api/actors/actor.h" #include "dali/public-api/animation/animation.h" #include "dali/public-api/object/property.h" -#include -#include namespace Dali { namespace SceneLoader { - /** * @brief Intermediate representation for a property that's given to * a Animation to animate. Since there is no getting an @@ -78,20 +77,20 @@ public: // DATA struct Value { Property::Value mValue; - bool mIsRelative; + bool mIsRelative; }; std::string mNodeName; std::string mPropertyName; - KeyFrames mKeyFrames; + KeyFrames mKeyFrames; std::unique_ptr mValue; AlphaFunction mAlphaFunction = AlphaFunction::DEFAULT; - TimePeriod mTimePeriod = TimePeriod(0.f); + TimePeriod mTimePeriod = TimePeriod(0.f); }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_ANIMATED_PROPERTY_H diff --git a/dali-scene-loader/public-api/animation-definition.h b/dali-scene-loader/public-api/animation-definition.h index 41de471..ea0dcb9 100644 --- a/dali-scene-loader/public-api/animation-definition.h +++ b/dali-scene-loader/public-api/animation-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_ANIMATION_DEFINITION_H #define DALI_SCENE_LOADER_ANIMATION_DEFINITION_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,14 @@ * */ -#include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/animated-property.h" +#include "dali-scene-loader/public-api/api.h" #include "dali/public-api/common/vector-wrapper.h" namespace Dali { namespace SceneLoader { - /** * @brief Animation handle + name + definition of properties. */ @@ -66,23 +65,23 @@ public: // METHODS public: // DATA std::string mName; - float mDuration = DEFAULT_DURATION_SECONDS; - int mLoopCount = 1; + float mDuration = DEFAULT_DURATION_SECONDS; + int mLoopCount = 1; Animation::EndAction mDisconnectAction = Animation::BAKE_FINAL; - Animation::EndAction mEndAction = Animation::BAKE; - float mSpeedFactor = 1.f; - Vector2 mPlayRange = Vector2{ 0.f, 1.f }; + Animation::EndAction mEndAction = Animation::BAKE; + float mSpeedFactor = 1.f; + Vector2 mPlayRange = Vector2{0.f, 1.f}; std::vector mProperties; }; struct AnimationGroupDefinition { - std::string mName; + std::string mName; std::vector mAnimations; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_ANIMATION_DEFINITION_H diff --git a/dali-scene-loader/public-api/api.h b/dali-scene-loader/public-api/api.h index f5ffea0..45f4a1c 100644 --- a/dali-scene-loader/public-api/api.h +++ b/dali-scene-loader/public-api/api.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_API_H #define DALI_SCENE_LOADER_API_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,10 @@ #elif defined(WIN32) #ifdef BUILDING_DALI_SCENE_LOADER -#define DALI_SCENE_LOADER_API __declspec(dllexport) +#define DALI_SCENE_LOADER_API __declspec(dllexport) #else -#define DALI_SCENE_LOADER_API __declspec(dllimport) -#endif // BUILDING_DALI_SCENE_LOADER +#define DALI_SCENE_LOADER_API __declspec(dllimport) +#endif // BUILDING_DALI_SCENE_LOADER #endif diff --git a/dali-scene-loader/public-api/blend-shape-details.h b/dali-scene-loader/public-api/blend-shape-details.h index 67283a8..505fc5a 100644 --- a/dali-scene-loader/public-api/blend-shape-details.h +++ b/dali-scene-loader/public-api/blend-shape-details.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H #define DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,15 +21,14 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES -#include "dali/public-api/rendering/shader.h" -#include "dali/public-api/actors/actor.h" #include +#include "dali/public-api/actors/actor.h" +#include "dali/public-api/rendering/shader.h" namespace Dali { namespace SceneLoader { - struct MeshDefinition; struct MeshGeometry; @@ -47,21 +46,21 @@ struct DALI_SCENE_LOADER_API BlendShapes enum { POSITIONS = 0x1, - NORMALS = 0x2, - TANGENTS = 0x4 + NORMALS = 0x2, + TANGENTS = 0x4 }; }; // shader properties - animatable (uniforms) - static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded. - static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float. - static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next. + static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded. + static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float. + static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next. // shader properties - read-only (not available as uniforms) - static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum. + static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum. // actor property (instance) - animatable (uniforms) - static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array + static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array /** * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants, @@ -72,7 +71,7 @@ struct DALI_SCENE_LOADER_API BlendShapes BlendShapes() = delete; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H diff --git a/dali-scene-loader/public-api/camera-parameters.h b/dali-scene-loader/public-api/camera-parameters.h index 044c7f4..06370fc 100644 --- a/dali-scene-loader/public-api/camera-parameters.h +++ b/dali-scene-loader/public-api/camera-parameters.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_CAMERA_PARAMETERS_H #define DALI_SCENE_LOADER_CAMERA_PARAMETERS_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * */ - // INTERNAL INCLUDES +// INTERNAL INCLUDES #include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/view-projection.h" @@ -27,20 +27,18 @@ namespace Dali { - class CameraActor; namespace SceneLoader { - struct DALI_SCENE_LOADER_API CameraParameters { - Matrix matrix = Matrix::IDENTITY; - Vector4 orthographicSize = Vector4{ -1.f, 1.f, 1.f, -1.f }; - float yFov = 60.f; - float zNear = 0.1f; - float zFar = 1000.f; - bool isPerspective = true; + Matrix matrix = Matrix::IDENTITY; + Vector4 orthographicSize = Vector4{-1.f, 1.f, 1.f, -1.f}; + float yFov = 60.f; + float zNear = 0.1f; + float zFar = 1000.f; + bool isPerspective = true; /** * @return The view-projection matrix of the camera. @@ -61,7 +59,7 @@ struct DALI_SCENE_LOADER_API CameraParameters void ConfigureCamera(CameraActor& camera) const; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_CAMERA_PARAMETERS_H diff --git a/dali-scene-loader/public-api/customization.h b/dali-scene-loader/public-api/customization.h index ff29b95..cdac2fc 100644 --- a/dali-scene-loader/public-api/customization.h +++ b/dali-scene-loader/public-api/customization.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_ #define DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,18 @@ * */ - // INTERNAL INCLUDES +// INTERNAL INCLUDES #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES -#include "dali/public-api/common/vector-wrapper.h" -#include #include +#include +#include "dali/public-api/common/vector-wrapper.h" namespace Dali { namespace SceneLoader { - /** * @brief Offers a description of an aspect of the scene that can be customized: * the number of options, and the name of the nodes that are registered @@ -37,7 +36,7 @@ namespace SceneLoader */ struct DALI_SCENE_LOADER_API Customization { - using Tag = std::string; + using Tag = std::string; using OptionType = uint32_t; /** @@ -114,11 +113,11 @@ struct DALI_SCENE_LOADER_API Customization static const OptionType NONE = OptionType(-1); - OptionType numOptions = 0; - std::vector nodes; // to apply option to. + OptionType numOptions = 0; + std::vector nodes; // to apply option to. }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_ diff --git a/dali-scene-loader/public-api/dli-loader.h b/dali-scene-loader/public-api/dli-loader.h index e09d4d0..b46a7bf 100644 --- a/dali-scene-loader/public-api/dli-loader.h +++ b/dali-scene-loader/public-api/dli-loader.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_DLI_LOADER_H #define DALI_SCENE_LOADER_DLI_LOADER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,12 @@ * */ - // INTERNAL INCLUDES -#include "dali-scene-loader/public-api/api.h" +// INTERNAL INCLUDES #include "dali-scene-loader/public-api/animation-definition.h" +#include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/customization.h" -#include "dali-scene-loader/public-api/string-callback.h" #include "dali-scene-loader/public-api/index.h" +#include "dali-scene-loader/public-api/string-callback.h" // EXTERNAL INCLUDES #include "dali/public-api/common/vector-wrapper.h" @@ -46,17 +46,19 @@ class SceneDefinition; class DALI_SCENE_LOADER_API DliLoader { public: - using ConvertFontCode = void(*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size); - using ConvertColorCode = Vector4(*)(const std::string& code); + using ConvertFontCode = void (*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size); + using ConvertColorCode = Vector4 (*)(const std::string& code); - using CategoryProcessor = std::function; + using CategoryProcessor = std::function; using CategoryProcessorVector = std::vector>; using NodeProcessor = std::function; + Property::Map&& nodeData, + StringCallback onError)>; using AnimationProcessor = std::function; + Property::Map&& animData, + StringCallback onError)>; struct InputParams { @@ -105,7 +107,7 @@ public: struct LoadParams { InputParams const& input; - LoadResult& output; + LoadResult& output; }; DliLoader(); @@ -133,7 +135,7 @@ private: const std::unique_ptr mImpl; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_DLI_LOADER_H diff --git a/dali-scene-loader/public-api/environment-definition.h b/dali-scene-loader/public-api/environment-definition.h index 1b1906f..066f6fa 100644 --- a/dali-scene-loader/public-api/environment-definition.h +++ b/dali-scene-loader/public-api/environment-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H #define DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,18 @@ * */ - // INTERNAL INCLUDES +// INTERNAL INCLUDES #include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/ktx-loader.h" // EXTERNAL INCLUDES -#include "dali/public-api/rendering/texture.h" #include "dali/public-api/math/quaternion.h" +#include "dali/public-api/rendering/texture.h" namespace Dali { namespace SceneLoader { - /** * @brief Defines an environment map with either or both of radiance * and irradiance maps. @@ -39,7 +38,7 @@ struct DALI_SCENE_LOADER_API EnvironmentDefinition struct Textures { Texture mDiffuse; // irradiance - Texture mSpecular; // radiance + Texture mSpecular; // radiance bool IsLoaded() const { @@ -54,7 +53,7 @@ struct DALI_SCENE_LOADER_API EnvironmentDefinition }; using EnvironmentData = std::pair; - using Vector = std::vector; + using Vector = std::vector; EnvironmentDefinition() = default; @@ -80,11 +79,11 @@ struct DALI_SCENE_LOADER_API EnvironmentDefinition public: // DATA std::string mDiffuseMapPath; std::string mSpecularMapPath; - Quaternion mCubeOrientation = Quaternion::IDENTITY; - float mIblIntensity = 1.0f; + Quaternion mCubeOrientation = Quaternion::IDENTITY; + float mIblIntensity = 1.0f; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H diff --git a/dali-scene-loader/public-api/gltf2-loader.h b/dali-scene-loader/public-api/gltf2-loader.h index ce3ec79..9871ec0 100644 --- a/dali-scene-loader/public-api/gltf2-loader.h +++ b/dali-scene-loader/public-api/gltf2-loader.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_GLTF2_LOADER_H #define DALI_SCENE_LOADER_GLTF2_LOADER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ * */ - // INTERNAL INCLUDES +// INTERNAL INCLUDES #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES @@ -38,7 +38,7 @@ class ShaderDefinitionFactory; */ DALI_SCENE_LOADER_API void LoadGltfScene(const std::string& url, ShaderDefinitionFactory& shaderFactory, LoadResult& params); -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_GLTF2_LOADER_H diff --git a/dali-scene-loader/public-api/index.h b/dali-scene-loader/public-api/index.h index 278f19a..9ad5fc2 100644 --- a/dali-scene-loader/public-api/index.h +++ b/dali-scene-loader/public-api/index.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_INDEX_H_ #define DALI_SCENE_LOADER_INDEX_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,11 @@ namespace Dali { namespace SceneLoader { - using Index = uint32_t; constexpr Index INVALID_INDEX = static_cast(-1); -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_INDEX_H_ diff --git a/dali-scene-loader/public-api/ktx-loader.h b/dali-scene-loader/public-api/ktx-loader.h index 6167fef..d94f4ca 100644 --- a/dali-scene-loader/public-api/ktx-loader.h +++ b/dali-scene-loader/public-api/ktx-loader.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_KTX_LOADER_H #define DALI_SCENE_LOADER_KTX_LOADER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,12 @@ namespace Dali { namespace SceneLoader { - /** * @brief Stores the pixel data objects for each face of the cube texture and their mipmaps. */ struct DALI_SCENE_LOADER_API CubeData { - std::vector< std::vector > data; + std::vector > data; Texture CreateTexture() const; }; @@ -48,7 +47,7 @@ struct DALI_SCENE_LOADER_API CubeData */ DALI_SCENE_LOADER_API bool LoadCubeMapData(const std::string& path, CubeData& cubedata); -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_KTX_LOADER_H diff --git a/dali-scene-loader/public-api/light-parameters.h b/dali-scene-loader/public-api/light-parameters.h index 0d8d514..11b014b 100644 --- a/dali-scene-loader/public-api/light-parameters.h +++ b/dali-scene-loader/public-api/light-parameters.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_LIGHT_PARAMETERS_H #define DALI_SCENE_LOADER_LIGHT_PARAMETERS_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,27 +21,26 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES +#include #include "dali/public-api/math/matrix.h" #include "dali/public-api/math/vector3.h" -#include namespace Dali { namespace SceneLoader { - struct DALI_SCENE_LOADER_API LightParameters { Matrix transform; - Vector3 color; - float intensity; - float shadowIntensity; + Vector3 color; + float intensity; + float shadowIntensity; uint32_t shadowMapSize; - float orthographicSize; + float orthographicSize; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_LIGHT_PARAMETERS_H diff --git a/dali-scene-loader/public-api/load-result.h b/dali-scene-loader/public-api/load-result.h index ca05bfd..4ed3ff5 100644 --- a/dali-scene-loader/public-api/load-result.h +++ b/dali-scene-loader/public-api/load-result.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_OUTPUT_H #define DALI_SCENE_LOADER_OUTPUT_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,15 @@ */ // INTERNAL INCLUDES -#include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/animation-definition.h" -#include "dali-scene-loader/public-api/light-parameters.h" +#include "dali-scene-loader/public-api/api.h" #include "dali-scene-loader/public-api/camera-parameters.h" +#include "dali-scene-loader/public-api/light-parameters.h" namespace Dali { namespace SceneLoader { - class ResourceBundle; class SceneDefinition; @@ -67,7 +66,7 @@ struct DALI_SCENE_LOADER_API LoadResult std::vector& mLightParameters; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_OUTPUT_H diff --git a/dali-scene-loader/public-api/material-definition.h b/dali-scene-loader/public-api/material-definition.h index d360c88..80e93e7 100644 --- a/dali-scene-loader/public-api/material-definition.h +++ b/dali-scene-loader/public-api/material-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_MATERIAL_DEFINITION_H #define DALI_SCENE_LOADER_MATERIAL_DEFINITION_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,15 +24,14 @@ #include "dali-scene-loader/public-api/utils.h" // EXTERNAL INCLUDES -#include "dali/public-api/math/vector4.h" -#include "dali/public-api/common/vector-wrapper.h" #include +#include "dali/public-api/common/vector-wrapper.h" +#include "dali/public-api/math/vector4.h" namespace Dali { namespace SceneLoader { - /** * @brief Helper enum for encoding and decoding sampler states. */ @@ -43,54 +42,53 @@ struct DALI_SCENE_LOADER_API SamplerFlags enum Values : Type { // Filter - 3 bits - FILTER_NEAREST = 0, - FILTER_LINEAR = NthBit(0), + FILTER_NEAREST = 0, + FILTER_LINEAR = NthBit(0), FILTER_MIPMAP_NEAREST = NthBit(1), - FILTER_MIPMAP_LINEAR = NthBit(2), + FILTER_MIPMAP_LINEAR = NthBit(2), // Wrap - 2 bits WRAP_REPEAT = 0, - WRAP_CLAMP = NthBit(0), + WRAP_CLAMP = NthBit(0), WRAP_MIRROR = NthBit(1), // Layout - apply shift, then mask FILTER_MIN_BITS = 3, FILTER_MIN_MASK = NthBit(FILTER_MIN_BITS) - 1, - FILTER_MAG_BITS = 1, + FILTER_MAG_BITS = 1, FILTER_MAG_SHIFT = FILTER_MIN_BITS, - FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1, + FILTER_MAG_MASK = NthBit(FILTER_MAG_BITS) - 1, - WRAP_S_BITS = 2, + WRAP_S_BITS = 2, WRAP_S_SHIFT = FILTER_MAG_SHIFT + FILTER_MAG_BITS, - WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1, + WRAP_S_MASK = NthBit(WRAP_S_BITS) - 1, - WRAP_T_BITS = 2, + WRAP_T_BITS = 2, WRAP_T_SHIFT = WRAP_S_SHIFT + WRAP_S_BITS, - WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1, + WRAP_T_MASK = NthBit(WRAP_T_BITS) - 1, // Diagnostics MIPMAP_MASK = FILTER_MIPMAP_LINEAR | FILTER_MIPMAP_NEAREST, // Default - DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps + DEFAULT = FILTER_LINEAR | (FILTER_LINEAR << FILTER_MAG_SHIFT) | (WRAP_REPEAT << WRAP_S_SHIFT) | (WRAP_REPEAT << WRAP_T_SHIFT), // LINEAR filters, REPEAT wraps }; /** * @return SamplerFlags bit pattern calculated from the given Dali Sampler settings. */ - static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter, - WrapMode::Type wrapS, WrapMode::Type wrapT); + static Type Encode(FilterMode::Type minFilter, FilterMode::Type magFilter, WrapMode::Type wrapS, WrapMode::Type wrapT); /** * @brief Decodes the minification filter patter of @a flags into the corresponding FilterMode. */ - static FilterMode::Type GetMinFilter(Type flags); + static FilterMode::Type GetMinFilter(Type flags); /** * @brief Decodes the magnification filter patter of @a flags into the corresponding FilterMode. */ - static FilterMode::Type GetMagFilter(Type flags); + static FilterMode::Type GetMagFilter(Type flags); /** * @brief Decodes the horizontal wrap pattern of @a flags into the corresponding WrapMode. @@ -113,7 +111,7 @@ struct DALI_SCENE_LOADER_API SamplerFlags */ struct DALI_SCENE_LOADER_API TextureDefinition { - std::string mImageUri; + std::string mImageUri; SamplerFlags::Type mSamplerFlags; TextureDefinition(const std::string& imageUri = "", SamplerFlags::Type samplerFlags = SamplerFlags::DEFAULT); @@ -130,22 +128,22 @@ struct DALI_SCENE_LOADER_API MaterialDefinition enum Flags : uint32_t { // Texture semantics - ALBEDO = NthBit(0), - METALLIC = NthBit(1), - ROUGHNESS = NthBit(2), - NORMAL = NthBit(3), - EMISSIVE = NthBit(4), // TODO: support - OCCLUSION = NthBit(5), // TODO: support - SUBSURFACE = NthBit(6), // Note: dli-only + ALBEDO = NthBit(0), + METALLIC = NthBit(1), + ROUGHNESS = NthBit(2), + NORMAL = NthBit(3), + EMISSIVE = NthBit(4), // TODO: support + OCCLUSION = NthBit(5), // TODO: support + SUBSURFACE = NthBit(6), // Note: dli-only // Other binary options - TRANSPARENCY = NthBit(20), - GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture + TRANSPARENCY = NthBit(20), + GLTF_CHANNELS = NthBit(21), // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessmetallicroughnesstexture // Alpha cutoff - reserved from the 24th bit - ALPHA_CUTOFF_BITS = 8, + ALPHA_CUTOFF_BITS = 8, ALPHA_CUTOFF_SHIFT = sizeof(uint32_t) * 8 - ALPHA_CUTOFF_BITS, - ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1, + ALPHA_CUTOFF_MASK = (1 << ALPHA_CUTOFF_BITS) - 1, }; /** @@ -153,7 +151,7 @@ struct DALI_SCENE_LOADER_API MaterialDefinition */ struct TextureStage { - uint32_t mSemantic; + uint32_t mSemantic; TextureDefinition mTexture; }; @@ -163,7 +161,7 @@ struct DALI_SCENE_LOADER_API MaterialDefinition { struct TextureData { - PixelData mPixels; + PixelData mPixels; SamplerFlags::Type mSamplerFlags; }; @@ -221,14 +219,14 @@ struct DALI_SCENE_LOADER_API MaterialDefinition public: // DATA uint32_t mFlags = 0x0; - Index mEnvironmentIdx = 0; - Vector4 mColor = Color::WHITE; - float mMetallic = 1.f; - float mRoughness = 1.f; + Index mEnvironmentIdx = 0; + Vector4 mColor = Color::WHITE; + float mMetallic = 1.f; + float mRoughness = 1.f; std::vector mTextureStages; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_MATERIAL_DEFINITION_H diff --git a/dali-scene-loader/public-api/matrix-stack.h b/dali-scene-loader/public-api/matrix-stack.h index f764da1..5c5c923 100644 --- a/dali-scene-loader/public-api/matrix-stack.h +++ b/dali-scene-loader/public-api/matrix-stack.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_MATRIX_STACK_H_ #define DALI_SCENE_LOADER_MATRIX_STACK_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,13 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES -#include "dali/public-api/math/matrix.h" #include "dali/public-api/common/vector-wrapper.h" +#include "dali/public-api/math/matrix.h" namespace Dali { namespace SceneLoader { - /** * @brief A stack of matrices whereby each newly pushed matrix is stored * after being multiplied by the previous one (if any). @@ -39,17 +38,17 @@ class DALI_SCENE_LOADER_API MatrixStack public: MatrixStack(); - bool IsEmpty() const; - void Push(const Matrix& model); + bool IsEmpty() const; + void Push(const Matrix& model); const Matrix& Top() const; - void Pop(); - void PopAll(); // clears the stack, but retains the storage. + void Pop(); + void PopAll(); // clears the stack, but retains the storage. private: std::vector mStack; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_MATRIX_STACK_H_ diff --git a/dali-scene-loader/public-api/mesh-definition.h b/dali-scene-loader/public-api/mesh-definition.h index 057aad7..cd0ddc9 100644 --- a/dali-scene-loader/public-api/mesh-definition.h +++ b/dali-scene-loader/public-api/mesh-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_MESH_DEFINITION_H #define DALI_SCENE_LOADER_MESH_DEFINITION_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,20 +19,19 @@ // INTERNAL INCLUDES #include "dali-scene-loader/public-api/api.h" -#include "dali-scene-loader/public-api/mesh-geometry.h" #include "dali-scene-loader/public-api/blend-shape-details.h" -#include "dali-scene-loader/public-api/utils.h" #include "dali-scene-loader/public-api/index.h" +#include "dali-scene-loader/public-api/mesh-geometry.h" +#include "dali-scene-loader/public-api/utils.h" // EXTERNAL INCLUDES -#include "dali/public-api/common/vector-wrapper.h" #include +#include "dali/public-api/common/vector-wrapper.h" namespace Dali { namespace SceneLoader { - /** * @brief Defines a mesh with its attributes, the primitive type to render it as, * and the file to load it from with the offset and length information for the @@ -42,25 +41,28 @@ struct DALI_SCENE_LOADER_API MeshDefinition { using Vector = std::vector>; - enum : uint32_t { INVALID = std::numeric_limits::max() }; + enum : uint32_t + { + INVALID = std::numeric_limits::max() + }; enum Flags : uint16_t { FLIP_UVS_VERTICAL = NthBit(0), - U32_INDICES = NthBit(1), // default is unsigned short - U16_JOINT_IDS = NthBit(2), // default is floats + U32_INDICES = NthBit(1), // default is unsigned short + U16_JOINT_IDS = NthBit(2), // default is floats }; enum Attributes { - INDICES = NthBit(0), - POSITIONS = NthBit(1), - NORMALS = NthBit(2), - TEX_COORDS = NthBit(3), - TANGENTS = NthBit(4), - LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader. - JOINTS_0 = NthBit(6), - WEIGHTS_0 = NthBit(7), + INDICES = NthBit(0), + POSITIONS = NthBit(1), + NORMALS = NthBit(2), + TEX_COORDS = NthBit(3), + TANGENTS = NthBit(4), + LEGACY_BITANGENTS = NthBit(5), // these are ignored; we're calculating them in the (PBR) shader. + JOINTS_0 = NthBit(6), + WEIGHTS_0 = NthBit(7), }; /** @@ -69,10 +71,10 @@ struct DALI_SCENE_LOADER_API MeshDefinition */ struct Blob { - uint32_t mOffset = INVALID; // the default means that the blob is undefined. - uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details. - uint16_t mStride = 0; // ignore if 0 - uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0 + uint32_t mOffset = INVALID; // the default means that the blob is undefined. + uint32_t mLength = 0; // if the blob is undefined, its data may still be generated. This is enabled by setting length to some non-0 value. Refer to MeshDefinition for details. + uint16_t mStride = 0; // ignore if 0 + uint16_t mElementSizeHint = 0; // ignore if 0 or stride == 0 std::vector mMin; std::vector mMax; @@ -80,8 +82,7 @@ struct DALI_SCENE_LOADER_API MeshDefinition Blob() = default; - Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0, - const std::vector& min = {}, const std::vector& max = {}); + Blob(uint32_t offset, uint32_t length, uint16_t stride = 0, uint16_t elementSizeHint = 0, const std::vector& min = {}, const std::vector& max = {}); /** * @brief Calculates the size of a tightly-packed buffer for the elements from the blob. @@ -122,14 +123,14 @@ struct DALI_SCENE_LOADER_API MeshDefinition SparseBlob(const Blob& indices, const Blob& values, uint32_t count); - Blob mIndices; - Blob mValues; + Blob mIndices; + Blob mValues; uint32_t mCount = 0u; }; struct Accessor { - Blob mBlob; + Blob mBlob; std::unique_ptr mSparse; Accessor() = default; @@ -140,8 +141,8 @@ struct DALI_SCENE_LOADER_API MeshDefinition Accessor(Accessor&&) = default; Accessor& operator=(Accessor&&) = default; - Accessor(const MeshDefinition::Blob& blob, - const MeshDefinition::SparseBlob& sparse); + Accessor(const MeshDefinition::Blob& blob, + const MeshDefinition::SparseBlob& sparse); bool IsDefined() const { @@ -155,30 +156,30 @@ struct DALI_SCENE_LOADER_API MeshDefinition struct BlendShape { std::string name; - Accessor deltas; - Accessor normals; - Accessor tangents; - float weight = 0.f; + Accessor deltas; + Accessor normals; + Accessor tangents; + float weight = 0.f; }; struct RawData { struct Attrib { - std::string mName; - Property::Type mType; - uint32_t mNumElements; + std::string mName; + Property::Type mType; + uint32_t mNumElements; std::vector mData; void AttachBuffer(Geometry& g) const; }; std::vector mIndices; - std::vector mAttribs; + std::vector mAttribs; - unsigned int mBlendShapeBufferOffset; + unsigned int mBlendShapeBufferOffset; Dali::Vector mBlendShapeUnnormalizeFactor; - PixelData mBlendShapeData; + PixelData mBlendShapeData; }; MeshDefinition() = default; @@ -235,25 +236,25 @@ struct DALI_SCENE_LOADER_API MeshDefinition MeshGeometry Load(RawData&& raw) const; public: // DATA - uint32_t mFlags = 0x0; + uint32_t mFlags = 0x0; Geometry::Type mPrimitiveType = Geometry::TRIANGLES; - std::string mUri; - Accessor mIndices; - Accessor mPositions; - Accessor mNormals; // data can be generated based on positions - Accessor mTexCoords; - Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available) - Accessor mJoints0; - Accessor mWeights0; - - Blob mBlendShapeHeader; + std::string mUri; + Accessor mIndices; + Accessor mPositions; + Accessor mNormals; // data can be generated based on positions + Accessor mTexCoords; + Accessor mTangents; // data can be generated based on normals and texCoords (the latter isn't mandatory; the results will be better if available) + Accessor mJoints0; + Accessor mWeights0; + + Blob mBlendShapeHeader; std::vector mBlendShapes; - BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID; + BlendShapes::Version mBlendShapeVersion = BlendShapes::Version::INVALID; Index mSkeletonIdx = INVALID_INDEX; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_MESH_DEFINITION_H diff --git a/dali-scene-loader/public-api/mesh-geometry.h b/dali-scene-loader/public-api/mesh-geometry.h index bf282da..026e9a7 100644 --- a/dali-scene-loader/public-api/mesh-geometry.h +++ b/dali-scene-loader/public-api/mesh-geometry.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_MESH_GEOMETRY_H #define DALI_SCENE_LOADER_MESH_GEOMETRY_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ namespace Dali { namespace SceneLoader { - struct DALI_SCENE_LOADER_API MeshGeometry { - Geometry geometry; ///< The array of vertices. - Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions. + Geometry geometry; ///< The array of vertices. + Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions. Vector blendShapeUnnormalizeFactor; ///< Factor used to unnormalize the geometry of the blend shape. - unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape. + unsigned int blendShapeBufferOffset; ///< Offset used to calculate the start of each blend shape. }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_MESH_GEOMETRY_H diff --git a/dali-scene-loader/public-api/node-definition.h b/dali-scene-loader/public-api/node-definition.h index 3dec499..b496cf7 100644 --- a/dali-scene-loader/public-api/node-definition.h +++ b/dali-scene-loader/public-api/node-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_NODE_DEFINITION_H_ #define DALI_SCENE_LOADER_NODE_DEFINITION_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,19 +23,18 @@ #include "dali-scene-loader/public-api/resource-bundle.h" // EXTERNAL INCLUDES -#include "dali/public-api/math/quaternion.h" +#include +#include +#include +#include "dali/public-api/actors/actor.h" #include "dali/public-api/math/matrix.h" +#include "dali/public-api/math/quaternion.h" #include "dali/public-api/math/vector4.h" -#include "dali/public-api/actors/actor.h" -#include -#include -#include namespace Dali { namespace SceneLoader { - class ViewProjection; /** @@ -70,7 +69,7 @@ public: struct DALI_SCENE_LOADER_API ConstraintDefinition { std::string mProperty; ///< name of the property to constrain. - Index mSourceIdx; ///< index of the node to serve as the source of the constraint. + Index mSourceIdx; ///< index of the node to serve as the source of the constraint. bool operator<(const ConstraintDefinition& other) const { @@ -90,7 +89,7 @@ struct DALI_SCENE_LOADER_API ConstraintDefinition struct DALI_SCENE_LOADER_API Transforms { - MatrixStack modelStack; + MatrixStack modelStack; const ViewProjection& viewProjection; }; @@ -100,7 +99,7 @@ struct DALI_SCENE_LOADER_API Transforms */ struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest { - Index mSkeletonIdx; + Index mSkeletonIdx; Shader mShader; bool operator<(const SkinningShaderConfigurationRequest& other) const @@ -115,8 +114,8 @@ struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest { std::string mNodeName; - Index mMeshIdx; - Shader mShader; + Index mMeshIdx; + Shader mShader; bool operator<(const BlendshapeShaderConfigurationRequest& other) const { @@ -129,8 +128,8 @@ struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest */ struct DALI_SCENE_LOADER_API ConstraintRequest { - const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create. - Actor mTarget; ///< Target of the constraint. + const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create. + Actor mTarget; ///< Target of the constraint. }; /** @@ -140,18 +139,18 @@ struct DALI_SCENE_LOADER_API ConstraintRequest */ struct DALI_SCENE_LOADER_API NodeDefinition { -public: // TYPES +public: // TYPES using Vector = std::vector; struct CreateParams { public: // input const ResourceBundle& mResources; - Transforms& mXforms; + Transforms& mXforms; public: // output - std::vector mConstrainables; - std::vector mSkinnables; + std::vector mConstrainables; + std::vector mSkinnables; std::vector mBlendshapeRequests; }; @@ -176,14 +175,14 @@ public: // TYPES { auto choice = choices.Get(mTag); return std::min(choice != Customization::NONE ? choice : 0, - static_cast(node.mChildren.size() - 1)); + static_cast(node.mChildren.size() - 1)); } }; class IVisitor { public: - virtual void Start(NodeDefinition& n) = 0; + virtual void Start(NodeDefinition& n) = 0; virtual void Finish(NodeDefinition& n) = 0; protected: @@ -193,7 +192,7 @@ public: // TYPES class IConstVisitor { public: - virtual void Start(const NodeDefinition& n) = 0; + virtual void Start(const NodeDefinition& n) = 0; virtual void Finish(const NodeDefinition& n) = 0; protected: @@ -202,7 +201,7 @@ public: // TYPES struct Extra { - std::string mKey; + std::string mKey; Property::Value mValue; bool operator<(const Extra& other) const @@ -211,7 +210,7 @@ public: // TYPES } }; -public: // METHODS +public: // METHODS /** * @brief Creates a DALi Actor from this definition only. * @note Not recursive. @@ -225,28 +224,28 @@ public: // DATA std::string mName; - Vector3 mPosition = Vector3::ZERO; + Vector3 mPosition = Vector3::ZERO; Quaternion mOrientation = Quaternion::IDENTITY; - Vector3 mScale = Vector3::ONE; - Vector3 mSize = Vector3::ONE; + Vector3 mScale = Vector3::ONE; + Vector3 mSize = Vector3::ONE; bool mIsVisible = true; - std::unique_ptr mRenderable; + std::unique_ptr mRenderable; std::unique_ptr mCustomization; - std::vector mExtras; - std::vector mConstraints; + std::vector mExtras; + std::vector mConstraints; std::vector mChildren; - Index mParentIdx = INVALID_INDEX; + Index mParentIdx = INVALID_INDEX; }; class DALI_SCENE_LOADER_API ModelNode : public NodeDefinition::Renderable { public: // DATA - Vector4 mColor = Color::WHITE; - Index mMeshIdx = INVALID_INDEX; - Index mMaterialIdx = INVALID_INDEX; + Vector4 mColor = Color::WHITE; + Index mMeshIdx = INVALID_INDEX; + Index mMaterialIdx = INVALID_INDEX; public: // METHODS void RegisterResources(IResourceReceiver& receiver) const override; @@ -260,11 +259,11 @@ public: // METHODS class DALI_SCENE_LOADER_API ArcNode : public ModelNode { public: // DATA - bool mAntiAliasing = true; - int mArcCaps = 0; + bool mAntiAliasing = true; + int mArcCaps = 0; float mStartAngleDegrees = .0f; - float mEndAngleDegrees = .0f; - float mRadius = .0f; + float mEndAngleDegrees = .0f; + float mRadius = .0f; public: // METHODS static void GetEndVectorWithDiffAngle(float startAngle, float endAngle, Vector2& endVector); @@ -272,7 +271,7 @@ public: // METHODS void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_NODE_DEFINITION_H_ diff --git a/dali-scene-loader/public-api/parse-renderer-state.h b/dali-scene-loader/public-api/parse-renderer-state.h index 97792aa..38103d0 100644 --- a/dali-scene-loader/public-api/parse-renderer-state.h +++ b/dali-scene-loader/public-api/parse-renderer-state.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H #define DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ namespace SceneLoader { namespace RendererState { - /* * @brief Attempts to interpret a string for renderer states, which can be a combination of the following * (using '|' as a delimiter, if multiple specified):
@@ -42,8 +41,8 @@ namespace RendererState */ DALI_SCENE_LOADER_API Type Parse(const char* string, size_t length = 0, StringCallback onError = DefaultErrorCallback); -} -} -} +} // namespace RendererState +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H diff --git a/dali-scene-loader/public-api/renderer-state.h b/dali-scene-loader/public-api/renderer-state.h index dc1bf63..f70100a 100644 --- a/dali-scene-loader/public-api/renderer-state.h +++ b/dali-scene-loader/public-api/renderer-state.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_RENDERER_STATE_H #define DALI_SCENE_LOADER_RENDERER_STATE_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ namespace Dali { namespace SceneLoader { - /* * @brief Contains values for comparison functions used in depth and stencil testing. * @note Relative order of members must match DepthFunction::Type and StencilFunction::Type. @@ -36,7 +35,7 @@ struct DALI_SCENE_LOADER_API Comparison { enum Type { - OMIT, // not specified; will not be set. + OMIT, // not specified; will not be set. NEVER, ALWAYS, LESS, @@ -58,13 +57,13 @@ struct DALI_SCENE_LOADER_API BlendFactor { enum Type { - OMIT, // not specified - will not be updated + OMIT, // not specified - will not be updated ZERO, - ONE, // default for source alpha + ONE, // default for source alpha SRC_COLOR, ONE_MINUS_SRC_COLOR, - SRC_ALPHA, // default for source RGB - ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha + SRC_ALPHA, // default for source RGB + ONE_MINUS_SRC_ALPHA, // default for destination RGB and destination alpha DST_ALPHA, ONE_MINUS_DST_ALPHA, DST_COLOR, @@ -87,12 +86,12 @@ struct DALI_SCENE_LOADER_API BufferMode { enum Type { - OMIT, ///< not specified - will not be updated - NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer). - AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default. - COLOR, ///< Ignore stencil properties. Write to the color buffer. - STENCIL, ///< Use the stencil properties. Do not write to the color buffer. - COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer. + OMIT, ///< not specified - will not be updated + NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer). + AUTO, ///< Writes are managed by the Actor Clipping API. This is DALi's default. + COLOR, ///< Ignore stencil properties. Write to the color buffer. + STENCIL, ///< Use the stencil properties. Do not write to the color buffer. + COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer. }; BufferMode() = delete; @@ -103,36 +102,35 @@ struct DALI_SCENE_LOADER_API BufferMode */ namespace RendererState { - -using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function +using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function enum DALI_SCENE_LOADER_API Value : Type { NONE = 0x0, DEPTH_WRITE = 0x01, - DEPTH_TEST = 0x02, + DEPTH_TEST = 0x02, CULL_FRONT = 0x04, - CULL_BACK = 0x08, + CULL_BACK = 0x08, ALPHA_BLEND = 0x10, DEPTH_FUNCTION_SHIFT = 6, - DEPTH_FUNCTION_BITS = 4, - DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT, + DEPTH_FUNCTION_BITS = 4, + DEPTH_FUNCTION_MASK = ((1 << DEPTH_FUNCTION_BITS) - 1) << DEPTH_FUNCTION_SHIFT, BLEND_FACTOR_BASE_SHIFT = DEPTH_FUNCTION_SHIFT + DEPTH_FUNCTION_BITS, - BLEND_FACTOR_ITEM_BITS = 4, - BLEND_FACTOR_ITEMS = 4, - BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS, - BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT, - BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT + BLEND_FACTOR_ITEM_BITS = 4, + BLEND_FACTOR_ITEMS = 4, + BLEND_FACTOR_BITS = BLEND_FACTOR_ITEM_BITS * BLEND_FACTOR_ITEMS, + BLEND_FACTOR_MASK = ((1 << BLEND_FACTOR_BITS) - 1) << BLEND_FACTOR_BASE_SHIFT, + BLEND_FACTOR_ITEM_MASK = (1 << BLEND_FACTOR_ITEM_BITS) - 1, // after rshifting by BLEND_FACTOR_BASE_SHIFT // Buffer mode is DALi's RenderMode, just to avoid too much conflation. - BUFFER_MODE_BITS = 3u, - BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end - BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT, + BUFFER_MODE_BITS = 3u, + BUFFER_MODE_SHIFT = 32u - BUFFER_MODE_BITS, // from end + BUFFER_MODE_MASK = ((1u << BUFFER_MODE_BITS) - 1u) << BUFFER_MODE_SHIFT, DEFAULT = DEPTH_WRITE | DEPTH_TEST | CULL_BACK | (Comparison::LESS_EQUAL << DEPTH_FUNCTION_SHIFT), }; @@ -141,12 +139,11 @@ enum DALI_SCENE_LOADER_API Value : Type * @brief Encodes the given blend factors into a RenderMode value, maskable into other options, * passable into ApplyRenderMode(). */ -inline -DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, - BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha) +inline DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha) { return (srcRgb | (destRgb << BLEND_FACTOR_ITEM_BITS) | (srcAlpha << (BLEND_FACTOR_ITEM_BITS * 2)) | - (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3))) << BLEND_FACTOR_BASE_SHIFT; + (destAlpha << (BLEND_FACTOR_ITEM_BITS * 3))) + << BLEND_FACTOR_BASE_SHIFT; } /* @@ -157,9 +154,9 @@ DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcR */ DALI_SCENE_LOADER_API void Apply(Type rendererState, Renderer& renderer); -} // RendererState +} // namespace RendererState -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_RENDERER_STATE_H diff --git a/dali-scene-loader/public-api/resource-bundle.h b/dali-scene-loader/public-api/resource-bundle.h index 16860ec..b1e0936 100644 --- a/dali-scene-loader/public-api/resource-bundle.h +++ b/dali-scene-loader/public-api/resource-bundle.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_ #define DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,23 @@ */ // INTERNAL -#include "dali-scene-loader/public-api/mesh-definition.h" -#include "dali-scene-loader/public-api/material-definition.h" #include "dali-scene-loader/public-api/environment-definition.h" +#include "dali-scene-loader/public-api/material-definition.h" +#include "dali-scene-loader/public-api/mesh-definition.h" #include "dali-scene-loader/public-api/shader-definition.h" #include "dali-scene-loader/public-api/skeleton-definition.h" // EXTERNAL +#include +#include #include "dali/public-api/common/vector-wrapper.h" #include "dali/public-api/rendering/shader.h" #include "dali/public-api/rendering/texture-set.h" -#include -#include namespace Dali { namespace SceneLoader { - /* * @brief The types of resources that .dli may define. */ @@ -73,9 +72,9 @@ public: enum Value : Type { - None = 0, - ForceReload = NthBit(0), ///< Load resources [again] even if they were already loaded. - KeepUnused = NthBit(1) /// +#include +#include "dali/public-api/actors/actor.h" #include "dali/public-api/math/matrix.h" +#include "dali/public-api/math/quaternion.h" #include "dali/public-api/math/vector4.h" -#include "dali/public-api/actors/actor.h" -#include -#include namespace Dali { namespace SceneLoader { - class MatrixStack; /* @@ -44,9 +43,9 @@ class MatrixStack; */ class DALI_SCENE_LOADER_API SceneDefinition { -public: // TYPES - using NodePredicate = std::function; - using NodeConsumer = std::function; +public: // TYPES + using NodePredicate = std::function; + using NodeConsumer = std::function; using ConstNodeConsumer = std::function; public: // METHODS @@ -112,8 +111,7 @@ public: // METHODS * from node definitions. * @return Handle to the root actor. */ - Actor CreateNodes(Index iNode, const Customization::Choices& choices, - NodeDefinition::CreateParams& params) const; + Actor CreateNodes(Index iNode, const Customization::Choices& choices, NodeDefinition::CreateParams& params) const; /* * @brief Creates / update a registry of mappings from customization tags to @@ -123,8 +121,8 @@ public: // METHODS * choice of 0. */ void GetCustomizationOptions(const Customization::Choices& choices, - Customization::Map& outCustomizationOptions, - Customization::Choices* outMissingChoices) const; + Customization::Map& outCustomizationOptions, + Customization::Choices* outMissingChoices) const; /* * @brief Attempts to add @a nodeDef to the end of nodes, and its index to the end of @@ -198,9 +196,9 @@ public: // METHODS /* * @brief Applies constraints from the given requests. */ - void ApplyConstraints(Actor& root, - std::vector&& constrainables, - StringCallback onError = DefaultErrorCallback) const; + void ApplyConstraints(Actor& root, + std::vector&& constrainables, + StringCallback onError = DefaultErrorCallback) const; /* * @brief Sets up joint matrix properties and constraints on actors that are involved in skeletal @@ -239,8 +237,9 @@ public: // METHODS * of separate instances need to be declared in the .dli to avoid clashing uniform * definitions and constraints. */ - void ConfigureSkinningShaders(const ResourceBundle& resources, - Actor root, std::vector&& requests) const; + void ConfigureSkinningShaders(const ResourceBundle& resources, + Actor root, + std::vector&& requests) const; /* * @brief Ensures there is no two meshes with blend shapes sharing the same shader. @@ -258,21 +257,22 @@ public: // METHODS * @param[in] resources The resources bundle. Meshes need to be accessed to configure the blend shapes. * @param[in] onError The error callback. */ - bool ConfigureBlendshapeShaders(const ResourceBundle& resources, - Actor root, std::vector&& requests, - StringCallback onError = DefaultErrorCallback) const; + bool ConfigureBlendshapeShaders(const ResourceBundle& resources, + Actor root, + std::vector&& requests, + StringCallback onError = DefaultErrorCallback) const; SceneDefinition& operator=(SceneDefinition&& other); private: // METHODS bool FindNode(const std::string& name, std::unique_ptr** result); -private: // DATA - std::vector> mNodes; // size unknown up front (may discard nodes). - std::vector mRootNodeIds; +private: // DATA + std::vector> mNodes; // size unknown up front (may discard nodes). + std::vector mRootNodeIds; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_SCENE_DEFINITION_H_ diff --git a/dali-scene-loader/public-api/shader-definition-factory.h b/dali-scene-loader/public-api/shader-definition-factory.h index 4f55bbe..387984d 100644 --- a/dali-scene-loader/public-api/shader-definition-factory.h +++ b/dali-scene-loader/public-api/shader-definition-factory.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_ #define DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ */ // INTERNAL INCLUDES -#include "dali-scene-loader/public-api/index.h" #include "dali-scene-loader/public-api/api.h" +#include "dali-scene-loader/public-api/index.h" // EXTERNAL INCLUDER #include @@ -28,7 +28,6 @@ namespace Dali { namespace SceneLoader { - struct NodeDefinition; class ResourceBundle; @@ -57,7 +56,7 @@ private: const std::unique_ptr mImpl; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_ diff --git a/dali-scene-loader/public-api/shader-definition.h b/dali-scene-loader/public-api/shader-definition.h index 29693fb..d7f390b 100644 --- a/dali-scene-loader/public-api/shader-definition.h +++ b/dali-scene-loader/public-api/shader-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_H #define DALI_SCENE_LOADER_SHADER_DEFINITION_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,15 +21,14 @@ #include "dali-scene-loader/public-api/renderer-state.h" // EXTERNAL INCLUDES +#include #include "dali/public-api/common/vector-wrapper.h" #include "dali/public-api/rendering/shader.h" -#include namespace Dali { namespace SceneLoader { - /* * @brief Defines a shader with paths to the files which define its * vertex and fragment components, and a mapping of uniform names (which are @@ -76,15 +75,15 @@ struct DALI_SCENE_LOADER_API ShaderDefinition public: // DATA RendererState::Type mRendererState = RendererState::NONE; - std::string mVertexShaderPath; - std::string mFragmentShaderPath; + std::string mVertexShaderPath; + std::string mFragmentShaderPath; std::vector mDefines; std::vector mHints; Property::Map mUniforms; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_SHADER_DEFINITION_H diff --git a/dali-scene-loader/public-api/skeleton-definition.h b/dali-scene-loader/public-api/skeleton-definition.h index a06f19b..9bd7133 100644 --- a/dali-scene-loader/public-api/skeleton-definition.h +++ b/dali-scene-loader/public-api/skeleton-definition.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_SKELETON_H #define DALI_SCENE_LOADER_SKELETON_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ namespace Dali { namespace SceneLoader { - /* * @brief A set of joints (stored as node indices), and an optional root node index. * @note The list of joints must not be empty and must not contain INVALID_INDEX. @@ -39,17 +38,17 @@ struct DALI_SCENE_LOADER_API SkeletonDefinition { struct Joint { - Index mNodeIdx; + Index mNodeIdx; Matrix mInverseBindMatrix; }; using Vector = std::vector; - Index mRootNodeIdx = INVALID_INDEX; + Index mRootNodeIdx = INVALID_INDEX; std::vector mJoints; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_SKELETON_H diff --git a/dali-scene-loader/public-api/skinning-details.h b/dali-scene-loader/public-api/skinning-details.h index 415d25a..4ad1676 100644 --- a/dali-scene-loader/public-api/skinning-details.h +++ b/dali-scene-loader/public-api/skinning-details.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_SKINNING_DETAILS_H_ #define DALI_SCENE_LOADER_SKINNING_DETAILS_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES -#include "dali/public-api/rendering/shader.h" #include +#include "dali/public-api/rendering/shader.h" namespace Dali { @@ -43,7 +43,7 @@ struct DALI_SCENE_LOADER_API Skinning Skinning() = delete; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif // DALI_SCENE_LOADER_SKINNING_DETAILS_H_ diff --git a/dali-scene-loader/public-api/string-callback.h b/dali-scene-loader/public-api/string-callback.h index 9569b2d..5a1d289 100644 --- a/dali-scene-loader/public-api/string-callback.h +++ b/dali-scene-loader/public-api/string-callback.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_STRING_CALLBACK_H #define DALI_SCENE_LOADER_STRING_CALLBACK_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ namespace Dali { namespace SceneLoader { - /* * @brief A callback to post strings to. */ @@ -39,7 +38,7 @@ using StringCallback = std::function; */ DALI_SCENE_LOADER_API void DefaultErrorCallback(const std::string& message); -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_STRING_CALLBACK_H diff --git a/dali-scene-loader/public-api/utils.h b/dali-scene-loader/public-api/utils.h index 1aace35..f9213e1 100644 --- a/dali-scene-loader/public-api/utils.h +++ b/dali-scene-loader/public-api/utils.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_UTILS_H_ #define DALI_SCENE_LOADER_UTILS_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +21,16 @@ #include "dali-scene-loader/public-api/api.h" // EXTERNAL INCLUDES +#include +#include #include "dali/public-api/actors/actor.h" -#include "dali/public-api/rendering/renderer.h" #include "dali/public-api/common/dali-common.h" -#include -#include +#include "dali/public-api/rendering/renderer.h" namespace Dali { namespace SceneLoader { - /* * @brief Fixed size backing buffer to use with std::ostreams where control over * allocations (which this does not make), is required. @@ -52,14 +51,16 @@ public: class DALI_SCENE_LOADER_API ExceptionFlinger { public: - enum { MESSAGE_BUFFER_SIZE = 512 }; + enum + { + MESSAGE_BUFFER_SIZE = 512 + }; ExceptionFlinger(const char* location) noexcept(true); - [[noreturn]] - ~ExceptionFlinger() noexcept(false); + [[noreturn]] ~ExceptionFlinger() noexcept(false); - template + template ExceptionFlinger& operator<<(const T& rhs) noexcept(true) { mStream << rhs; @@ -71,13 +72,12 @@ private: { const char* mLocation; - [[noreturn]] - ~Impl() noexcept(false); + [[noreturn]] ~Impl() noexcept(false); }; static char* GetMessageBuffer() noexcept(true); - Impl mImpl; + Impl mImpl; StreamBuffer mStreamBuffer; std::ostream mStream; }; @@ -90,13 +90,15 @@ DALI_SCENE_LOADER_API std::string FormatString(const char* format, ...); /* * @return The @n th bit in a bitmask. */ -DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n) { return 1 << n; } +DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n) +{ + return 1 << n; +} /* * @return Whether all of @a mask 's bits are set on @a value. */ -inline -DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask) +inline DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask) { return (value & mask) == mask; } @@ -104,8 +106,7 @@ DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask) /* * @brief Convert a four-letter(, null-terminated) string literal into a uint32_t. */ -inline -DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char(&fourCC)[5]) +inline DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char (&fourCC)[5]) { return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0]; } @@ -116,11 +117,10 @@ DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char(&fourCC)[5]) * @param[in] b, compare string * @return true if strings are equal */ -inline -DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b ) +inline DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b) { // Converts to lower case in the current locale. - return std::tolower( a ) == std::tolower( b ); + return std::tolower(a) == std::tolower(b); } /* @@ -128,13 +128,12 @@ DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare( unsigned char a, uns * @param[in] a, compare string * @param[in] b, compare string */ -inline -DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b ) +inline DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b) { bool result = false; - if( a.length() == b.length() ) + if(a.length() == b.length()) { - result = std::equal( a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare ); + result = std::equal(a.begin(), a.end(), b.begin(), &CaseInsensitiveCharacterCompare); } return result; } @@ -154,9 +153,8 @@ DALI_SCENE_LOADER_API std::string LoadTextFile(const char* path, bool* fail = nu * @note Use of a @a fn that is itself recursing in @a is also discouraged * for performance and stability reasons. */ -template -inline -DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn) +template +inline DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn) { fn(a); @@ -171,8 +169,7 @@ DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn) * @brief Convenience function to set the given actor @a 's anchor point * and parent origin to center. */ -inline -DALI_SCENE_LOADER_API void SetActorCentered(Actor a) +inline DALI_SCENE_LOADER_API void SetActorCentered(Actor a) { a.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER); a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); @@ -184,10 +181,10 @@ using Type = uint32_t; enum DALI_SCENE_LOADER_API Values : Type { - NONE = 0x00, + NONE = 0x00, FLIP_VERTICAL = 0x01, }; -} +} // namespace TexturedQuadOptions /* * @brief Makes... geometry for a textured quad. @@ -198,9 +195,9 @@ DALI_SCENE_LOADER_API Geometry MakeTexturedQuadGeometry(TexturedQuadOptions::Typ * @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one. * @param[in,out] path The path to be fixed. */ -DALI_SCENE_LOADER_API void ToUnixFileSeparators( std::string& path ); +DALI_SCENE_LOADER_API void ToUnixFileSeparators(std::string& path); -} -} +} // namespace SceneLoader +} // namespace Dali #endif /* DALI_SCENE_LOADER_UTILS_H_ */ diff --git a/dali-scene-loader/public-api/view-projection.h b/dali-scene-loader/public-api/view-projection.h index 70efc4f..26ce908 100644 --- a/dali-scene-loader/public-api/view-projection.h +++ b/dali-scene-loader/public-api/view-projection.h @@ -1,7 +1,7 @@ #ifndef DALI_SCENE_LOADER_VIEW_PROJECTION_H_ #define DALI_SCENE_LOADER_VIEW_PROJECTION_H_ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ namespace Dali { namespace SceneLoader { - /** * @brief Contains view and projection matrices, also caching the view-projection * and inverse projection matrices. @@ -35,18 +34,36 @@ namespace SceneLoader class ViewProjection { public: - Matrix& GetView() { return mView; } - Matrix& GetProjection() { return mProjection; } + Matrix& GetView() + { + return mView; + } + Matrix& GetProjection() + { + return mProjection; + } /* * @brief Updates the cached view projection and inverse projection matrices. */ void Update(); - const Matrix& GetView() const { return mView; } - const Matrix& GetProjection() const { return mProjection; } - const Matrix& GetInverseProjection() const { return mInvProjection; } - const Matrix& GetViewProjection() const { return mViewProjection; } + const Matrix& GetView() const + { + return mView; + } + const Matrix& GetProjection() const + { + return mProjection; + } + const Matrix& GetInverseProjection() const + { + return mInvProjection; + } + const Matrix& GetViewProjection() const + { + return mViewProjection; + } private: Matrix mView; @@ -55,7 +72,7 @@ private: Matrix mViewProjection; }; -} -} +} // namespace SceneLoader +} // namespace Dali #endif //DALI_SCENE_LOADER_VIEW_PROJECTION_H_ diff --git a/dali-scene-loader/third-party/.clang-format b/dali-scene-loader/third-party/.clang-format new file mode 100644 index 0000000..297ddc2 --- /dev/null +++ b/dali-scene-loader/third-party/.clang-format @@ -0,0 +1,5 @@ +--- +Language: Cpp +DisableFormat: true +SortIncludes: false +... diff --git a/dali-toolkit/devel-api/controls/control-devel.h b/dali-toolkit/devel-api/controls/control-devel.h index 9baeeb2..c9d13f2 100644 --- a/dali-toolkit/devel-api/controls/control-devel.h +++ b/dali-toolkit/devel-api/controls/control-devel.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,31 +39,31 @@ class Base; namespace DevelControl { /// @brief AccessibilityActivate signal type. -typedef Signal< void ( ) > AccessibilityActivateSignalType; +typedef Signal AccessibilityActivateSignalType; /// @brief AccessibilityReadingSkipped signal type. -typedef Signal< void ( ) > AccessibilityReadingSkippedSignalType; +typedef Signal AccessibilityReadingSkippedSignalType; /// @brief AccessibilityReadingPaused signal type. -typedef Signal< void ( ) > AccessibilityReadingPausedSignalType; +typedef Signal AccessibilityReadingPausedSignalType; /// @brief AccessibilityReadingResumed signal type. -typedef Signal< void ( ) > AccessibilityReadingResumedSignalType; +typedef Signal AccessibilityReadingResumedSignalType; /// @brief AccessibilityReadingCancelled signal type. -typedef Signal< void ( ) > AccessibilityReadingCancelledSignalType; +typedef Signal AccessibilityReadingCancelledSignalType; /// @brief AccessibilityReadingStopped signal type. -typedef Signal< void ( ) > AccessibilityReadingStoppedSignalType; +typedef Signal AccessibilityReadingStoppedSignalType; /// @brief AccessibilityGetName signal type. -typedef Signal< void ( std::string& ) > AccessibilityGetNameSignalType; +typedef Signal AccessibilityGetNameSignalType; /// @brief AccessibilityGetDescription signal type. -typedef Signal< void ( std::string& ) > AccessibilityGetDescriptionSignalType; +typedef Signal AccessibilityGetDescriptionSignalType; /// @brief AccessibilityDoGesture signal type. -typedef Signal< void ( std::pair& ) > AccessibilityDoGestureSignalType; +typedef Signal&)> AccessibilityDoGestureSignalType; enum State { @@ -371,7 +371,7 @@ DALI_TOOLKIT_API Dali::Property GetVisualProperty(Control control, Dali::Propert * @brief The signal is emmited as a succession of "activate" signal send by accessibility client. * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityActivateSignalType &AccessibilityActivateSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityActivateSignalType& AccessibilityActivateSignal(Toolkit::Control control); /** * @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say @@ -379,21 +379,21 @@ DALI_TOOLKIT_API AccessibilityActivateSignalType &AccessibilityActivateSignal( T * * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType &AccessibilityReadingSkippedSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityReadingSkippedSignalType& AccessibilityReadingSkippedSignal(Toolkit::Control control); /** * @brief * * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityReadingPausedSignalType &AccessibilityReadingPausedSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityReadingPausedSignalType& AccessibilityReadingPausedSignal(Toolkit::Control control); /** * @brief * * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityReadingResumedSignalType &AccessibilityReadingResumedSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityReadingResumedSignalType& AccessibilityReadingResumedSignal(Toolkit::Control control); /** * @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say @@ -401,7 +401,7 @@ DALI_TOOLKIT_API AccessibilityReadingResumedSignalType &AccessibilityReadingResu * * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType &AccessibilityReadingCancelledSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType& AccessibilityReadingCancelledSignal(Toolkit::Control control); /** * @brief The signal is emmited when text send via Dali::Accessibility::Bridge::Say @@ -409,7 +409,7 @@ DALI_TOOLKIT_API AccessibilityReadingCancelledSignalType &AccessibilityReadingCa * * @return The signal to connect to */ -DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType &AccessibilityReadingStoppedSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType& AccessibilityReadingStoppedSignal(Toolkit::Control control); /** * @brief The signal is emmited when accessibility client asks for object's name. @@ -421,7 +421,7 @@ DALI_TOOLKIT_API AccessibilityReadingStoppedSignalType &AccessibilityReadingStop * Priority is as above. If none is used, default implementation is provided. * @return [description] */ -DALI_TOOLKIT_API AccessibilityGetNameSignalType &AccessibilityGetNameSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityGetNameSignalType& AccessibilityGetNameSignal(Toolkit::Control control); /** * @brief The signal is emmited when accessibility client asks for object's description. @@ -433,7 +433,7 @@ DALI_TOOLKIT_API AccessibilityGetNameSignalType &AccessibilityGetNameSignal( Too * Priority is as above. If none is used, default implementation is provided. * @return signal handler */ -DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType &AccessibilityGetDescriptionSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType& AccessibilityGetDescriptionSignal(Toolkit::Control control); /** * @brief The signal is emitted when accessibility client call "DoGesture" method via IPC mechanism. @@ -441,7 +441,7 @@ DALI_TOOLKIT_API AccessibilityGetDescriptionSignalType &AccessibilityGetDescript * This signal allows developers to serve incoming gesture in specific way. * @return signal handler */ -DALI_TOOLKIT_API AccessibilityDoGestureSignalType &AccessibilityDoGestureSignal( Toolkit::Control control ); +DALI_TOOLKIT_API AccessibilityDoGestureSignalType& AccessibilityDoGestureSignal(Toolkit::Control control); /** * @brief The method allows connection with other actor with usage of concrete accessibility relation type. @@ -450,7 +450,7 @@ DALI_TOOLKIT_API AccessibilityDoGestureSignalType &AccessibilityDoGestureSignal( * @param destination Actor object * @param relation enumerated value describing relation */ -DALI_TOOLKIT_API void AppendAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation ); +DALI_TOOLKIT_API void AppendAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation); /** * @brief The method allows removing relation @@ -459,7 +459,7 @@ DALI_TOOLKIT_API void AppendAccessibilityRelation( Dali::Actor control, Actor de * @param destination Actor object * @param relation enumerated value describing relation */ -DALI_TOOLKIT_API void RemoveAccessibilityRelation( Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation ); +DALI_TOOLKIT_API void RemoveAccessibilityRelation(Dali::Actor control, Actor destination, Dali::Accessibility::RelationType relation); /** * @brief The method returns collection accessibility addresses representing objects connected with current object @@ -467,14 +467,14 @@ DALI_TOOLKIT_API void RemoveAccessibilityRelation( Dali::Actor control, Actor de * @param control object to append attribute to * @return std::vector, where index is casted value of Accessibility::RelationType and value is std::vector of type Accessibility::Address */ -DALI_TOOLKIT_API std::vector> GetAccessibilityRelations( Dali::Actor control ); +DALI_TOOLKIT_API std::vector> GetAccessibilityRelations(Dali::Actor control); /** * @brief The method removes all previously appended relations * * @param control object to append attribute to */ -DALI_TOOLKIT_API void ClearAccessibilityRelations( Dali::Actor control ); +DALI_TOOLKIT_API void ClearAccessibilityRelations(Dali::Actor control); /** * @brief The method allows to add or modify value matched with given key. @@ -484,21 +484,21 @@ DALI_TOOLKIT_API void ClearAccessibilityRelations( Dali::Actor control ); * @param key std::string value * @param value std::string value */ -DALI_TOOLKIT_API void AppendAccessibilityAttribute( Dali::Actor control, const std::string& key, const std::string value ); +DALI_TOOLKIT_API void AppendAccessibilityAttribute(Dali::Actor control, const std::string& key, const std::string value); /** * @brief The method erases key with its value from accessibility attributes * @param control object to append attribute to * @param key std::string value */ -DALI_TOOLKIT_API void RemoveAccessibilityAttribute( Dali::Actor control, const std::string& key ); +DALI_TOOLKIT_API void RemoveAccessibilityAttribute(Dali::Actor control, const std::string& key); /** * @brief The method clears accessibility attributes * * @param control object to append attribute to */ -DALI_TOOLKIT_API void ClearAccessibilityAttributes( Dali::Actor control ); +DALI_TOOLKIT_API void ClearAccessibilityAttributes(Dali::Actor control); /** * @brief The method inserts reading information of an accessible object into attributes @@ -506,7 +506,7 @@ DALI_TOOLKIT_API void ClearAccessibilityAttributes( Dali::Actor control ); * @param control object to append attribute to * @param types Reading information types */ -DALI_TOOLKIT_API void SetAccessibilityReadingInfoType( Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types ); +DALI_TOOLKIT_API void SetAccessibilityReadingInfoType(Dali::Actor control, const Dali::Accessibility::ReadingInfoTypes types); /** * @brief The method returns reading information of an accessible object @@ -514,7 +514,7 @@ DALI_TOOLKIT_API void SetAccessibilityReadingInfoType( Dali::Actor control, cons * @param control object to append attribute to * @return Reading information types */ -DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType( Dali::Actor control ); +DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingInfoType(Dali::Actor control); /** * @brief The method erases highlight. @@ -522,7 +522,7 @@ DALI_TOOLKIT_API Dali::Accessibility::ReadingInfoTypes GetAccessibilityReadingIn * @param control object to append attribute to * @return bool value, false when it is not possible or something went wrong, at the other way true. */ -DALI_TOOLKIT_API bool ClearAccessibilityHighlight( Dali::Actor control ); +DALI_TOOLKIT_API bool ClearAccessibilityHighlight(Dali::Actor control); /** * @brief The method grabs highlight. @@ -530,7 +530,7 @@ DALI_TOOLKIT_API bool ClearAccessibilityHighlight( Dali::Actor control ); * @param control object to append attribute to * @return bool value, false when it is not possible or something went wrong, at the other way true. */ -DALI_TOOLKIT_API bool GrabAccessibilityHighlight( Dali::Actor control ); +DALI_TOOLKIT_API bool GrabAccessibilityHighlight(Dali::Actor control); /** * @brief The metod presents bitset of control's states. @@ -538,7 +538,7 @@ DALI_TOOLKIT_API bool GrabAccessibilityHighlight( Dali::Actor control ); * @param control object to append attribute to * @return Dali::Accessibility::States is vector of enumerated State. */ -DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates( Dali::Actor control ); +DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates(Dali::Actor control); /** * @brief The method force sending notifications about current states to accessibility clients @@ -547,7 +547,7 @@ DALI_TOOLKIT_API Dali::Accessibility::States GetAccessibilityStates( Dali::Actor * @param states mask with states expected to broadcast * @param doRecursive flag pointing if notifications of children's state would be sent */ -DALI_TOOLKIT_API void NotifyAccessibilityStateChange( Dali::Actor control, Dali::Accessibility::States states, bool doRecursive ); +DALI_TOOLKIT_API void NotifyAccessibilityStateChange(Dali::Actor control, Dali::Accessibility::States states, bool doRecursive); /** * The method allows to set specific constructor for creating accessibility structure @@ -566,14 +566,14 @@ DALI_TOOLKIT_API void NotifyAccessibilityStateChange( Dali::Actor control, Dali: * * param constructor callback creating Accessible object */ -DALI_TOOLKIT_API void SetAccessibilityConstructor( Dali::Actor control, std::function(Dali::Actor)> constructor); +DALI_TOOLKIT_API void SetAccessibilityConstructor(Dali::Actor control, std::function(Dali::Actor)> constructor); /** * Returns accessibility object bound to actor, if any * * This method won't bound new accessibility object. Use Dali::Accessibility::Accessible::Get in that case. */ -DALI_TOOLKIT_API Dali::Accessibility::Accessible *GetBoundAccessibilityObject( Dali::Actor control ); +DALI_TOOLKIT_API Dali::Accessibility::Accessible* GetBoundAccessibilityObject(Dali::Actor control); } // namespace DevelControl diff --git a/dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h b/dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h old mode 100755 new mode 100644 index 44a3bc1..2ae0e35 --- a/dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h +++ b/dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h @@ -26,12 +26,10 @@ namespace Dali { - class WebEngineBackForwardListItem; namespace Toolkit { - /** * @addtogroup dali_toolkit_controls_web_view * @{ @@ -50,7 +48,7 @@ public: /** * @brief Creates a WebBackForwardListItem. */ - WebBackForwardListItem( const Dali::WebEngineBackForwardListItem* item ); + WebBackForwardListItem(const Dali::WebEngineBackForwardListItem* item); /** * @brief Destructor. @@ -82,7 +80,6 @@ public: std::string GetOriginalUrl() const; private: - const Dali::WebEngineBackForwardListItem* mWebEngineBackForwardListItem; }; diff --git a/dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h b/dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h old mode 100755 new mode 100644 index 144c02b..9dc81fc --- a/dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h +++ b/dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_WEB_BACK_FORWARD_LIST_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ namespace Dali { - class WebEngineBackForwardList; namespace Toolkit @@ -49,7 +48,7 @@ public: /** * @brief Creates a WebBackForwardList. */ - WebBackForwardList( const Dali::WebEngineBackForwardList& list ); + WebBackForwardList(const Dali::WebEngineBackForwardList& list); /** * @brief Destructor. @@ -78,9 +77,8 @@ public: uint32_t GetItemCount() const; private: - const Dali::WebEngineBackForwardList& mWebEngineBackForwardList; + const Dali::WebEngineBackForwardList& mWebEngineBackForwardList; Dali::Toolkit::WebBackForwardListItem mWebBackForwardListItem; - }; /** diff --git a/dali-toolkit/devel-api/controls/web-view/web-context.h b/dali-toolkit/devel-api/controls/web-view/web-context.h old mode 100755 new mode 100644 index 1640c70..ead4efd --- a/dali-toolkit/devel-api/controls/web-view/web-context.h +++ b/dali-toolkit/devel-api/controls/web-view/web-context.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_WEB_CONTEXT_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,16 @@ */ // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include namespace Dali { - namespace Toolkit { - /** * @addtogroup dali_toolkit_controls_web_view * @{ @@ -45,13 +43,12 @@ namespace Toolkit class DALI_TOOLKIT_API WebContext { public: - /** * @brief Creates a WebContext. * * @param[in] context The context of web engine. */ - WebContext( Dali::WebEngineContext& context ); + WebContext(Dali::WebEngineContext& context); /** * @brief Destructor. @@ -70,14 +67,14 @@ public: * * @param[in] cacheModel The cache model */ - void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel ); + void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel); /** * @brief Sets the given proxy URI to network backend of specific context. * * @param[in] uri The proxy URI to set */ - void SetProxyUri( const std::string& uri ); + void SetProxyUri(const std::string& uri); /** * Adds CA certificates to persistent NSS certificate database @@ -89,7 +86,7 @@ public: * * @param[in] certificatePath path to a CA certificate file(s), see above for details */ - void SetCertificateFilePath( const std::string& certificatePath ); + void SetCertificateFilePath(const std::string& certificatePath); /** * Toggles the cache to be enabled or disabled @@ -99,7 +96,7 @@ public: * * @param[in] cacheDisabled enable or disable cache */ - void DisableCache( bool cacheDisabled ); + void DisableCache(bool cacheDisabled); /** * @brief Sets a proxy auth credential to network backend of specific context. @@ -107,7 +104,7 @@ public: * @param[in] username username to set * @param[in] password password to set */ - void SetDefaultProxyAuth( const std::string& username, const std::string& password ); + void SetDefaultProxyAuth(const std::string& username, const std::string& password); /** * Requests for deleting all web databases. @@ -133,8 +130,7 @@ public: void ClearCache(); private: - - Dali::WebEngineContext& mWebEngineContext; + Dali::WebEngineContext& mWebEngineContext; }; /** diff --git a/dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h b/dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h old mode 100755 new mode 100644 index adb8481..a332e06 --- a/dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h +++ b/dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ */ // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include @@ -31,7 +31,6 @@ class WebEngineCookieManager; namespace Toolkit { - /** * @addtogroup dali_toolkit_controls_web_view * @{ @@ -47,12 +46,11 @@ namespace Toolkit class DALI_TOOLKIT_API WebCookieManager { public: - /** * @brief Creates a WebCookieManager. * @param[in] manager A #Dali::WebEngineCookieManager */ - WebCookieManager( Dali::WebEngineCookieManager& manager ); + WebCookieManager(Dali::WebEngineCookieManager& manager); /** * @brief Destructor. @@ -67,7 +65,7 @@ public: * * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy */ - void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy ); + void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy); /** * @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY. @@ -93,11 +91,10 @@ public: * @param[in] path The path where to read/write Cookies * @param[in] storage The type of storage */ - void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ); + void SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage); private: - - Dali::WebEngineCookieManager& mWebEngineCookieManager; + Dali::WebEngineCookieManager& mWebEngineCookieManager; }; /** diff --git a/dali-toolkit/devel-api/controls/web-view/web-settings.h b/dali-toolkit/devel-api/controls/web-view/web-settings.h old mode 100755 new mode 100644 index dc46e7c..4d24b58 --- a/dali-toolkit/devel-api/controls/web-view/web-settings.h +++ b/dali-toolkit/devel-api/controls/web-view/web-settings.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_WEB_SETTINGS_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ class WebEngineSettings; namespace Toolkit { - /** * @addtogroup dali_toolkit_controls_web_view * @{ @@ -51,7 +50,7 @@ public: * * @param[in] settings A settings of web engine. */ - WebSettings( Dali::WebEngineSettings& settings ); + WebSettings(Dali::WebEngineSettings& settings); /** * @brief Destructor. @@ -64,7 +63,7 @@ public: * @param[in] allowed if true, allow to run mixed contents, * otherwise not allow */ - void AllowMixedContents( bool allowed ); + void AllowMixedContents(bool allowed); /** * @brief Enable the spatial navigation or not. @@ -72,7 +71,7 @@ public: * @param[in] enabled if true, use spatial navigation, * otherwise to disable */ - void EnableSpatialNavigation( bool enabled ); + void EnableSpatialNavigation(bool enabled); /** * @brief Returns the default font size in pixel. The default value is 16. @@ -86,7 +85,7 @@ public: * * @param[in] defaultFontSize A new default font size to set */ - void SetDefaultFontSize( int defaultFontSize ); + void SetDefaultFontSize(int defaultFontSize); /** * @brief Enables/disables web security. @@ -94,7 +93,7 @@ public: * @param[in] enabled if true, to enable the web security * otherwise to disable */ - void EnableWebSecurity( bool enabled ); + void EnableWebSecurity(bool enabled); /** * @brief Allow/Disallow file access from external url @@ -102,7 +101,7 @@ public: * @param[in] allowed if true, to allow file access from external url * otherwise to disallow */ - void AllowFileAccessFromExternalUrl( bool allowed ); + void AllowFileAccessFromExternalUrl(bool allowed); /** * @brief Returns whether JavaScript can be executable. The default is true. @@ -116,7 +115,7 @@ public: * * @param[in] enabled True if JavaScript executing is enabled, false otherwise */ - void EnableJavaScript( bool enabled ); + void EnableJavaScript(bool enabled); /** * @brief Allow if the scripts can open new windows. @@ -124,7 +123,7 @@ public: * @param[in] allowed if true, the scripts can open new windows, * otherwise not */ - void AllowScriptsOpenWindows( bool allowed ); + void AllowScriptsOpenWindows(bool allowed); /** * @brief Returns whether images can be loaded automatically. The default is true. @@ -138,7 +137,7 @@ public: * * @param[in] automatic True if images are loaded automatically, false otherwise */ - void AllowImagesLoadAutomatically( bool automatic ); + void AllowImagesLoadAutomatically(bool automatic); /** * @brief Gets the default text encoding name (e.g. UTF-8). @@ -152,7 +151,7 @@ public: * * @param[in] defaultTextEncodingName The default text encoding name */ - void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ); + void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName); private: Dali::WebEngineSettings& mWebEngineSettings; diff --git a/dali-toolkit/devel-api/controls/web-view/web-view.h b/dali-toolkit/devel-api/controls/web-view/web-view.h old mode 100755 new mode 100644 index 48e57ce..8c842b7 --- a/dali-toolkit/devel-api/controls/web-view/web-view.h +++ b/dali-toolkit/devel-api/controls/web-view/web-view.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_WEB_VIEW_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ #include // INTERNAL INCLUDES -#include #include +#include namespace Dali { @@ -56,7 +56,6 @@ class WebView; class DALI_TOOLKIT_API WebView : public Control { public: - /** * @brief Enumeration for the start and end property ranges for this control. */ @@ -126,37 +125,37 @@ public: */ enum class LoadErrorCode { - UNKNOWN = 0, ///< Unknown. - CANCELED, ///< User canceled. - CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type. - FAILED_FILE_IO, ///< File IO error. - CANT_CONNECT, ///< Cannot connect to the network. - CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS. - FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake. - INVALID_CERTIFICATE, ///< Received certificate is invalid. - REQUEST_TIMEOUT, ///< Connection timeout. - TOO_MANY_REDIRECTS, ///< Too many redirects. - TOO_MANY_REQUESTS, ///< Too many requests during this load. - BAD_URL, ///< Malformed URL. - UNSUPPORTED_SCHEME, ///< Unsupported scheme. - AUTHENTICATION, ///< User authentication failed on the server. - INTERNAL_SERVER ///< Web server has an internal server error. + UNKNOWN = 0, ///< Unknown. + CANCELED, ///< User canceled. + CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type. + FAILED_FILE_IO, ///< File IO error. + CANT_CONNECT, ///< Cannot connect to the network. + CANT_LOOKUP_HOST, ///< Fail to look up host from the DNS. + FAILED_TLS_HANDSHAKE, ///< Fail to SSL/TLS handshake. + INVALID_CERTIFICATE, ///< Received certificate is invalid. + REQUEST_TIMEOUT, ///< Connection timeout. + TOO_MANY_REDIRECTS, ///< Too many redirects. + TOO_MANY_REQUESTS, ///< Too many requests during this load. + BAD_URL, ///< Malformed URL. + UNSUPPORTED_SCHEME, ///< Unsupported scheme. + AUTHENTICATION, ///< User authentication failed on the server. + INTERNAL_SERVER ///< Web server has an internal server error. }; /** * @brief WebView signal type related with page loading. */ - using WebViewPageLoadSignalType = Signal< void( WebView, const std::string& ) >; + using WebViewPageLoadSignalType = Signal; /** * @brief WebView signal type related with page loading error. */ - using WebViewPageLoadErrorSignalType = Signal< void( WebView, const std::string&, LoadErrorCode ) >; + using WebViewPageLoadErrorSignalType = Signal; /** * @brief WebView signal type related with scroll edge reached. */ - using WebViewScrollEdgeReachedSignalType = Signal< void( WebView, Dali::WebEnginePlugin::ScrollEdge ) >; + using WebViewScrollEdgeReachedSignalType = Signal; public: /** @@ -181,7 +180,7 @@ public: * @param [in] argc The count of arguments of Applications * @param [in] argv The string array of arguments of Applications */ - static WebView New( int argc, char** argv ); + static WebView New(int argc, char** argv); /** * @brief Creates an uninitialized WebView. @@ -287,7 +286,7 @@ public: * @param[in] deltaX The delta x of scroll * @param[in] deltaY The delta y of scroll */ - void ScrollBy( int deltaX, int deltaY ); + void ScrollBy(int deltaX, int deltaY); /** * @brief Returns whether forward is possible. diff --git a/dali-toolkit/devel-api/layouting/flex-node.h b/dali-toolkit/devel-api/layouting/flex-node.h index 5a73458..d19c90b 100644 --- a/dali-toolkit/devel-api/layouting/flex-node.h +++ b/dali-toolkit/devel-api/layouting/flex-node.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_LAYOUTING_FLEX_NODE_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,7 +115,7 @@ struct SizeTuple * @note int, height measure specification mode * @note SizeTuple, return value */ -using MeasureCallback = void (*)(Dali::Actor, float , int , float , int, SizeTuple *); +using MeasureCallback = void (*)(Dali::Actor, float, int, float, int, SizeTuple*); /** * This class provides the API for calling into the Flex layout implementation. diff --git a/dali-toolkit/devel-api/shader-effects/dissolve-effect.h b/dali-toolkit/devel-api/shader-effects/dissolve-effect.h index 47c171f..8572a12 100644 --- a/dali-toolkit/devel-api/shader-effects/dissolve-effect.h +++ b/dali-toolkit/devel-api/shader-effects/dissolve-effect.h @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include #include #include #include +#include // INTERNAL INCLUDES #include @@ -44,7 +44,7 @@ namespace Toolkit * @param[in] displacement The direction of the central line * @param[in] initialProgress The normalised initial progress of the shader */ -DALI_TOOLKIT_API void DissolveEffectSetCentralLine( Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress ); +DALI_TOOLKIT_API void DissolveEffectSetCentralLine(Actor& actor, const Vector2& position, const Vector2& displacement, float initialProgress); /** * @brief Create a new Dissolve effect @@ -58,7 +58,7 @@ DALI_TOOLKIT_API void DissolveEffectSetCentralLine( Actor& actor, const Vector2& * @return The newly created Property::Map with the dissolve effect */ -DALI_TOOLKIT_API Property::Map CreateDissolveEffect( bool useHighPrecision = true); +DALI_TOOLKIT_API Property::Map CreateDissolveEffect(bool useHighPrecision = true); } // namespace Toolkit diff --git a/dali-toolkit/devel-api/shader-effects/motion-blur-effect.h b/dali-toolkit/devel-api/shader-effects/motion-blur-effect.h index 8201976..aed1634 100644 --- a/dali-toolkit/devel-api/shader-effects/motion-blur-effect.h +++ b/dali-toolkit/devel-api/shader-effects/motion-blur-effect.h @@ -35,7 +35,7 @@ namespace Toolkit * @param[in] actor The actor that registers the uniform properties * @param[in] numBlurSamples Number of samples used by the shader */ -DALI_TOOLKIT_API void SetMotionBlurProperties( Actor& actor, unsigned int numBlurSamples = 8 ); +DALI_TOOLKIT_API void SetMotionBlurProperties(Actor& actor, unsigned int numBlurSamples = 8); /** * @brief Create a new MotionBlurEffect diff --git a/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h b/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h index 5f4976d..8ad7c67 100644 --- a/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h +++ b/dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h @@ -32,7 +32,7 @@ namespace Toolkit /** * @brief Set the properties for the motion stretch */ -DALI_TOOLKIT_API void SetMotionStretchProperties( Actor& actor ); +DALI_TOOLKIT_API void SetMotionStretchProperties(Actor& actor); /** * @brief Creates a new MotionStretchEffect diff --git a/dali-toolkit/devel-api/text/text-utils-devel.h b/dali-toolkit/devel-api/text/text-utils-devel.h old mode 100755 new mode 100644 index e4bf375..87bffdd --- a/dali-toolkit/devel-api/text/text-utils-devel.h +++ b/dali-toolkit/devel-api/text/text-utils-devel.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_UTILS_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,7 +89,7 @@ struct DALI_TOOLKIT_API RendererParameters // float minLineSize; ///< The line's minimum size (in points). - Extents padding; ///< The padding of the boundaries where the text is going to be laid-out. + Extents padding; ///< The padding of the boundaries where the text is going to be laid-out. }; /** diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h index b55d448..97da737 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,22 +19,19 @@ */ // EXTERNAL INCLUDES +#include #include #include -#include // INTERNAL INCLUDES #include namespace Dali { - namespace Toolkit { - namespace Internal { - class AccessibilityManager; /** @@ -43,7 +40,6 @@ class AccessibilityManager; class AccessibilityManager : public Dali::BaseObject, public Dali::ConnectionTracker { public: - typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType; typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType; @@ -173,7 +169,6 @@ public: Actor GetFocusIndicatorActor(); public: - /** * @copydoc Toolkit::AccessibilityManager::FocusChangedSignal() */ @@ -189,8 +184,7 @@ public: */ Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal(); -public: // Signals - +public: // Signals /** * @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal */ @@ -400,25 +394,22 @@ public: // Signals } protected: - /** * Destructor */ virtual ~AccessibilityManager(); private: - // Undefined AccessibilityManager(const AccessibilityManager&); AccessibilityManager& operator=(const AccessibilityManager& rhs); private: - std::vector mFocusOrder; - Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change - Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted + Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change + Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor // Action signals. diff --git a/dali-toolkit/internal/builder/builder-declarations.h b/dali-toolkit/internal/builder/builder-declarations.h index 09a5fd1..963869b 100644 --- a/dali-toolkit/internal/builder/builder-declarations.h +++ b/dali-toolkit/internal/builder/builder-declarations.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_BUILDER_DECLARATIONS_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,12 @@ // EXTERNAL INCLUDES #include +#include +#include #include #include #include #include -#include -#include // INTERNAL INCLUDES #include @@ -34,19 +34,19 @@ typedef Dali::Toolkit::TreeNode TreeNode; typedef TreeNode::ConstIterator TreeConstIter; -typedef OptionalValue OptionalChild; -typedef OptionalValue OptionalString; -typedef OptionalValue OptionalFloat; -typedef OptionalValue OptionalInteger; -typedef OptionalValue OptionalUnsignedInt; -typedef OptionalValue OptionalBoolean; -typedef OptionalValue OptionalVector2; -typedef OptionalValue OptionalVector3; -typedef OptionalValue OptionalVector4; -typedef OptionalValue OptionalString; -typedef OptionalValue OptionalMatrix; -typedef OptionalValue OptionalMatrix3; +typedef OptionalValue OptionalChild; +typedef OptionalValue OptionalString; +typedef OptionalValue OptionalFloat; +typedef OptionalValue OptionalInteger; +typedef OptionalValue OptionalUnsignedInt; +typedef OptionalValue OptionalBoolean; +typedef OptionalValue OptionalVector2; +typedef OptionalValue OptionalVector3; +typedef OptionalValue OptionalVector4; +typedef OptionalValue OptionalString; +typedef OptionalValue OptionalMatrix; +typedef OptionalValue OptionalMatrix3; typedef OptionalValue > OptionalRect; -typedef OptionalValue OptionalExtents; +typedef OptionalValue OptionalExtents; #endif // DALI_TOOLKIT_BUILDER_DECLARATIONS_H diff --git a/dali-toolkit/internal/builder/builder-filesystem.h b/dali-toolkit/internal/builder/builder-filesystem.h old mode 100755 new mode 100644 index 2222d1b..5e032a0 --- a/dali-toolkit/internal/builder/builder-filesystem.h +++ b/dali-toolkit/internal/builder/builder-filesystem.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,24 +19,24 @@ */ // EXTERNAL INCLUDES -#include #include #include +#include #include #include -inline std::string GetFileContents(const std::string &fn) +inline std::string GetFileContents(const std::string& fn) { - std::streampos bufferSize = 0; + std::streampos bufferSize = 0; Dali::Vector fileBuffer; - if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) ) + if(!Dali::FileLoader::ReadFile(fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY)) { - return std::string(); + return std::string(); } - return std::string( &fileBuffer[0], bufferSize ); + return std::string(&fileBuffer[0], bufferSize); } #endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H diff --git a/dali-toolkit/internal/builder/builder-get-is.inl.h b/dali-toolkit/internal/builder/builder-get-is.inl.h index 01dab59..0a7f6d5 100644 --- a/dali-toolkit/internal/builder/builder-get-is.inl.h +++ b/dali-toolkit/internal/builder/builder-get-is.inl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,12 +23,12 @@ inline OptionalChild IsChild(const TreeNode* node, const std::string& childName) { - if( node ) + if(node) { const TreeNode* c = node->GetChild(childName); - if( NULL != c ) + if(NULL != c) { - return OptionalChild( *c ); + return OptionalChild(*c); } else { @@ -43,12 +43,12 @@ inline OptionalChild IsChild(const TreeNode* node, const std::string& childName) inline OptionalChild IsChildIgnoreCase(const TreeNode* node, const std::string& childName) { - if( node ) + if(node) { const TreeNode* c = node->GetChildIgnoreCase(childName); - if( NULL != c ) + if(NULL != c) { - return OptionalChild( *c ); + return OptionalChild(*c); } else { @@ -73,7 +73,7 @@ inline OptionalChild IsChildIgnoreCase(const TreeNode& node, const std::string& inline OptionalString IsString(const OptionalChild& node) { - if( node && (*node).GetType() == TreeNode::STRING ) + if(node && (*node).GetType() == TreeNode::STRING) { return OptionalString((*node).GetString()); } @@ -87,36 +87,36 @@ inline OptionalFloat IsFloat(const OptionalChild& node) { OptionalFloat ret; - if( node ) + if(node) { - if( (*node).GetType() == TreeNode::FLOAT ) + if((*node).GetType() == TreeNode::FLOAT) { ret = (*node).GetFloat(); } - else if( (*node).GetType() == TreeNode::INTEGER ) + else if((*node).GetType() == TreeNode::INTEGER) { // JSON has number not float/int but JsonParser discriminates. // Here we don't care so we allow coercion - ret = static_cast( (*node).GetInteger() ); + ret = static_cast((*node).GetInteger()); } } return ret; } -inline OptionalInteger IsInteger(const OptionalChild &node) +inline OptionalInteger IsInteger(const OptionalChild& node) { OptionalInteger ret; - if( node ) + if(node) { - if( (*node).GetType() == TreeNode::INTEGER ) + if((*node).GetType() == TreeNode::INTEGER) { ret = (*node).GetInteger(); } - else if( (*node).GetType() == TreeNode::FLOAT ) + else if((*node).GetType() == TreeNode::FLOAT) { - ret = static_cast( (*node).GetFloat() ); + ret = static_cast((*node).GetFloat()); } } @@ -125,7 +125,7 @@ inline OptionalInteger IsInteger(const OptionalChild &node) inline OptionalBoolean IsBoolean(const OptionalChild& node) { - if( node && (*node).GetType() == TreeNode::BOOLEAN ) + if(node && (*node).GetType() == TreeNode::BOOLEAN) { return OptionalBoolean(1 == (*node).GetInteger()); } @@ -135,18 +135,17 @@ inline OptionalBoolean IsBoolean(const OptionalChild& node) } } - // copy N Numbers -template +template inline bool CopyNumbers(TreeNode::ConstIterator iter, int N, T& vector) { for(int i = 0; i < N; ++i) { - if( (*iter).second.GetType() == TreeNode::FLOAT) + if((*iter).second.GetType() == TreeNode::FLOAT) { vector[i] = (*iter).second.GetFloat(); } - else if( (*iter).second.GetType() == TreeNode::INTEGER ) + else if((*iter).second.GetType() == TreeNode::INTEGER) { vector[i] = static_cast((*iter).second.GetInteger()); } @@ -164,10 +163,10 @@ inline OptionalVector4 IsVector4(const OptionalChild& node) { OptionalVector4 ret; - if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4 ) + if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 4) { Dali::Vector4 v; - if( CopyNumbers((*node).CBegin(), 4, v) ) + if(CopyNumbers((*node).CBegin(), 4, v)) { ret = OptionalVector4(v); } @@ -180,10 +179,10 @@ inline OptionalVector3 IsVector3(const OptionalChild& node) { OptionalVector3 ret; - if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3 ) + if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 3) { Dali::Vector3 v; - if( CopyNumbers((*node).CBegin(), 3, v) ) + if(CopyNumbers((*node).CBegin(), 3, v)) { ret = OptionalVector3(v); } @@ -196,10 +195,10 @@ inline OptionalVector2 IsVector2(const OptionalChild& node) { OptionalVector2 ret; - if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2 ) + if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 2) { Dali::Vector2 v; - if( CopyNumbers((*node).CBegin(), 2, v) ) + if(CopyNumbers((*node).CBegin(), 2, v)) { ret = OptionalVector2(v); } @@ -208,14 +207,14 @@ inline OptionalVector2 IsVector2(const OptionalChild& node) return ret; } -inline OptionalMatrix IsMatrix(const OptionalChild &node) +inline OptionalMatrix IsMatrix(const OptionalChild& node) { OptionalMatrix ret; - if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16 ) + if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 16) { float v[16]; - if( CopyNumbers((*node).CBegin(), 16, v) ) + if(CopyNumbers((*node).CBegin(), 16, v)) { ret = OptionalMatrix(Dali::Matrix(v)); } @@ -228,14 +227,12 @@ inline OptionalMatrix3 IsMatrix3(const OptionalChild& node) { OptionalMatrix3 ret; - if( node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9 ) + if(node && (TreeNode::ARRAY == (*node).GetType()) && (*node).Size() >= 9) { float v[9]; - if( CopyNumbers((*node).CBegin(), 9, v) ) + if(CopyNumbers((*node).CBegin(), 9, v)) { - ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2], - v[3], v[4], v[5], - v[6], v[7], v[8] )); + ret = OptionalMatrix3(Dali::Matrix3(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8])); } } @@ -250,8 +247,8 @@ inline OptionalRect IsRect(const OptionalChild& node) if((*node).Size() >= 4) { TreeNode::ConstIterator iter((*node).CBegin()); - int v[4]; - if( CopyNumbers((*node).CBegin(), 4, v) ) + int v[4]; + if(CopyNumbers((*node).CBegin(), 4, v)) { ret = OptionalRect(Dali::Rect(v[0], v[1], v[2], v[3])); } @@ -268,8 +265,8 @@ inline OptionalExtents IsExtents(const OptionalChild& node) if((*node).Size() >= 4) { TreeNode::ConstIterator iter((*node).CBegin()); - int v[4]; - if( CopyNumbers((*node).CBegin(), 4, v) ) + int v[4]; + if(CopyNumbers((*node).CBegin(), 4, v)) { extents = OptionalExtents(Dali::Extents(v[0], v[1], v[2], v[3])); } @@ -281,164 +278,162 @@ inline OptionalExtents IsExtents(const OptionalChild& node) // // // -inline OptionalString IsString( const TreeNode& parent, const std::string& childName) +inline OptionalString IsString(const TreeNode& parent, const std::string& childName) { - return IsString( IsChild(&parent, childName) ); + return IsString(IsChild(&parent, childName)); } -inline OptionalFloat IsFloat( const TreeNode& parent, const std::string& childName) +inline OptionalFloat IsFloat(const TreeNode& parent, const std::string& childName) { - return IsFloat( IsChild(&parent, childName) ); + return IsFloat(IsChild(&parent, childName)); } -inline OptionalInteger IsInteger( const TreeNode& parent, const std::string& childName) +inline OptionalInteger IsInteger(const TreeNode& parent, const std::string& childName) { - return IsInteger( IsChild(&parent, childName) ); + return IsInteger(IsChild(&parent, childName)); } -inline OptionalBoolean IsBoolean( const TreeNode& parent, const std::string& childName) +inline OptionalBoolean IsBoolean(const TreeNode& parent, const std::string& childName) { - return IsBoolean( IsChild(parent, childName) ); + return IsBoolean(IsChild(parent, childName)); } -inline OptionalVector4 IsVector4(const TreeNode &parent, const std::string& childName) +inline OptionalVector4 IsVector4(const TreeNode& parent, const std::string& childName) { - return IsVector4( IsChild(parent, childName) ); + return IsVector4(IsChild(parent, childName)); } -inline OptionalVector3 IsVector3(const TreeNode &parent, const std::string& childName) +inline OptionalVector3 IsVector3(const TreeNode& parent, const std::string& childName) { - return IsVector3( IsChild(parent, childName) ); + return IsVector3(IsChild(parent, childName)); } -inline OptionalVector2 IsVector2(const TreeNode &parent, const std::string& childName) +inline OptionalVector2 IsVector2(const TreeNode& parent, const std::string& childName) { - return IsVector2( IsChild(parent, childName) ); + return IsVector2(IsChild(parent, childName)); } -inline OptionalMatrix IsMatrix(const TreeNode &parent, const std::string& childName) +inline OptionalMatrix IsMatrix(const TreeNode& parent, const std::string& childName) { - return IsMatrix( IsChild(parent, childName) ); + return IsMatrix(IsChild(parent, childName)); } -inline OptionalMatrix3 IsMatrix3(const TreeNode &parent, const std::string& childName) +inline OptionalMatrix3 IsMatrix3(const TreeNode& parent, const std::string& childName) { - return IsMatrix3( IsChild(&parent, childName) ); + return IsMatrix3(IsChild(&parent, childName)); } -inline OptionalRect IsRect(const TreeNode &parent, const std::string& childName) +inline OptionalRect IsRect(const TreeNode& parent, const std::string& childName) { - return IsRect( IsChild(&parent, childName) ); + return IsRect(IsChild(&parent, childName)); } -inline OptionalExtents IsExtents(const TreeNode &parent, const std::string& childName) +inline OptionalExtents IsExtents(const TreeNode& parent, const std::string& childName) { - return IsExtents( IsChild(&parent, childName) ); + return IsExtents(IsChild(&parent, childName)); } // // // -inline OptionalString IsString( const TreeNode& node ) +inline OptionalString IsString(const TreeNode& node) { - return IsString( OptionalChild( node ) ); + return IsString(OptionalChild(node)); } -inline OptionalFloat IsFloat( const TreeNode& node ) +inline OptionalFloat IsFloat(const TreeNode& node) { - return IsFloat( OptionalChild( node ) ); + return IsFloat(OptionalChild(node)); } -inline OptionalInteger IsInteger( const TreeNode& node ) +inline OptionalInteger IsInteger(const TreeNode& node) { - return IsInteger( OptionalChild( node ) ); + return IsInteger(OptionalChild(node)); } -inline OptionalBoolean IsBoolean( const TreeNode& node ) +inline OptionalBoolean IsBoolean(const TreeNode& node) { - return IsBoolean( OptionalChild( node ) ); + return IsBoolean(OptionalChild(node)); } -inline OptionalVector4 IsVector4(const TreeNode &node ) +inline OptionalVector4 IsVector4(const TreeNode& node) { - return IsVector4( OptionalChild( node ) ); + return IsVector4(OptionalChild(node)); } -inline OptionalVector3 IsVector3(const TreeNode &node ) +inline OptionalVector3 IsVector3(const TreeNode& node) { - return IsVector3( OptionalChild( node ) ); + return IsVector3(OptionalChild(node)); } -inline OptionalVector2 IsVector2(const TreeNode &node ) +inline OptionalVector2 IsVector2(const TreeNode& node) { - return IsVector2( OptionalChild( node ) ); + return IsVector2(OptionalChild(node)); } -inline OptionalMatrix IsMatrix(const TreeNode &node ) +inline OptionalMatrix IsMatrix(const TreeNode& node) { - return IsMatrix( OptionalChild( node ) ); + return IsMatrix(OptionalChild(node)); } -inline OptionalMatrix3 IsMatrix3(const TreeNode &node ) +inline OptionalMatrix3 IsMatrix3(const TreeNode& node) { - return IsMatrix3( OptionalChild( node ) ); + return IsMatrix3(OptionalChild(node)); } -inline OptionalRect IsRect(const TreeNode &node ) +inline OptionalRect IsRect(const TreeNode& node) { - return IsRect( OptionalChild( node ) ); + return IsRect(OptionalChild(node)); } -inline OptionalExtents IsExtents(const TreeNode &node ) +inline OptionalExtents IsExtents(const TreeNode& node) { - return IsExtents( OptionalChild( node ) ); + return IsExtents(OptionalChild(node)); } // // // -inline Dali::Vector4 GetVector4(const TreeNode &child) +inline Dali::Vector4 GetVector4(const TreeNode& child) { - OptionalVector4 v( IsVector4( OptionalChild( child ) ) ); + OptionalVector4 v(IsVector4(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } -inline Dali::Vector3 GetVector3(const TreeNode &child) +inline Dali::Vector3 GetVector3(const TreeNode& child) { - OptionalVector3 v( IsVector3( OptionalChild( child ) ) ); + OptionalVector3 v(IsVector3(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } -inline Dali::Vector2 GetVector2(const TreeNode &child) +inline Dali::Vector2 GetVector2(const TreeNode& child) { - OptionalVector2 v( IsVector2( OptionalChild( child ) ) ); + OptionalVector2 v(IsVector2(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } -inline float GetFloat(const TreeNode &child) +inline float GetFloat(const TreeNode& child) { - OptionalFloat v( IsFloat( OptionalChild( child ) ) ); + OptionalFloat v(IsFloat(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } -inline bool GetBoolean(const TreeNode &child) +inline bool GetBoolean(const TreeNode& child) { - OptionalBoolean v( IsBoolean( OptionalChild( child ) ) ); + OptionalBoolean v(IsBoolean(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } -inline int GetInteger(const TreeNode &child) +inline int GetInteger(const TreeNode& child) { - OptionalInteger v( IsInteger( OptionalChild( child ) ) ); + OptionalInteger v(IsInteger(OptionalChild(child))); DALI_ASSERT_ALWAYS(v); return *v; } - - #endif // DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL diff --git a/dali-toolkit/internal/builder/builder-impl-debug.h b/dali-toolkit/internal/builder/builder-impl-debug.h index 8d30929..14c1c17 100644 --- a/dali-toolkit/internal/builder/builder-impl-debug.h +++ b/dali-toolkit/internal/builder/builder-impl-debug.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,10 @@ * limitations under the License. */ -#include #include +#include -#if defined( DEBUG_ENABLED ) +#if defined(DEBUG_ENABLED) namespace Dali { @@ -28,36 +28,33 @@ namespace Toolkit { namespace Internal { - -#define DUMP_PARSE_TREE(parser) LogTree(parser) -#define DUMP_TEST_MAPPINGS(parser) \ - OptionalChild mappings = IsChild( parser.GetRoot(), KEYNAME_MAPPINGS ); \ - if( mappings ) \ - { \ - std::ostringstream oss; \ - oss << "Mappings: {" << std::endl; \ - for( TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter ) \ - { \ - Property::Value value; \ - bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value ); \ - if( converted ) \ - { \ - oss << " " << (*iter).first << ":" << value << std::endl; \ - } \ - } \ - oss << "}" << std::endl; \ - DALI_LOG_INFO( gFilterScript, Debug::Verbose, oss.str().c_str() ); \ +#define DUMP_PARSE_TREE(parser) LogTree(parser) +#define DUMP_TEST_MAPPINGS(parser) \ + OptionalChild mappings = IsChild(parser.GetRoot(), KEYNAME_MAPPINGS); \ + if(mappings) \ + { \ + std::ostringstream oss; \ + oss << "Mappings: {" << std::endl; \ + for(TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter) \ + { \ + Property::Value value; \ + bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value); \ + if(converted) \ + { \ + oss << " " << (*iter).first << ":" << value << std::endl; \ + } \ + } \ + oss << "}" << std::endl; \ + DALI_LOG_INFO(gFilterScript, Debug::Verbose, oss.str().c_str()); \ } +void LogTree(const Toolkit::JsonParser& mParser); -void LogTree( const Toolkit::JsonParser& mParser ); - -std::string PropertyValueToString( const Property::Value& value ); - +std::string PropertyValueToString(const Property::Value& value); -} // Internal -} // Toolkit -} // Dali +} // namespace Internal +} // namespace Toolkit +} // namespace Dali #else diff --git a/dali-toolkit/internal/builder/builder-impl.h b/dali-toolkit/internal/builder/builder-impl.h index 049b3ce..59ff5de 100644 --- a/dali-toolkit/internal/builder/builder-impl.h +++ b/dali-toolkit/internal/builder/builder-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,48 +19,45 @@ */ // EXTERNAL INCLUDES -#include -#include -#include -#include +#include #include +#include #include #include #include -#include +#include +#include +#include // INTERNAL INCLUDES -#include #include +#include #include #include // Warning messages usually displayed #define DALI_SCRIPT_WARNING(format, ...) \ - DALI_LOG_WARNING("Script:" format, ## __VA_ARGS__) + DALI_LOG_WARNING("Script:" format, ##__VA_ARGS__) // Info messages are usually debug build #define DALI_SCRIPT_INFO(format, ...) \ - DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ## __VA_ARGS__) + DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ##__VA_ARGS__) // Info Verbose need to be swiched on in gFilterScript filter constructor (by default set to General) #define DALI_SCRIPT_VERBOSE(format, ...) \ - DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ## __VA_ARGS__) + DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ##__VA_ARGS__) namespace Dali { - namespace Toolkit { - class TreeNode; +class TreeNode; } namespace Toolkit { - namespace Internal { - #if defined(DEBUG_ENABLED) extern Dali::Integration::Log::Filter* gFilterScript; #endif @@ -74,24 +71,23 @@ class Replacement; class Builder : public Dali::BaseObject { public: - Builder(); /** * @copydoc Toolkit::Builder::LoadFromString */ - void LoadFromString( const std::string &data, - Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON ); + void LoadFromString(const std::string& data, + Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON); /** * @copydoc Toolkit::Builder::AddConstants */ - void AddConstants( const Property::Map& map ); + void AddConstants(const Property::Map& map); /** * @copydoc Toolkit::Builder::AddConstant */ - void AddConstant( const std::string& key, const Property::Value& value ); + void AddConstant(const std::string& key, const Property::Value& value); /** * @copydoc Toolkit::Builder::GetConfigurations @@ -106,52 +102,52 @@ public: /** * @copydoc Toolkit::Builder::GetConstant */ - const Property::Value& GetConstant( const std::string& key ) const; + const Property::Value& GetConstant(const std::string& key) const; /** * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName ); */ - Animation CreateAnimation( const std::string& animationName ); + Animation CreateAnimation(const std::string& animationName); /** * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const Property::Map& map ); */ - Animation CreateAnimation( const std::string& animationName, const Property::Map& map ); + Animation CreateAnimation(const std::string& animationName, const Property::Map& map); /** * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,Dali::Actor); */ - Animation CreateAnimation( const std::string& animationName, Dali::Actor sourceActor ); + Animation CreateAnimation(const std::string& animationName, Dali::Actor sourceActor); /** * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const Property::Map&, Dali::Actor); */ - Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ); + Animation CreateAnimation(const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor); /** * @copydoc Toolkit::Builder::Create( const std::string& templateName ); */ - BaseHandle Create( const std::string& templateName ); + BaseHandle Create(const std::string& templateName); /** * @copydoc Toolkit::Builder::Create( const std::string& templateName, const Property::Map& map ); */ - BaseHandle Create( const std::string& templateName, const Property::Map& map ); + BaseHandle Create(const std::string& templateName, const Property::Map& map); /** * @copydoc Toolkit::Builder::CreateFromJson( const std::string& json ); */ - BaseHandle CreateFromJson( const std::string& json ); + BaseHandle CreateFromJson(const std::string& json); /** * @copydoc Toolkit::Builder::ApplyFromJson( Handle& handle, const std::string& json ); */ - bool ApplyFromJson( Handle& handle, const std::string& json ); + bool ApplyFromJson(Handle& handle, const std::string& json); /** * @copydoc Toolkit::Builder::ApplyStyle */ - bool ApplyStyle( const std::string& styleName, Handle& handle ); + bool ApplyStyle(const std::string& styleName, Handle& handle); /** * Lookup the stylename in builder. If it's found in the parse tree, @@ -159,7 +155,7 @@ public: * @param[in] styleName The style name to search for * @return true if the stylename exists */ - bool LookupStyleName( const std::string& styleName ); + bool LookupStyleName(const std::string& styleName); /** * Lookup the stylename in the recorded Styles - if it exists, @@ -169,32 +165,32 @@ public: * @param[in] styleName The stylename to search for * @return A const pointer to the style object */ - const StylePtr GetStyle( const std::string& styleName ); + const StylePtr GetStyle(const std::string& styleName); /** * @copydoc Toolkit::Builder::AddActors */ - void AddActors( Actor toActor ); + void AddActors(Actor toActor); /** * @copydoc Toolkit::Builder::AddActors */ - void AddActors( const std::string §ionName, Actor toActor ); + void AddActors(const std::string& sectionName, Actor toActor); /** * @copydoc Toolkit::Builder::CreateRenderTask */ - void CreateRenderTask( const std::string &name ); + void CreateRenderTask(const std::string& name); /** * @copydoc Toolkit::Builder::GetPath */ - Path GetPath( const std::string &name ); + Path GetPath(const std::string& name); /** * @copydoc Toolkit::Builder::GetPathConstrainer */ - Dali::PathConstrainer GetPathConstrainer( const std::string& name ); + Dali::PathConstrainer GetPathConstrainer(const std::string& name); /* * Check if a given constrainer is of type PathConstrainer @@ -202,12 +198,12 @@ public: * @return True if constainer is of type PathConstrainer, False otherwise * */ - bool IsPathConstrainer( const std::string& name ); + bool IsPathConstrainer(const std::string& name); /** * @copydoc Toolkit::Builder::GetLinearConstrainer */ - Dali::LinearConstrainer GetLinearConstrainer( const std::string& name ); + Dali::LinearConstrainer GetLinearConstrainer(const std::string& name); /* * Check if a given constrainer is of type LinearConstrainer @@ -215,7 +211,7 @@ public: * @return True if constainer is of type LinearConstrainer, False otherwise * */ - bool IsLinearConstrainer( const std::string& name ); + bool IsLinearConstrainer(const std::string& name); /** * @copydoc Toolkit::Builder::QuitSignal @@ -227,17 +223,23 @@ public: */ void EmitQuitSignal(); - protected: - ~Builder() override; private: - typedef std::vector KeyStack; - typedef std::vector< TreeNode::KeyNodePair > MappingsLut; - typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry; + typedef std::vector KeyStack; + typedef std::vector MappingsLut; + typedef struct + { + std::string name; + Dali::LinearConstrainer linearConstrainer; + } LinearConstrainerEntry; typedef std::vector LinearConstrainerLut; - typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry; + typedef struct + { + std::string name; + Dali::PathConstrainer pathConstrainer; + } PathConstrainerEntry; typedef std::vector PathConstrainerLut; typedef std::map PathLut; @@ -248,77 +250,77 @@ private: // Undefined Builder& operator=(const Builder& rhs); - void LoadConstants( const TreeNode& root, Property::Map& intoMap ); - - void LoadConfiguration( const TreeNode& root, Property::Map& intoMap ); + void LoadConstants(const TreeNode& root, Property::Map& intoMap); - Animation CreateAnimation( const std::string& animationName, - const Replacement& replacement, - Dali::Actor sourceActor ); + void LoadConfiguration(const TreeNode& root, Property::Map& intoMap); - BaseHandle Create( const std::string& templateName, - const Replacement& constant ); + Animation CreateAnimation(const std::string& animationName, + const Replacement& replacement, + Dali::Actor sourceActor); - BaseHandle DoCreate( const TreeNode& root, - const TreeNode& node, - Actor parent, - const Replacement& replacements ); + BaseHandle Create(const std::string& templateName, + const Replacement& constant); - void SetupTask( RenderTask& task, - const Toolkit::TreeNode& node, - const Replacement& replacement ); + BaseHandle DoCreate(const TreeNode& root, + const TreeNode& node, + Actor parent, + const Replacement& replacements); - bool ApplyStyle( const std::string& styleName, - Handle& handle, - const Replacement& replacement); + void SetupTask(RenderTask& task, + const Toolkit::TreeNode& node, + const Replacement& replacement); - void ApplyAllStyleProperties( const TreeNode& root, - const TreeNode& node, - Dali::Handle& handle, - const Replacement& constant ); + bool ApplyStyle(const std::string& styleName, + Handle& handle, + const Replacement& replacement); - void RecordStyles( const char* styleName, - const TreeNode& node, - Dali::Handle& handle, - const Replacement& replacements ); + void ApplyAllStyleProperties(const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant); - void RecordStyle( StylePtr style, + void RecordStyles(const char* styleName, const TreeNode& node, Dali::Handle& handle, - const Replacement& replacements ); + const Replacement& replacements); - void RecordTransitions( const TreeNode::KeyNodePair& keyValue, - Property::Array& transitions, - const Replacement& replacements ); + void RecordStyle(StylePtr style, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& replacements); - void RecordTransitionData( const TreeNode::KeyNodePair& keyNode, - Toolkit::TransitionData& transitionData, - const Replacement& replacements ); + void RecordTransitions(const TreeNode::KeyNodePair& keyValue, + Property::Array& transitions, + const Replacement& replacements); - void ApplyProperties( const TreeNode& root, - const TreeNode& node, - Dali::Handle& handle, - const Replacement& constant ); + void RecordTransitionData(const TreeNode::KeyNodePair& keyNode, + Toolkit::TransitionData& transitionData, + const Replacement& replacements); - void ApplySignals( const TreeNode& root, - const TreeNode& node, - Dali::Handle& handle ); + void ApplyProperties(const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant); - void ApplyStylesByActor( const TreeNode& root, - const TreeNode& node, - Dali::Handle& handle, - const Replacement& constant ); + void ApplySignals(const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle); - void SetProperties( const TreeNode& node, - Handle& handle, - const Replacement& constant ); + void ApplyStylesByActor(const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant); - bool MapToTargetProperty( Handle& propertyObject, - const std::string& key, - const TreeNode& node, - const Replacement& constant, - Property::Index& index, - Property::Value& value ); + void SetProperties(const TreeNode& node, + Handle& handle, + const Replacement& constant); + + bool MapToTargetProperty(Handle& propertyObject, + const std::string& key, + const TreeNode& node, + const Replacement& constant, + Property::Index& index, + Property::Value& value); /** * Find the key in the mapping table, if it's present, then generate @@ -330,16 +332,16 @@ private: * @param[in] propertyType The property type if known, or NONE * @param[in,out] value The string value to test and write back to. */ - bool GetPropertyMap( const TreeNode& mappingRoot, - const char* theKey, - Property::Type propertyType, - Property::Value& value ); + bool GetPropertyMap(const TreeNode& mappingRoot, + const char* theKey, + Property::Type propertyType, + Property::Value& value); - void SetCustomProperties( const TreeNode& node, - Handle& handle, - const Replacement& constant, - const std::string& childName, - Property::AccessMode accessMode ); + void SetCustomProperties(const TreeNode& node, + Handle& handle, + const Replacement& constant, + const std::string& childName, + Property::AccessMode accessMode); /** * Find the key in the mapping table, if it's present, then generate @@ -352,12 +354,11 @@ private: * @param[in] propertyType The property type if known, or NONE * @param[in,out] value The string value to test and write back to. */ - bool RecursePropertyMap( const TreeNode& mappingRoot, - KeyStack& keyStack, - const char* theKey, - Property::Type propertyType, - Property::Value& value ); - + bool RecursePropertyMap(const TreeNode& mappingRoot, + KeyStack& keyStack, + const char* theKey, + Property::Type propertyType, + Property::Value& value); /** * Tests if the value is a string delimited by <>. If it is, then it attempts to @@ -367,9 +368,9 @@ private: * @param[in,out] value The string value to test and write back to. * @return true if the value was converted, false otherwise. */ - bool ConvertChildValue( const TreeNode& mappingRoot, - KeyStack& keyStack, - Property::Value& value ); + bool ConvertChildValue(const TreeNode& mappingRoot, + KeyStack& keyStack, + Property::Value& value); private: Toolkit::JsonParser mParser; diff --git a/dali-toolkit/internal/builder/builder-set-property.h b/dali-toolkit/internal/builder/builder-set-property.h index a9ae431..b5f523a 100644 --- a/dali-toolkit/internal/builder/builder-set-property.h +++ b/dali-toolkit/internal/builder/builder-set-property.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ namespace Toolkit { namespace Internal { - /** * Set a property value from a tree node. * This function determines the type of the property from the format of the string in the node. @@ -31,8 +30,8 @@ namespace Internal * @param node The node string to convert from * @param value The property value to set */ -void DeterminePropertyFromNode( const TreeNode& node, - Property::Value& value ); +void DeterminePropertyFromNode(const TreeNode& node, + Property::Value& value); /** * Set a property value from a tree node as DeterminePropertyFromNode() above @@ -42,9 +41,9 @@ void DeterminePropertyFromNode( const TreeNode& node, * @param value The property value to set * @param replacement The overriding replacement map (if any) */ -void DeterminePropertyFromNode( const TreeNode& node, - Property::Value& value, - const Replacement& replacement ); +void DeterminePropertyFromNode(const TreeNode& node, + Property::Value& value, + const Replacement& replacement); /** * Set a property value as the given type from a tree node. @@ -53,9 +52,9 @@ void DeterminePropertyFromNode( const TreeNode& node, * @param value The property value to set * @return true if the string could be converted to the correct type. */ -bool DeterminePropertyFromNode( const TreeNode& node, - Property::Type type, - Property::Value& value ); +bool DeterminePropertyFromNode(const TreeNode& node, + Property::Type type, + Property::Value& value); /** * Set a property value as the given type from a tree node as DeterminePropertyFromNode() above @@ -65,14 +64,13 @@ bool DeterminePropertyFromNode( const TreeNode& node, * @param replacement The overriding replacement map (if any) * @return true if the string could be converted to the correct type. */ -bool DeterminePropertyFromNode( const TreeNode& node, - Property::Type type, - Property::Value& value, - const Replacement& replacement ); - +bool DeterminePropertyFromNode(const TreeNode& node, + Property::Type type, + Property::Value& value, + const Replacement& replacement); -} // Internal namespace -} // Toolkit namespace -} // Dali namespace +} // namespace Internal +} // namespace Toolkit +} // namespace Dali #endif //DALI_TOOLKIT_INTERNAL_BUILDER_SET_PROPERTY_H diff --git a/dali-toolkit/internal/builder/dictionary.h b/dali-toolkit/internal/builder/dictionary.h index a3036d9..b570c04 100644 --- a/dali-toolkit/internal/builder/dictionary.h +++ b/dali-toolkit/internal/builder/dictionary.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ namespace Toolkit { namespace Internal { - /** * The Dictionary template class enables a means of storing key-value * pairs where the keys are strings and the value can be a complex @@ -41,7 +40,7 @@ namespace Internal using DictionaryKeys = std::vector; -inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict ) +inline void Merge(DictionaryKeys& toDict, const DictionaryKeys& fromDict) { for(const auto& element : fromDict) { @@ -53,7 +52,6 @@ inline void Merge( DictionaryKeys& toDict, const DictionaryKeys& fromDict ) } } - template class Dictionary { @@ -64,7 +62,7 @@ private: struct Element { std::string key; - EntryType entry; + EntryType entry; Element(std::string name, EntryType entry) : key(std::move(name)), entry(std::move(entry)) @@ -82,9 +80,9 @@ private: auto FindElement(std::string_view key) { - return std::find_if(container.begin(), container.end(), [key](auto& e){ - return bool(key == e.key); - }); + return std::find_if(container.begin(), container.end(), [key](auto& e) { + return bool(key == e.key); + }); } public: @@ -138,12 +136,12 @@ public: if(iter != End()) { - container.erase( iter ); + container.erase(iter); } } } - void Merge( const Dictionary& dictionary ) + void Merge(const Dictionary& dictionary) { for(const auto& element : dictionary.container) { @@ -166,7 +164,7 @@ public: */ const EntryType* FindConst(std::string_view key) const { - if( ! key.empty() ) + if(!key.empty()) { auto iter = FindElementCaseInsensitive(key); @@ -184,7 +182,7 @@ public: */ EntryType* Find(std::string_view key) const { - if( ! key.empty() ) + if(!key.empty()) { auto iter = FindElementCaseInsensitive(key); @@ -209,7 +207,7 @@ public: return container.cend(); } - void GetKeys( DictionaryKeys& keys ) const + void GetKeys(DictionaryKeys& keys) const { keys.clear(); for(const auto& element : container) @@ -224,10 +222,8 @@ public: } }; - - -}//Internal -}//Toolkit -}//Dali +} // namespace Internal +} // namespace Toolkit +} // namespace Dali #endif // DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H diff --git a/dali-toolkit/internal/builder/json-parser-impl.h b/dali-toolkit/internal/builder/json-parser-impl.h index f635a82..58c2ce0 100644 --- a/dali-toolkit/internal/builder/json-parser-impl.h +++ b/dali-toolkit/internal/builder/json-parser-impl.h @@ -2,7 +2,7 @@ #define DALI_JSON_PARSER_IMPL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,10 @@ */ // EXTERNAL INCLUDES -#include -#include #include #include +#include +#include // INTERNAL INCLUDES #include @@ -32,13 +32,10 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - /* * Parses JSON */ @@ -105,45 +102,42 @@ public: void Write(std::ostream& output, int indent) const; private: - typedef std::vector VectorChar; + typedef std::vector VectorChar; typedef VectorChar::iterator VectorCharIter; - typedef std::list SourceContainer; + typedef std::list SourceContainer; typedef std::list::iterator SourceContainerIter; - JsonParser(JsonParser &); + JsonParser(JsonParser&); JsonParser& operator=(const JsonParser&); - SourceContainer mSources; ///< List of strings from Parse() merge operations - - TreeNode* mRoot; ///< Tree root + SourceContainer mSources; ///< List of strings from Parse() merge operations - const char *mErrorDescription; ///< Last parse error description - int mErrorPosition; ///< Last parse error position - int mErrorLine; ///< Last parse error line - int mErrorColumn; ///< Last parse error column + TreeNode* mRoot; ///< Tree root - int mNumberOfChars; ///< The size of string data for all nodes - int mNumberOfNodes; ///< Node count + const char* mErrorDescription; ///< Last parse error description + int mErrorPosition; ///< Last parse error position + int mErrorLine; ///< Last parse error line + int mErrorColumn; ///< Last parse error column + int mNumberOfChars; ///< The size of string data for all nodes + int mNumberOfNodes; ///< Node count }; } // namespace Internal - inline const Internal::JsonParser& GetImplementation(const Toolkit::JsonParser& parser) { - DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" ); + DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty"); const BaseObject& handle = parser.GetBaseObject(); return static_cast(handle); } - inline Internal::JsonParser& GetImplementation(Toolkit::JsonParser& parser) { - DALI_ASSERT_ALWAYS( parser && "JsonParser handle is empty" ); + DALI_ASSERT_ALWAYS(parser && "JsonParser handle is empty"); BaseObject& handle = parser.GetBaseObject(); @@ -154,5 +148,4 @@ inline Internal::JsonParser& GetImplementation(Toolkit::JsonParser& parser) } // namespace Dali - #endif // DALI_JSON_PARSER_IMPL_H diff --git a/dali-toolkit/internal/builder/json-parser-state.h b/dali-toolkit/internal/builder/json-parser-state.h index 4d7e7a4..d6eb0e9 100644 --- a/dali-toolkit/internal/builder/json-parser-state.h +++ b/dali-toolkit/internal/builder/json-parser-state.h @@ -2,7 +2,7 @@ #define DALI_JSON_PARSE_STATE_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,20 +28,17 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - /** * A safer std::advance() */ -template +template inline int AdvanceIter(IteratorType& iter, EndIteratorType& end, int n) { - for(int i =0; i < n; ++i) + for(int i = 0; i < n; ++i) { if(iter == end) { @@ -85,51 +82,69 @@ public: * Get the error description of the last parse * @return The error description or NULL if no error */ - const char* GetErrorDescription() { return mErrorDescription; } + const char* GetErrorDescription() + { + return mErrorDescription; + } /** * Get the error line number * @return The line number of the error */ - int GetErrorLineNumber() { return mErrorNewLine; } + int GetErrorLineNumber() + { + return mErrorNewLine; + } /** * Get the error column * @return The error column */ - int GetErrorColumn() { return mErrorColumn; } + int GetErrorColumn() + { + return mErrorColumn; + } /** * Get the error position * @return The error position */ - int GetErrorPosition() { return mErrorPosition; } + int GetErrorPosition() + { + return mErrorPosition; + } /** * Get the size of the string data that has been parsed * @return The size of string data */ - int GetParsedStringSize() { return mNumberOfParsedChars; }; + int GetParsedStringSize() + { + return mNumberOfParsedChars; + }; /** * Get the number of nodes created * @return The number of nodes */ - int GetCreatedNodeCount() { return mNumberOfCreatedNodes; }; + int GetCreatedNodeCount() + { + return mNumberOfCreatedNodes; + }; private: - VectorCharIter mIter; ///< Current position - VectorCharIter mStart; ///< Start position - VectorCharIter mEnd; ///< End of buffer being parsed - TreeNode* mRoot; ///< Root node created - TreeNodeManipulator mCurrent; ///< The Current modifiable node - const char* mErrorDescription; ///< The error description if set - int mErrorNewLine; ///< The error line number - int mErrorColumn; ///< The error column - int mErrorPosition; ///< The error position - int mNumberOfParsedChars; ///< The size of string data - int mNumberOfCreatedNodes; ///< The number of nodes created - bool mFirstParse; ///< Flag if first parse + VectorCharIter mIter; ///< Current position + VectorCharIter mStart; ///< Start position + VectorCharIter mEnd; ///< End of buffer being parsed + TreeNode* mRoot; ///< Root node created + TreeNodeManipulator mCurrent; ///< The Current modifiable node + const char* mErrorDescription; ///< The error description if set + int mErrorNewLine; ///< The error line number + int mErrorColumn; ///< The error column + int mErrorPosition; ///< The error position + int mNumberOfParsedChars; ///< The size of string data + int mNumberOfCreatedNodes; ///< The number of nodes created + bool mFirstParse; ///< Flag if first parse /** * The current parse state @@ -231,7 +246,7 @@ private: { return Error("Attempt to walk up above root"); } - mCurrent = TreeNodeManipulator( mCurrent.GetParent() ); + mCurrent = TreeNodeManipulator(mCurrent.GetParent()); return true; } @@ -269,7 +284,7 @@ private: { int c = AdvanceIter(mIter, mEnd, n); mErrorPosition += c; - mErrorColumn += c; + mErrorColumn += c; } /** @@ -279,7 +294,7 @@ private: { int c = AdvanceIter(mIter, mEnd, n); mErrorPosition += c; - mErrorColumn += c; + mErrorColumn += c; return mEnd == mIter; } @@ -290,8 +305,8 @@ private: { int c = AdvanceIter(mIter, mEnd, n); mErrorPosition += c; - mErrorColumn += c; - static_cast( ParseWhiteSpace() ); + mErrorColumn += c; + static_cast(ParseWhiteSpace()); } /** @@ -421,7 +436,6 @@ private: bool HandleCharacterComma(const char* name); }; - } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/builder/optional-value.h b/dali-toolkit/internal/builder/optional-value.h index 666dd30..7251ad2 100644 --- a/dali-toolkit/internal/builder/optional-value.h +++ b/dali-toolkit/internal/builder/optional-value.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_OPTIONAL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,70 +18,115 @@ * */ -template +template struct OptionalTypes { - typedef T ValueType; - typedef const T& ReturnType; - static ReturnType Get(const ValueType& v) { return v; } - static ValueType Set(const ReturnType v) { return v; } - static bool Ok(const ValueType& v) { return true; } + typedef T ValueType; + typedef const T& ReturnType; + static ReturnType Get(const ValueType& v) + { + return v; + } + static ValueType Set(const ReturnType v) + { + return v; + } + static bool Ok(const ValueType& v) + { + return true; + } }; -template +template struct OptionalTypes { - typedef T* ValueType; - typedef const T* ReturnType; - static ReturnType Get(const ValueType v) { return v; } - static ValueType Set(const ReturnType v) { return v; } - static bool Ok(const ReturnType v) { return NULL != v; } + typedef T* ValueType; + typedef const T* ReturnType; + static ReturnType Get(const ValueType v) + { + return v; + } + static ValueType Set(const ReturnType v) + { + return v; + } + static bool Ok(const ReturnType v) + { + return NULL != v; + } }; -template +template struct OptionalTypes { - typedef T* ValueType; - typedef const T& ReturnType; - static ReturnType Get(const ValueType v) { return *v; } - static ValueType Set(const ReturnType v) { return &v; } - static bool Ok(const ReturnType v) { return true; } + typedef T* ValueType; + typedef const T& ReturnType; + static ReturnType Get(const ValueType v) + { + return *v; + } + static ValueType Set(const ReturnType v) + { + return &v; + } + static bool Ok(const ReturnType v) + { + return true; + } }; -template +template class OptionalValue { public: - typedef void ( OptionalValue::*bool_type )() const; + typedef void (OptionalValue::*bool_type)() const; typedef typename OptionalTypes::ReturnType ReturnType; - typedef typename OptionalTypes::ValueType ValueType; + typedef typename OptionalTypes::ValueType ValueType; - OptionalValue(): mOk(false), mValue() {} - OptionalValue( T value ): mOk(OptionalTypes::Ok(value)), mValue(OptionalTypes::Set(value)) {} - OptionalValue( bool b, T value ): mOk(b), mValue(OptionalTypes::Set(value)) {} + OptionalValue() + : mOk(false), + mValue() + { + } + OptionalValue(T value) + : mOk(OptionalTypes::Ok(value)), + mValue(OptionalTypes::Set(value)) + { + } + OptionalValue(bool b, T value) + : mOk(b), + mValue(OptionalTypes::Set(value)) + { + } - ReturnType operator *() const { return OptionalTypes::Get(mValue); } + ReturnType operator*() const + { + return OptionalTypes::Get(mValue); + } // safe bool idiom - operator bool_type() const { + operator bool_type() const + { return mOk == true ? &OptionalValue::this_type_does_not_support_comparisons : 0; } private: - bool mOk; + bool mOk; ValueType mValue; - void this_type_does_not_support_comparisons() const {} + void this_type_does_not_support_comparisons() const + { + } }; -template -bool operator==( const OptionalValue& lhs, const OptionalValue& rhs ) +template +bool operator==(const OptionalValue& lhs, const OptionalValue& rhs) { lhs.this_type_does_not_support_comparisons(); return false; } -template -bool operator!=( const OptionalValue& lhs, const OptionalValue& rhs ) +template +bool operator!=(const OptionalValue& lhs, const OptionalValue& rhs) { lhs.this_type_does_not_support_comparisons(); return false; diff --git a/dali-toolkit/internal/builder/replacement.h b/dali-toolkit/internal/builder/replacement.h index 24260de..7780ec6 100644 --- a/dali-toolkit/internal/builder/replacement.h +++ b/dali-toolkit/internal/builder/replacement.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,18 +27,15 @@ namespace Dali { - namespace Toolkit { - class TreeNode; +class TreeNode; } namespace Toolkit { - namespace Internal { - /* * Supports template replacement functionality * @@ -46,7 +43,6 @@ namespace Internal class Replacement { public: - /* * Constructor */ @@ -59,7 +55,7 @@ public: * @param overrideMap The user overriding map * @param defaultMap The default map to use */ - Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap ); + Replacement(const Property::Map& overrideMap, const Property::Map& defaultMap); /* * Constructor with default map @@ -67,175 +63,175 @@ public: * Make a deep copy of the tree. * @param overrideMap The user overriding map */ - Replacement( const Property::Map& defaultMap ); + Replacement(const Property::Map& defaultMap); /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalString IsString( const TreeNode& node ) const; + OptionalString IsString(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalBoolean IsBoolean( const TreeNode & node ) const; + OptionalBoolean IsBoolean(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalFloat IsFloat( const TreeNode & node ) const; + OptionalFloat IsFloat(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalInteger IsInteger( const TreeNode & node ) const; + OptionalInteger IsInteger(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalVector2 IsVector2( const TreeNode & node ) const; + OptionalVector2 IsVector2(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalVector3 IsVector3( const TreeNode & node ) const; + OptionalVector3 IsVector3(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalVector4 IsVector4( const TreeNode & node ) const; + OptionalVector4 IsVector4(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalMatrix IsMatrix( const TreeNode & node ) const; + OptionalMatrix IsMatrix(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalMatrix3 IsMatrix3( const TreeNode & node ) const; + OptionalMatrix3 IsMatrix3(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalRect IsRect( const TreeNode & node ) const; + OptionalRect IsRect(const TreeNode& node) const; /* @brief Check node for a type * * @param node The TreeNode to check * @return Optional value */ - OptionalExtents IsExtents( const TreeNode & node ) const; + OptionalExtents IsExtents(const TreeNode& node) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalString IsString( OptionalChild child ) const; + OptionalString IsString(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalFloat IsFloat( OptionalChild child ) const; + OptionalFloat IsFloat(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalBoolean IsBoolean( OptionalChild child ) const; + OptionalBoolean IsBoolean(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalInteger IsInteger( OptionalChild child ) const; + OptionalInteger IsInteger(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalVector2 IsVector2( OptionalChild child ) const; + OptionalVector2 IsVector2(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalVector3 IsVector3( OptionalChild child ) const; + OptionalVector3 IsVector3(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalVector4 IsVector4( OptionalChild child ) const; + OptionalVector4 IsVector4(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalMatrix IsMatrix( OptionalChild child ) const; + OptionalMatrix IsMatrix(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalMatrix3 IsMatrix3( OptionalChild child ) const; + OptionalMatrix3 IsMatrix3(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalRect IsRect( OptionalChild child ) const; + OptionalRect IsRect(OptionalChild child) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - bool IsMap( OptionalChild child, Property::Value& out ) const; + bool IsMap(OptionalChild child, Property::Value& out) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - bool IsArray( OptionalChild child, Property::Value& out ) const; + bool IsArray(OptionalChild child, Property::Value& out) const; /* @brief Check node for a type * * @param child The optional child TreeNode * @return Optional value */ - OptionalExtents IsExtents( OptionalChild child ) const; + OptionalExtents IsExtents(OptionalChild child) const; private: // Overriding map (overrides the default map). The map is not owned. @@ -249,11 +245,10 @@ private: // Replacement( const Replacement& copy ); // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}" - OptionalString HasFullReplacement( const TreeNode & node ) const; + OptionalString HasFullReplacement(const TreeNode& node) const; // Returns the property value for a full replacement from the maps - Property::Value GetFullReplacement( const std::string& replacementString ) const; - + Property::Value GetFullReplacement(const std::string& replacementString) const; }; } // namespace Internal diff --git a/dali-toolkit/internal/builder/style.h b/dali-toolkit/internal/builder/style.h index 0265ff6..a99e17b 100644 --- a/dali-toolkit/internal/builder/style.h +++ b/dali-toolkit/internal/builder/style.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ * limitations under the License. */ -#include #include #include +#include namespace Dali { @@ -27,7 +27,6 @@ namespace Toolkit { namespace Internal { - class Style; typedef IntrusivePtr