1 #ifndef DALI_PROPERTY_KEY_H
2 #define DALI_PROPERTY_KEY_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
26 #include <dali/public-api/common/dali-common.h>
27 #include <dali/public-api/object/property.h>
32 * @addtogroup dali_core_object
37 * @brief A key type which can be either a std::string or a Property::Index
40 struct DALI_CORE_API Property::Key
43 * @brief The type of key
48 INDEX, ///< The key is a Property::Index
49 STRING ///< The key is a string
50 } type; ///< The type of the key
52 Property::Index indexKey; ///< The index key.
53 std::string stringKey; ///< The string key.
59 * @param[in] key The string key
61 Key(const std::string& key);
67 * @param[in] key The string key as a const char *
75 * @param[in] key The index key
77 Key(Property::Index key);
80 * @brief The equality operator
83 * @param[in] rhs A string key to compare against.
84 * @return true if the key compares, or false if it isn't equal or of the wrong type
86 bool operator==(const std::string& rhs);
92 * @param[in] key The string key as a const char *
93 * @return true if the key compares, or false if it isn't equal or of the wrong type
95 bool operator==(const char* key);
98 * @brief The equality operator
101 * @param[in] rhs An index key to compare against.
102 * @return true if the key compares, or false if it isn't equal or of the wrong type
104 bool operator==(Property::Index rhs);
107 * @brief The equality operator
110 * @param[in] rhs A key to compare against.
111 * @return true if the keys are of the same type and have the same value
113 bool operator==(const Key& rhs);
116 * @brief The inequality operator
119 * @param[in] rhs A string key to compare against.
120 * @return true if the key is not equal or not a string key
122 bool operator!=(const std::string& rhs);
125 * @brief The inequality operator
128 * @param[in] rhs A const char* key to compare against.
129 * @return true if the key is not equal or not a string key
131 bool operator!=(const char* rhs);
134 * @brief The inequality operator
137 * @param[in] rhs An index key to compare against.
138 * @return true if the key is not equal, or not an index key
140 bool operator!=(Property::Index rhs);
143 * @brief The inequality operator
146 * @param[in] rhs A key to compare against.
147 * @return true if the keys are not of the same type or are not equal
149 bool operator!=(const Key& rhs);
153 * @brief Convert the key into a string and append to an output stream.
156 * @param [in] stream The output stream operator.
157 * @param [in] key the key to convert
158 * @return The output stream operator.
160 DALI_CORE_API std::ostream& operator<<(std::ostream& stream, const Property::Key& key);
167 #endif // DALI_PROPERTY_KEY_H