Formatted API
[platform/core/uifw/dali-core.git] / dali / public-api / common / extents.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/common/extents.h>
20
21 namespace Dali
22 {
23 Extents::Extents()
24 : start(0),
25   end(0),
26   top(0),
27   bottom(0)
28 {
29 }
30
31 Extents::Extents(uint16_t start, uint16_t end, uint16_t top, uint16_t bottom)
32 : start(start),
33   end(end),
34   top(top),
35   bottom(bottom)
36 {
37 }
38
39 Extents& Extents::operator=(const uint16_t* array)
40 {
41   start  = array[0];
42   end    = array[1];
43   top    = array[2];
44   bottom = array[3];
45
46   return *this;
47 }
48
49 bool Extents::operator==(const Extents& rhs) const
50 {
51   return (start == rhs.start) &&
52          (end == rhs.end) &&
53          (top == rhs.top) &&
54          (bottom == rhs.bottom);
55 }
56
57 bool Extents::operator!=(const Extents& rhs) const
58 {
59   return !(*this == rhs);
60 }
61
62 std::ostream& operator<<(std::ostream& stream, const Extents& extents)
63 {
64   return stream << "[" << extents.start << ", " << extents.end << ", " << extents.top << ", " << extents.bottom << "]";
65 }
66
67 } // namespace Dali