1 #ifndef DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
2 #define DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
4 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include "dali-scene-loader/public-api/api.h"
26 #include "dali/public-api/common/vector-wrapper.h"
33 * @brief Offers a description of an aspect of the scene that can be customized:
34 * the number of options, and the name of the nodes that are registered
35 * for the tag, whose children will be shown / hidden based on selection.
37 struct DALI_SCENE_LOADER_API Customization
39 using Tag = std::string;
40 using OptionType = uint32_t;
43 * @brief A mapping of customizations to tags.
45 struct DALI_SCENE_LOADER_API Map
51 * @brief Maps the given @a customization to the given @a tag, overwriting any previous mapping to the same tag.
52 * @return Pointer to the inserted (or pre-existing) Customization instance.
54 Customization* Set(Tag tag, Customization&& customization);
57 * @brief Attempts to retrieve a const Customization based on the given @a tag.
59 const Customization* Get(Tag tag) const;
62 * @brief Attempts to retrieve a Customization based on the given @a tag.
64 Customization* Get(Tag tag);
67 * @brief Returns the number of elements.
69 uint32_t Size() const;
72 * @brief Removes every element from the Map.
78 const std::unique_ptr<Impl> mImpl;
82 * @brief A mapping of choices - indices of children of customization nodes to use - to tags.
84 struct DALI_SCENE_LOADER_API Choices
90 * @brief Maps the given @a option to the given @a tag, overwriting any previous mapping to the same tag.
92 void Set(Tag tag, OptionType option);
95 * @brief Attempts to retrieve a Customization based on the given @a tag. Returns NONE if @a tag is not known.
97 OptionType Get(Tag tag) const;
100 * @brief Returns the number of elements.
102 uint32_t Size() const;
105 * @brief Removes every element from the underlying map.
111 const std::unique_ptr<Impl> mImpl;
114 static const OptionType NONE = OptionType(-1);
116 OptionType numOptions = 0;
117 std::vector<std::string> nodes; // to apply option to.
120 } // namespace SceneLoader
123 #endif //DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_