2 * Copyright (c) 2019 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>
25 Property::Key::Key( const std::string& key )
26 : type( Key::STRING ),
27 indexKey( Property::INVALID_INDEX ),
32 Property::Key::Key( Property::Index key )
38 Property::Key::Key( const char * key )
39 : type( Key::STRING ),
40 indexKey( Property::INVALID_INDEX ),
45 bool Property::Key::operator== (const std::string& rhs)
48 if(type == Key::STRING)
50 result = (stringKey == rhs);
55 bool Property::Key::operator== ( const char* rhs )
57 return operator==( std::string( rhs ) );
60 bool Property::Key::operator== (Property::Index rhs)
63 if(type == Key::INDEX)
65 result = (indexKey == rhs);
70 bool Property::Key::operator== (const Key& rhs)
73 if(type == Key::STRING && rhs.type == Key::STRING )
75 result = (stringKey == rhs.stringKey);
77 else if( type == Key::INDEX && rhs.type == Key::INDEX )
79 result = (indexKey == rhs.indexKey);
84 bool Property::Key::operator!= (const std::string& rhs)
86 return !operator==(rhs);
89 bool Property::Key::operator!= ( const char* rhs )
91 return !operator==(rhs);
94 bool Property::Key::operator!= (Property::Index rhs)
96 return !operator==(rhs);
99 bool Property::Key::operator!= (const Key& rhs)
101 return !operator==(rhs);
104 std::ostream& operator<<( std::ostream& stream, const Property::Key& key )
106 if( key.type == Property::Key::INDEX )
108 stream << key.indexKey;
112 stream << key.stringKey;