Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_TOOLS_GEN_HXX
20 : #define INCLUDED_TOOLS_GEN_HXX
21 :
22 : #include <tools/toolsdllapi.h>
23 :
24 : #include <limits.h>
25 : #include <ostream>
26 : #include <cstdlib>
27 :
28 : class SvStream;
29 :
30 : enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, TRISTATE_INDET };
31 :
32 : // Pair
33 :
34 : class SAL_WARN_UNUSED Pair
35 : {
36 : public:
37 : Pair();
38 : Pair( long nA, long nB );
39 :
40 1 : long A() const { return nA; }
41 1 : long B() const { return nB; }
42 :
43 70185 : long& A() { return nA; }
44 70173 : long& B() { return nB; }
45 :
46 : bool operator == ( const Pair& rPair ) const;
47 : bool operator != ( const Pair& rPair ) const;
48 :
49 : TOOLS_DLLPUBLIC friend SvStream& ReadPair( SvStream& rIStream, Pair& rPair );
50 : TOOLS_DLLPUBLIC friend SvStream& WritePair( SvStream& rOStream, const Pair& rPair );
51 :
52 : protected:
53 : long nA;
54 : long nB;
55 : };
56 :
57 31032729 : inline Pair::Pair()
58 : {
59 31032729 : nA = nB = 0;
60 31032729 : }
61 :
62 57716417 : inline Pair::Pair( long _nA, long _nB )
63 : {
64 57716417 : Pair::nA = _nA;
65 57716417 : Pair::nB = _nB;
66 57716417 : }
67 :
68 1015239 : inline bool Pair::operator == ( const Pair& rPair ) const
69 : {
70 1015239 : return ((nA == rPair.nA) && (nB == rPair.nB));
71 : }
72 :
73 8349454 : inline bool Pair::operator != ( const Pair& rPair ) const
74 : {
75 8349454 : return ((nA != rPair.nA) || (nB != rPair.nB));
76 : }
77 :
78 : // Point
79 :
80 : class SAL_WARN_UNUSED Point : public Pair
81 : {
82 : public:
83 : Point();
84 : Point( long nX, long nY );
85 :
86 43863572 : long X() const { return nA; }
87 27853963 : long Y() const { return nB; }
88 :
89 46355337 : long& X() { return nA; }
90 44276488 : long& Y() { return nB; }
91 :
92 : void Move( long nHorzMove, long nVertMove );
93 : bool IsAbove( const Point& rPoint ) const;
94 : bool IsBelow( const Point& rPoint ) const;
95 : bool IsLeft( const Point& rPoint ) const;
96 : bool IsRight( const Point& rPoint ) const;
97 :
98 : Point& operator += ( const Point& rPoint );
99 : Point& operator -= ( const Point& rPoint );
100 : Point& operator *= ( const long nVal );
101 : Point& operator /= ( const long nVal );
102 :
103 : friend inline Point operator+( const Point &rVal1, const Point &rVal2 );
104 : friend inline Point operator-( const Point &rVal1, const Point &rVal2 );
105 : friend inline Point operator*( const Point &rVal1, const long nVal2 );
106 : friend inline Point operator/( const Point &rVal1, const long nVal2 );
107 :
108 6428679 : long getX() const { return X(); }
109 5838192 : long getY() const { return Y(); }
110 501343 : void setX(long nX) { X() = nX; }
111 592658 : void setY(long nY) { Y() = nY; }
112 : };
113 :
114 7438845 : inline Point::Point()
115 : {
116 7438845 : }
117 :
118 42471962 : inline Point::Point( long nX, long nY ) : Pair( nX, nY )
119 : {
120 42471962 : }
121 :
122 661 : inline void Point::Move( long nHorzMove, long nVertMove )
123 : {
124 661 : nA += nHorzMove;
125 661 : nB += nVertMove;
126 661 : }
127 :
128 : inline bool Point::IsAbove( const Point& rPoint ) const
129 : {
130 : return (nB > rPoint.nB);
131 : }
132 :
133 : inline bool Point::IsBelow( const Point& rPoint ) const
134 : {
135 : return (nB < rPoint.nB);
136 : }
137 :
138 : inline bool Point::IsLeft( const Point& rPoint ) const
139 : {
140 : return (nA < rPoint.nA);
141 : }
142 :
143 : inline bool Point::IsRight( const Point& rPoint ) const
144 : {
145 : return (nA > rPoint.nA);
146 : }
147 :
148 2065499 : inline Point& Point::operator += ( const Point& rPoint )
149 : {
150 2065499 : nA += rPoint.nA;
151 2065499 : nB += rPoint.nB;
152 2065499 : return *this;
153 : }
154 :
155 191816 : inline Point& Point::operator -= ( const Point& rPoint )
156 : {
157 191816 : nA -= rPoint.nA;
158 191816 : nB -= rPoint.nB;
159 191816 : return *this;
160 : }
161 :
162 576 : inline Point& Point::operator *= ( const long nVal )
163 : {
164 576 : nA *= nVal;
165 576 : nB *= nVal;
166 576 : return *this;
167 : }
168 :
169 0 : inline Point& Point::operator /= ( const long nVal )
170 : {
171 0 : nA /= nVal;
172 0 : nB /= nVal;
173 0 : return *this;
174 : }
175 :
176 1806546 : inline Point operator+( const Point &rVal1, const Point &rVal2 )
177 : {
178 1806546 : return Point( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
179 : }
180 :
181 1641336 : inline Point operator-( const Point &rVal1, const Point &rVal2 )
182 : {
183 1641336 : return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
184 : }
185 :
186 0 : inline Point operator*( const Point &rVal1, const long nVal2 )
187 : {
188 0 : return Point( rVal1.nA*nVal2, rVal1.nB*nVal2 );
189 : }
190 :
191 0 : inline Point operator/( const Point &rVal1, const long nVal2 )
192 : {
193 0 : return Point( rVal1.nA/nVal2, rVal1.nB/nVal2 );
194 : }
195 :
196 : template< typename charT, typename traits >
197 : inline std::basic_ostream<charT, traits> & operator <<(
198 : std::basic_ostream<charT, traits> & stream, const Point& point )
199 : {
200 : return stream << point.X() << ',' << point.Y();
201 : }
202 :
203 : // Size
204 :
205 : class SAL_WARN_UNUSED Size : public Pair
206 : {
207 : public:
208 : Size();
209 : Size( long nWidth, long nHeight );
210 :
211 23750281 : long Width() const { return nA; }
212 22120336 : long Height() const { return nB; }
213 :
214 77590020 : long& Width() { return nA; }
215 11958903 : long& Height() { return nB; }
216 :
217 8388687 : long getWidth() const { return Width(); }
218 8016166 : long getHeight() const { return Height(); }
219 1509444 : void setWidth(long nWidth) { Width() = nWidth; }
220 1455166 : void setHeight(long nHeight) { Height() = nHeight; }
221 : };
222 :
223 23587179 : inline Size::Size()
224 : {
225 23587179 : }
226 :
227 14784627 : inline Size::Size( long nWidth, long nHeight ) :
228 14784627 : Pair( nWidth, nHeight )
229 : {
230 14784627 : }
231 :
232 : template< typename charT, typename traits >
233 : inline std::basic_ostream<charT, traits> & operator <<(
234 : std::basic_ostream<charT, traits> & stream, const Size& size )
235 : {
236 : return stream << size.Width() << 'x' << size.Height();
237 : }
238 :
239 : // Range
240 :
241 : #define RANGE_MAX LONG_MAX
242 :
243 : class SAL_WARN_UNUSED Range : public Pair
244 : {
245 : public:
246 : Range();
247 : Range( long nMin, long nMax );
248 :
249 3745 : long Min() const { return nA; }
250 3911 : long Max() const { return nB; }
251 358125 : long Len() const { return nB - nA + 1; }
252 :
253 1059114 : long& Min() { return nA; }
254 1845510 : long& Max() { return nB; }
255 :
256 : bool IsInside( long nIs ) const;
257 :
258 : void Justify();
259 : };
260 :
261 265 : inline Range::Range()
262 : {
263 265 : }
264 :
265 455228 : inline Range::Range( long nMin, long nMax ) : Pair( nMin, nMax )
266 : {
267 455228 : }
268 :
269 560 : inline bool Range::IsInside( long nIs ) const
270 : {
271 560 : return ((nA <= nIs) && (nIs <= nB ));
272 : }
273 :
274 36339 : inline void Range::Justify()
275 : {
276 36339 : if ( nA > nB )
277 : {
278 31 : long nHelp = nA;
279 31 : nA = nB;
280 31 : nB = nHelp;
281 : }
282 36339 : }
283 :
284 : template< typename charT, typename traits >
285 : inline std::basic_ostream<charT, traits> & operator <<(
286 : std::basic_ostream<charT, traits> & stream, const Range& range )
287 : {
288 : return stream << range.Min() << '-' << range.Max();
289 : }
290 :
291 : // Selection
292 :
293 : #define SELECTION_MIN LONG_MIN
294 : #define SELECTION_MAX LONG_MAX
295 :
296 : class SAL_WARN_UNUSED Selection : public Pair
297 : {
298 : public:
299 : Selection();
300 : Selection( long nPos );
301 : Selection( long nMin, long nMax );
302 :
303 0 : long Min() const { return nA; }
304 0 : long Max() const { return nB; }
305 16160 : long Len() const { return nB - nA; }
306 :
307 24922 : long& Min() { return nA; }
308 24463 : long& Max() { return nB; }
309 :
310 : bool IsInside( long nIs ) const;
311 :
312 : void Justify();
313 :
314 818 : bool operator !() const { return !Len(); }
315 :
316 0 : long getMin() const { return Min(); }
317 : long getMax() const { return Max(); }
318 0 : void setMin(long nMin) { Min() = nMin; }
319 0 : void setMax(long nMax) { Max() = nMax; }
320 : };
321 :
322 6440 : inline Selection::Selection()
323 : {
324 6440 : }
325 :
326 0 : inline Selection::Selection( long nPos ) : Pair( nPos, nPos )
327 : {
328 0 : }
329 :
330 4598 : inline Selection::Selection( long nMin, long nMax ) :
331 4598 : Pair( nMin, nMax )
332 : {
333 4598 : }
334 :
335 0 : inline bool Selection::IsInside( long nIs ) const
336 : {
337 0 : return ((nA <= nIs) && (nIs < nB ));
338 : }
339 :
340 4058 : inline void Selection::Justify()
341 : {
342 4058 : if ( nA > nB )
343 : {
344 1 : long nHelp = nA;
345 1 : nA = nB;
346 1 : nB = nHelp;
347 : }
348 4058 : }
349 :
350 : template< typename charT, typename traits >
351 : inline std::basic_ostream<charT, traits> & operator <<(
352 : std::basic_ostream<charT, traits> & stream, const Selection& selection )
353 : {
354 : return stream << selection.Min() << '-' << selection.Max();
355 : }
356 : // Rectangle
357 :
358 : #define RECT_EMPTY ((short)-32767)
359 :
360 : class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Rectangle
361 : {
362 : public:
363 : Rectangle();
364 : Rectangle( const Point& rLT, const Point& rRB );
365 : Rectangle( long nLeft, long nTop,
366 : long nRight, long nBottom );
367 : Rectangle( const Point& rLT, const Size& rSize );
368 :
369 6261021 : long Left() const { return nLeft; }
370 5738442 : long Right() const { return nRight; }
371 6160192 : long Top() const { return nTop; }
372 5694875 : long Bottom() const { return nBottom; }
373 :
374 9773270 : long& Left() { return nLeft; }
375 3262782 : long& Right() { return nRight; }
376 10578716 : long& Top() { return nTop; }
377 4186400 : long& Bottom() { return nBottom; }
378 :
379 : inline Point TopLeft() const;
380 : inline Point TopRight() const;
381 : inline Point TopCenter() const;
382 : inline Point BottomLeft() const;
383 : inline Point BottomRight() const;
384 : inline Point BottomCenter() const;
385 : inline Point LeftCenter() const;
386 : inline Point RightCenter() const;
387 : inline Point Center() const;
388 :
389 : inline void Move( long nHorzMove, long nVertMove );
390 : inline void Transpose();
391 : inline void SetPos( const Point& rPoint );
392 : void SetSize( const Size& rSize );
393 : inline Size GetSize() const;
394 :
395 : inline long GetWidth() const;
396 : inline long GetHeight() const;
397 :
398 : Rectangle& Union( const Rectangle& rRect );
399 : Rectangle& Intersection( const Rectangle& rRect );
400 : inline Rectangle GetUnion( const Rectangle& rRect ) const;
401 : inline Rectangle GetIntersection( const Rectangle& rRect ) const;
402 :
403 : void Justify();
404 :
405 : bool IsInside( const Point& rPOINT ) const;
406 : bool IsInside( const Rectangle& rRect ) const;
407 : bool IsOver( const Rectangle& rRect ) const;
408 :
409 288211 : void SetEmpty() { nRight = nBottom = RECT_EMPTY; }
410 : inline bool IsEmpty() const;
411 :
412 : inline bool operator == ( const Rectangle& rRect ) const;
413 : inline bool operator != ( const Rectangle& rRect ) const;
414 :
415 : inline Rectangle& operator += ( const Point& rPt );
416 : inline Rectangle& operator -= ( const Point& rPt );
417 :
418 : friend inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt );
419 : friend inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt );
420 :
421 : TOOLS_DLLPUBLIC friend SvStream& ReadRectangle( SvStream& rIStream, Rectangle& rRect );
422 : TOOLS_DLLPUBLIC friend SvStream& WriteRectangle( SvStream& rOStream, const Rectangle& rRect );
423 :
424 : // ONE
425 751 : long getX() const { return nLeft; }
426 1418 : long getY() const { return nTop; }
427 70933 : long getWidth() const { return nRight - nLeft; }
428 69361 : long getHeight() const { return nBottom - nTop; }
429 13448 : void setX( long n ) { nRight += n-nLeft; nLeft = n; }
430 13200 : void setY( long n ) { nBottom += n-nTop; nTop = n; }
431 85761 : void setWidth( long n ) { nRight = nLeft + n; }
432 94057 : void setHeight( long n ) { nBottom = nTop + n; }
433 :
434 : private:
435 : long nLeft;
436 : long nTop;
437 : long nRight;
438 : long nBottom;
439 : };
440 :
441 4775922 : inline Rectangle::Rectangle()
442 : {
443 4775922 : nLeft = nTop = 0;
444 4775922 : nRight = nBottom = RECT_EMPTY;
445 4775922 : }
446 :
447 629875 : inline Rectangle::Rectangle( const Point& rLT, const Point& rRB )
448 : {
449 629875 : nLeft = rLT.X();
450 629875 : nTop = rLT.Y();
451 629875 : nRight = rRB.X();
452 629875 : nBottom = rRB.Y();
453 629875 : }
454 :
455 2924151 : inline Rectangle::Rectangle( long _nLeft, long _nTop,
456 : long _nRight, long _nBottom )
457 : {
458 2924151 : nLeft = _nLeft;
459 2924151 : nTop = _nTop;
460 2924151 : nRight = _nRight;
461 2924151 : nBottom = _nBottom;
462 2924151 : }
463 :
464 3182338 : inline Rectangle::Rectangle( const Point& rLT, const Size& rSize )
465 : {
466 3182338 : nLeft = rLT.X();
467 3182338 : nTop = rLT.Y();
468 3182338 : nRight = rSize.Width() ? nLeft+rSize.Width()-1 : RECT_EMPTY;
469 3182338 : nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY;
470 3182338 : }
471 :
472 9501509 : inline bool Rectangle::IsEmpty() const
473 : {
474 9501509 : return ((nRight == RECT_EMPTY) || (nBottom == RECT_EMPTY));
475 : }
476 :
477 2367091 : inline Point Rectangle::TopLeft() const
478 : {
479 2367091 : return Point( nLeft, nTop );
480 : }
481 :
482 1691342 : inline Point Rectangle::TopRight() const
483 : {
484 1691342 : return Point( (nRight == RECT_EMPTY) ? nLeft : nRight, nTop );
485 : }
486 :
487 1704608 : inline Point Rectangle::BottomLeft() const
488 : {
489 1704608 : return Point( nLeft, (nBottom == RECT_EMPTY) ? nTop : nBottom );
490 : }
491 :
492 1731530 : inline Point Rectangle::BottomRight() const
493 : {
494 1731530 : return Point( (nRight == RECT_EMPTY) ? nLeft : nRight,
495 3463060 : (nBottom == RECT_EMPTY) ? nTop : nBottom );
496 : }
497 :
498 124 : inline Point Rectangle::TopCenter() const
499 : {
500 124 : if ( IsEmpty() )
501 0 : return Point( nLeft, nTop );
502 : else
503 248 : return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ),
504 372 : std::min( nTop, nBottom) );
505 : }
506 :
507 130 : inline Point Rectangle::BottomCenter() const
508 : {
509 130 : if ( IsEmpty() )
510 0 : return Point( nLeft, nTop );
511 : else
512 260 : return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ),
513 390 : std::max( nTop, nBottom) );
514 : }
515 :
516 124 : inline Point Rectangle::LeftCenter() const
517 : {
518 124 : if ( IsEmpty() )
519 0 : return Point( nLeft, nTop );
520 : else
521 124 : return Point( std::min( nLeft, nRight ), nTop + (nBottom - nTop)/2 );
522 : }
523 :
524 124 : inline Point Rectangle::RightCenter() const
525 : {
526 124 : if ( IsEmpty() )
527 0 : return Point( nLeft, nTop );
528 : else
529 124 : return Point( std::max( nLeft, nRight ), nTop + (nBottom - nTop)/2 );
530 : }
531 :
532 209836 : inline Point Rectangle::Center() const
533 : {
534 209836 : if ( IsEmpty() )
535 45240 : return Point( nLeft, nTop );
536 : else
537 164596 : return Point( nLeft+(nRight-nLeft)/2 , nTop+(nBottom-nTop)/2 );
538 : }
539 :
540 292943 : inline void Rectangle::Move( long nHorzMove, long nVertMove )
541 : {
542 292943 : nLeft += nHorzMove;
543 292943 : nTop += nVertMove;
544 292943 : if ( nRight != RECT_EMPTY )
545 188582 : nRight += nHorzMove;
546 292943 : if ( nBottom != RECT_EMPTY )
547 186885 : nBottom += nVertMove;
548 292943 : }
549 :
550 0 : void Rectangle::Transpose()
551 : {
552 0 : if ( !IsEmpty() )
553 : {
554 0 : long swap( nLeft );
555 0 : nLeft = nTop;
556 0 : nTop = swap;
557 :
558 0 : swap = nRight;
559 0 : nRight = nBottom;
560 0 : nBottom = swap;
561 : }
562 0 : }
563 :
564 9434 : inline void Rectangle::SetPos( const Point& rPoint )
565 : {
566 9434 : if ( nRight != RECT_EMPTY )
567 4105 : nRight += rPoint.X() - nLeft;
568 9434 : if ( nBottom != RECT_EMPTY )
569 6302 : nBottom += rPoint.Y() - nTop;
570 9434 : nLeft = rPoint.X();
571 9434 : nTop = rPoint.Y();
572 9434 : }
573 :
574 2539076 : inline long Rectangle::GetWidth() const
575 : {
576 : long n;
577 2539076 : if ( nRight == RECT_EMPTY )
578 77278 : n = 0;
579 : else
580 : {
581 2461798 : n = nRight - nLeft;
582 2461798 : if( n < 0 )
583 1706 : n--;
584 : else
585 2460092 : n++;
586 : }
587 :
588 2539076 : return n;
589 : }
590 :
591 2909976 : inline long Rectangle::GetHeight() const
592 : {
593 : long n;
594 2909976 : if ( nBottom == RECT_EMPTY )
595 72273 : n = 0;
596 : else
597 : {
598 2837703 : n = nBottom - nTop;
599 2837703 : if ( n < 0 )
600 1713 : n--;
601 : else
602 2835990 : n++;
603 : }
604 :
605 2909976 : return n;
606 : }
607 :
608 531770 : inline Size Rectangle::GetSize() const
609 : {
610 531770 : return Size( GetWidth(), GetHeight() );
611 : }
612 :
613 0 : inline Rectangle Rectangle::GetUnion( const Rectangle& rRect ) const
614 : {
615 0 : Rectangle aTmpRect( *this );
616 0 : return aTmpRect.Union( rRect );
617 : }
618 :
619 314414 : inline Rectangle Rectangle::GetIntersection( const Rectangle& rRect ) const
620 : {
621 314414 : Rectangle aTmpRect( *this );
622 314414 : return aTmpRect.Intersection( rRect );
623 : }
624 :
625 41612 : inline bool Rectangle::operator == ( const Rectangle& rRect ) const
626 : {
627 61753 : return ((nLeft == rRect.nLeft ) &&
628 39801 : (nTop == rRect.nTop ) &&
629 76319 : (nRight == rRect.nRight ) &&
630 56659 : (nBottom == rRect.nBottom ));
631 : }
632 :
633 127521 : inline bool Rectangle::operator != ( const Rectangle& rRect ) const
634 : {
635 205958 : return ((nLeft != rRect.nLeft ) ||
636 155936 : (nTop != rRect.nTop ) ||
637 275899 : (nRight != rRect.nRight ) ||
638 198400 : (nBottom != rRect.nBottom ));
639 : }
640 :
641 471150 : inline Rectangle& Rectangle::operator +=( const Point& rPt )
642 : {
643 471150 : nLeft += rPt.X();
644 471150 : nTop += rPt.Y();
645 471150 : if ( nRight != RECT_EMPTY )
646 470573 : nRight += rPt.X();
647 471150 : if ( nBottom != RECT_EMPTY )
648 455810 : nBottom += rPt.Y();
649 471150 : return *this;
650 : }
651 :
652 19923 : inline Rectangle& Rectangle::operator -= ( const Point& rPt )
653 : {
654 19923 : nLeft -= rPt.X();
655 19923 : nTop -= rPt.Y();
656 19923 : if ( nRight != RECT_EMPTY )
657 19923 : nRight -= rPt.X();
658 19923 : if ( nBottom != RECT_EMPTY )
659 19923 : nBottom -= rPt.Y();
660 19923 : return *this;
661 : }
662 :
663 10570 : inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt )
664 : {
665 21140 : Rectangle aRect( rRect.nLeft + rPt.X(), rRect.nTop + rPt.Y(),
666 21140 : (rRect.nRight == RECT_EMPTY) ? RECT_EMPTY : rRect.nRight + rPt.X(),
667 52850 : (rRect.nBottom == RECT_EMPTY) ? RECT_EMPTY : rRect.nBottom + rPt.Y() );
668 10570 : return aRect;
669 : }
670 :
671 1509 : inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt )
672 : {
673 1509 : Rectangle aRect( rRect.nLeft - rPt.X(),
674 1509 : rRect.nTop - rPt.Y(),
675 3018 : (rRect.nRight == RECT_EMPTY) ? RECT_EMPTY : rRect.nRight - rPt.X(),
676 7545 : (rRect.nBottom == RECT_EMPTY) ? RECT_EMPTY : rRect.nBottom - rPt.Y() );
677 1509 : return aRect;
678 : }
679 :
680 : template< typename charT, typename traits >
681 : inline std::basic_ostream<charT, traits> & operator <<(
682 : std::basic_ostream<charT, traits> & stream, const Rectangle& rectangle )
683 : {
684 : if (rectangle.IsEmpty())
685 : return stream << "EMPTY";
686 : else
687 : return stream << rectangle.getWidth() << 'x' << rectangle.getHeight()
688 : << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")";
689 : }
690 :
691 : #endif
692 :
693 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|