OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
geometrs.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of persistent streaming for window system geometry classes
7//----------------------------------------------------------------------------
8#include <owl/pch.h>
9#include <owl/defs.h>
10#include <owl/geometry.h>
11
12namespace owl {
13
14//----------------------------------------------------------------------------
15// TRect streaming
16//
17
18//
19/// Extracts the rectangle from a regular input stream.
20//
23{
24 tchar ch;
25 return is >> ch >> r.left >> ch >> r.top >> ch
26 >> r.right >> ch >> r.bottom >> ch;
27}
28
29//
30/// Formats and inserts the given TRect object, r, into the ostream, os. The format
31/// is (r.left, r.top)(r.right, r.bottom). Returns a reference to the resulting
32/// stream and allows the usual chaining of << operations.
33//
36{
37 return os << _T('(') << r.left << _T(',') << r.top << _T('-')
38 << r.right << _T(',') << r.bottom << _T(')');
39}
40
41//----------------------------------------------------------------------------
42// TPointL streaming
43//
44
45//
46// Extract the point from a regular input stream.
47//
50{
51 tchar c;
52
53 is >> c;
54
55 long x;
56 is >> x;
57 p.x = x;
58
59 is >> c;
60
61 long y;
62 is >> y;
63 p.y = y;
64
65 is >> c;
66
67 return is;
68}
69
70//
71// Insert the point into an output stream.
72//
75{
76 return os << _T('(') << p.x << _T(',') << p.y << _T(')');
77}
78
79//----------------------------------------------------------------------------
80// TPointF streaming
81//
82
83//
84// Extract a point from a regular input stream.
85//
88{
89 tchar c;
90 return is >> c >> p.x >> c >> p.y >> c;
91}
92
93//
94// Insert a point into the output stream.
95//
98{
99 return os << _T('(') << p.x << _T(',') << p.y << _T(')');
100}
101
102
103//----------------------------------------------------------------------------
104// TPoint streaming
105//
106
107//
108/// Extracts a TPoint object from stream is, and copies it to p. Returns a reference
109/// to the resulting stream, allowing the usual chaining of >> operations.
110//
113{
114 tchar c;
115 return is >> c >> p.x >> c >> p.y >> c;
116}
117
118//
119/// Formats and inserts the given TPoint object p into the ostream os. The format is
120/// "(x,y)". Returns a reference to the resulting stream, allowing the usual
121/// chaining of << operations.
122//
124operator <<(tostream& os, const TPoint& p)
125{
126 return os << _T('(') << p.x << _T(',') << p.y << _T(')');
127}
128
129//----------------------------------------------------------------------------
130// TSize streaming
131//
132
133//
134/// Formats and inserts the given TSize object s into the ostream os. The format is
135/// "(cx x cy)". Returns a reference to the resulting stream, allowing the usual
136/// chaining of << operations.
137//
140{
141 tchar c;
142 return os >> c >> s.cx >> c >> s.cy >> c;
143}
144
145//
146/// Insert a size into an output stream.
147//
149operator <<(tostream& os, const TSize& s)
150{
151 return os << _T('(') << s.cx << _T('x') << s.cy << _T(')');
152}
153
154} // OWL namespace
155
TPointF is similar to TPoint, but uses floating variables rather than integers.
Definition geometry.h:181
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
TPointL is similar to TPoint, but uses long rather than int variables.
Definition geometry.h:132
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
#define _T(x)
Definition cygwin.h:51
Classes for window system geometry.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
Definition color.h:498
char tchar
Definition defs.h:77
std::istream tistream
Definition strmdefs.h:39
std::ostream tostream
Definition strmdefs.h:40
General definitions used by all ObjectWindows programs.
#define _OWLCFUNC(p)
Definition defs.h:342