OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
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
12
namespace
owl
{
13
14
//----------------------------------------------------------------------------
15
// TRect streaming
16
//
17
18
//
19
/// Extracts the rectangle from a regular input stream.
20
//
21
_OWLCFUNC
(
tistream
&)
22
operator >>(
tistream
& is,
TRect
& r)
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
//
34
_OWLCFUNC
(
tostream
&)
35
operator <<
(
tostream
& os,
const
TRect
& r)
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
//
48
_OWLCFUNC
(
tistream
&)
49
operator >>(
tistream
& is,
TPointL
& p)
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
//
73
_OWLCFUNC
(
tostream
&)
74
operator <<
(
tostream
& os,
const
TPointL
& p)
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
//
86
_OWLCFUNC
(
tistream
&)
87
operator >>(
tistream
& is,
TPointF
& p)
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
//
96
_OWLCFUNC
(
tostream
&)
97
operator <<
(
tostream
& os,
const
TPointF
& p)
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
//
111
_OWLCFUNC
(
tistream
&)
112
operator >>(
tistream
& is,
TPoint
& p)
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
//
123
_OWLCFUNC
(
tostream
&)
124
operator <<
(
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
//
138
_OWLCFUNC
(
tistream
&)
139
operator >>(
tistream
& os,
TSize
& s)
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
//
148
_OWLCFUNC
(
tostream
&)
149
operator <<
(
tostream
& os,
const
TSize
& s)
150
{
151
return
os <<
_T
(
'('
) << s.cx <<
_T
(
'x'
) << s.cy <<
_T
(
')'
);
152
}
153
154
}
// OWL namespace
155
owl::TPointF
TPointF is similar to TPoint, but uses floating variables rather than integers.
Definition
geometry.h:181
owl::TPoint
TPoint is a support class, derived from tagPOINT.
Definition
geometry.h:87
owl::TPointL
TPointL is similar to TPoint, but uses long rather than int variables.
Definition
geometry.h:132
owl::TRect
TRect is a mathematical class derived from tagRect.
Definition
geometry.h:308
owl::TSize
The tagSIZE struct is defined as.
Definition
geometry.h:234
_T
#define _T(x)
Definition
cygwin.h:51
geometry.h
Classes for window system geometry.
pch.h
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::operator<<
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
Definition
color.h:498
owl::tchar
char tchar
Definition
defs.h:77
owl::tistream
std::istream tistream
Definition
strmdefs.h:39
owl::tostream
std::ostream tostream
Definition
strmdefs.h:40
defs.h
General definitions used by all ObjectWindows programs.
_OWLCFUNC
#define _OWLCFUNC(p)
Definition
defs.h:342
owl::tPOINTF::y
float y
Definition
geometry.h:173
owl::tPOINTF::x
float x
Definition
geometry.h:172
source
owlcore
geometrs.cpp
Generated by
1.18.0