2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/object/property-key.h>
23 Property::Key::Key(const std::string& key)
25 indexKey(Property::INVALID_INDEX),
30 Property::Key::Key(Property::Index key)
36 Property::Key::Key(const char* key)
38 indexKey(Property::INVALID_INDEX),
43 bool Property::Key::operator==(const std::string& rhs)
46 if(type == Key::STRING)
48 result = (stringKey == rhs);
53 bool Property::Key::operator==(const char* rhs)
55 return operator==(std::string(rhs));
58 bool Property::Key::operator==(Property::Index rhs)
61 if(type == Key::INDEX)
63 result = (indexKey == rhs);
68 bool Property::Key::operator==(const Key& rhs)
71 if(type == Key::STRING && rhs.type == Key::STRING)
73 result = (stringKey == rhs.stringKey);
75 else if(type == Key::INDEX && rhs.type == Key::INDEX)
77 result = (indexKey == rhs.indexKey);
82 bool Property::Key::operator!=(const std::string& rhs)
84 return !operator==(rhs);
87 bool Property::Key::operator!=(const char* rhs)
89 return !operator==(rhs);
92 bool Property::Key::operator!=(Property::Index rhs)
94 return !operator==(rhs);
97 bool Property::Key::operator!=(const Key& rhs)
99 return !operator==(rhs);
102 std::ostream& operator<<(std::ostream& stream, const Property::Key& key)
104 if(key.type == Property::Key::INDEX)
106 stream << key.indexKey;
110 stream << key.stringKey;