OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
geometrp.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// Borland WinSys Library
3// Copyright (c) 1993, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementation of persistent streaming for window system structure and type
7/// encapsulation
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/defs.h>
11#include <owl/geometry.h>
12
13namespace owl {
14
15//----------------------------------------------------------------------------
16// TRect streaming
17//
18
19//
20/// Extracts a TRect object from is, the given input stream, and copies it to r.
21/// Returns a reference to the resulting stream, allowing the usual chaining of >>
22/// operations.
23//
24_OWLCFUNC(ipstream&)
26{
27 return is >> r.left >> r.top >> r.right >> r.bottom;
28}
29
30//
31/// Inserts the given TRect object, r, into the opstream, os. Returns a reference to
32/// the resulting stream, allowing the usual chaining of << operations.
33//
36{
37 return os << r.left << r.top << r.right << r.bottom;
38}
39
40//----------------------------------------------------------------------------
41// TPointL streaming
42//
43
44//
45// Extract the point from the input persistent stream.
46//
47_OWLCFUNC(ipstream&)
49{
50 long x;
51 is >> x;
52 p.x = x;
53
54 long y;
55 is >> y;
56 p.y = y;
57
58 return is;
59}
60
61//
62// Insert the point into an output persistent stream.
63//
66{
67 return os << p.x << p.y;
68}
69
70//----------------------------------------------------------------------------
71// TPointF streaming
72//
73
74//
75// Extract a point from the persistent input stream.
76//
77_OWLCFUNC(ipstream&)
79{
80 return is >> p.x >> p.y;
81}
82
83//
84// Insert a point into the output persistent stream.
85//
88{
89 return os << p.x << p.y;
90}
91
92//----------------------------------------------------------------------------
93// TPoint streaming
94//
95
96//
97/// Extracts a TPoint object from persistent stream is, and copies it to p. Returns
98/// a reference to the resulting stream, allowing the usual chaining of >>
99/// operations.
100//
101_OWLCFUNC(ipstream&)
103{
104 return is >> p.x >> p.y;
105}
106
107//
108/// Inserts the given TPoint object p into persistent stream os. Returns a reference
109/// to the resulting stream, allowing the usual chaining of << operations.
110//
112operator <<(opstream& os, const TPoint& p)
113{
114 return os << p.x << p.y;
115}
116
117//----------------------------------------------------------------------------
118// TSize streaming
119//
120
121//
122/// Extracts a TSize object from is, the given input stream, and copies it to s.
123/// Returns a reference to the resulting stream, allowing the usual chaining of >>
124/// operations.
125//
126_OWLCFUNC(ipstream&)
128{
129 return is >> s.cx >> s.cy;
130}
131
132//
133/// Inserts the given TSize object s into the opstream os. Returns a reference to
134/// the resulting stream, allowing the usual chaining of << operations.
135//
137operator <<(opstream& os, const TSize& s)
138{
139 return os << s.cx << s.cy;
140}
141
142
143} // OWL namespace
144
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
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition objstrm.h:391
Base class for writing streamable objects.
Definition objstrm.h:480
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
General definitions used by all ObjectWindows programs.
#define _OWLCFUNC(p)
Definition defs.h:342