1 #ifndef __DALI_PROPERTY_KEY_H__
2 #define __DALI_PROPERTY_KEY_H__
5 * Copyright (c) 2016 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_IMPORT_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 explicit Key( const std::string& key );
67 * @param[in] key The index key
69 explicit Key( Property::Index key );
72 * @brief The equality operator
75 * @param[in] rhs A string key to compare against.
76 * @return true if the key compares, or false if it isn't equal or of the wrong type
78 bool operator== (const std::string& rhs);
81 * @brief The equality operator
84 * @param[in] rhs An index key to compare against.
85 * @return true if the key compares, or false if it isn't equal or of the wrong type
87 bool operator== (Property::Index rhs);
90 * @brief The equality operator
93 * @param[in] rhs A key to compare against.
94 * @return true if the keys are of the same type and have the same value
96 bool operator== (const Key& rhs);
99 * @brief The inequality operator
102 * @param[in] rhs A string key to compare against.
103 * @return true if the key is not equal or not a string key
105 bool operator!= (const std::string& rhs);
108 * @brief The inequality operator
111 * @param[in] rhs An index key to compare against.
112 * @return true if the key is not equal, or not an index key
114 bool operator!= (Property::Index rhs);
117 * @brief The inequality operator
120 * @param[in] rhs A key to compare against.
121 * @return true if the keys are not of the same type or are not equal
123 bool operator!= (const Key& rhs);
127 * @brief Convert the key into a string and append to an output stream.
130 * @param [in] stream The output stream operator.
131 * @param [in] key the key to convert
132 * @return The output stream operator.
134 DALI_IMPORT_API std::ostream& operator<<( std::ostream& stream, const Property::Key& key );
142 #endif // __DALI_PROPERTY_KEY_H__