1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _BGFX_RANGE_B1IRANGE_HXX
25 #define _BGFX_RANGE_B1IRANGE_HXX
26 
27 #include <basegfx/range/basicrange.hxx>
28 #include <basegfx/basegfxdllapi.h>
29 
30 
31 namespace basegfx
32 {
33 	class BASEGFX_DLLPUBLIC B1IRange
34 	{
35 		::basegfx::BasicRange< sal_Int32, Int32Traits >	maRange;
36 
37 	public:
B1IRange()38 		B1IRange()
39 		{
40 		}
41 
B1IRange(sal_Int32 nStartValue)42 		explicit B1IRange(sal_Int32 nStartValue)
43 		:	maRange(nStartValue)
44 		{
45 		}
46 
B1IRange(sal_Int32 nStartValue1,sal_Int32 nStartValue2)47 		B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
48 		:	maRange(nStartValue1)
49 		{
50             expand(nStartValue2);
51 		}
52 
B1IRange(const B1IRange & rRange)53 		B1IRange(const B1IRange& rRange)
54 		:	maRange(rRange.maRange)
55 		{
56 		}
57 
isEmpty() const58 		bool isEmpty() const
59 		{
60 			return maRange.isEmpty();
61 		}
62 
reset()63 		void reset()
64 		{
65 			maRange.reset();
66 		}
67 
operator ==(const B1IRange & rRange) const68 		bool operator==( const B1IRange& rRange ) const
69 		{
70 			return (maRange == rRange.maRange);
71 		}
72 
operator !=(const B1IRange & rRange) const73 		bool operator!=( const B1IRange& rRange ) const
74 		{
75 			return (maRange != rRange.maRange);
76 		}
77 
operator =(const B1IRange & rRange)78 		B1IRange& operator=(const B1IRange& rRange)
79 		{
80 			maRange = rRange.maRange;
81 			return *this;
82 		}
83 
getMinimum() const84 		sal_Int32 getMinimum() const
85 		{
86 			return maRange.getMinimum();
87 		}
88 
getMaximum() const89 		sal_Int32 getMaximum() const
90 		{
91 			return maRange.getMaximum();
92 		}
93 
getRange() const94 		Int32Traits::DifferenceType getRange() const
95 		{
96 			return maRange.getRange();
97 		}
98 
getCenter() const99 		double getCenter() const
100 		{
101 			return maRange.getCenter();
102 		}
103 
isInside(sal_Int32 nValue) const104 		bool isInside(sal_Int32 nValue) const
105 		{
106 			return maRange.isInside(nValue);
107 		}
108 
isInside(const B1IRange & rRange) const109 		bool isInside(const B1IRange& rRange) const
110 		{
111 			return maRange.isInside(rRange.maRange);
112 		}
113 
overlaps(const B1IRange & rRange) const114 		bool overlaps(const B1IRange& rRange) const
115 		{
116 			return maRange.overlaps(rRange.maRange);
117 		}
118 
expand(sal_Int32 nValue)119 		void expand(sal_Int32 nValue)
120 		{
121 			maRange.expand(nValue);
122 		}
123 
expand(const B1IRange & rRange)124 		void expand(const B1IRange& rRange)
125 		{
126 			maRange.expand(rRange.maRange);
127 		}
128 
intersect(const B1IRange & rRange)129 		void intersect(const B1IRange& rRange)
130 		{
131 			maRange.intersect(rRange.maRange);
132 		}
133 
grow(sal_Int32 nValue)134 		void grow(sal_Int32 nValue)
135 		{
136 			maRange.grow(nValue);
137 		}
138 	};
139 } // end of namespace basegfx
140 
141 #endif /* _BGFX_RANGE_B1IRANGE_HXX */
142