Mir

Merge lp:~alan-griffiths/mir/fix-1247820 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1213
Proposed branch: lp:~alan-griffiths/mir/fix-1247820
Merge into: lp:mir
Diff against target: 223 lines (+71/-36)
9 files modified
examples/CMakeLists.txt (+1/-0)
include/shared/mir/geometry/displacement.h (+2/-6)
include/shared/mir/geometry/point.h (+2/-7)
include/shared/mir/geometry/rectangle.h (+2/-7)
include/shared/mir/geometry/size.h (+2/-7)
src/server/CMakeLists.txt (+1/-0)
src/shared/geometry/CMakeLists.txt (+1/-0)
src/shared/geometry/ostream.cpp (+60/-0)
src/shared/geometry/rectangles.cpp (+0/-9)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1247820
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+194506@code.launchpad.net

Commit message

geometry: remove implementation of streaming operators from headers
(LP: #1247820)

Description of the change

geometry: remove implementation of streaming operators from headers

These headers are used a lot - pulling in <ostream> is unnecessary when <iosfwd> will do just fine.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/CMakeLists.txt'
2--- examples/CMakeLists.txt 2013-09-23 13:37:44 +0000
3+++ examples/CMakeLists.txt 2013-11-08 13:06:22 +0000
4@@ -114,6 +114,7 @@
5 target_link_libraries(mir_demo_standalone_render_surfaces
6 mirserver
7 mirshell
8+ mirsharedgeometry
9 ${Boost_LIBRARIES}
10 )
11
12
13=== modified file 'include/shared/mir/geometry/displacement.h'
14--- include/shared/mir/geometry/displacement.h 2013-08-28 03:41:48 +0000
15+++ include/shared/mir/geometry/displacement.h 2013-11-08 13:06:22 +0000
16@@ -22,7 +22,7 @@
17 #include "dimensions.h"
18 #include "point.h"
19
20-#include <ostream>
21+#include <iosfwd>
22
23 namespace mir
24 {
25@@ -57,11 +57,7 @@
26 return lhs.dx != rhs.dx || lhs.dy != rhs.dy;
27 }
28
29-inline std::ostream& operator<<(std::ostream& out, Displacement const& value)
30-{
31- out << '(' << value.dx << ", " << value.dy << ')';
32- return out;
33-}
34+std::ostream& operator<<(std::ostream& out, Displacement const& value);
35
36 inline Displacement operator+(Displacement const& lhs, Displacement const& rhs)
37 {
38
39=== modified file 'include/shared/mir/geometry/point.h'
40--- include/shared/mir/geometry/point.h 2013-08-28 03:41:48 +0000
41+++ include/shared/mir/geometry/point.h 2013-11-08 13:06:22 +0000
42@@ -20,7 +20,7 @@
43 #define MIR_GEOMETRY_POINT_H_
44
45 #include "dimensions.h"
46-#include <ostream>
47+#include <iosfwd>
48
49 namespace mir
50 {
51@@ -50,12 +50,7 @@
52 return lhs.x != rhs.x || lhs.y != rhs.y;
53 }
54
55-inline std::ostream& operator<<(std::ostream& out, Point const& value)
56-{
57- out << '(' << value.x << ", " << value.y << ')';
58- return out;
59-}
60-
61+std::ostream& operator<<(std::ostream& out, Point const& value);
62 }
63 }
64
65
66=== modified file 'include/shared/mir/geometry/rectangle.h'
67--- include/shared/mir/geometry/rectangle.h 2013-10-15 08:53:10 +0000
68+++ include/shared/mir/geometry/rectangle.h 2013-11-08 13:06:22 +0000
69@@ -23,7 +23,7 @@
70 #include "point.h"
71 #include "size.h"
72
73-#include <ostream>
74+#include <iosfwd>
75
76 namespace mir
77 {
78@@ -65,12 +65,7 @@
79 return lhs.top_left != rhs.top_left || lhs.size != rhs.size;
80 }
81
82-inline std::ostream& operator<<(std::ostream& out, Rectangle const& value)
83-{
84- out << '(' << value.top_left << ", " << value.size << ')';
85- return out;
86-}
87-
88+std::ostream& operator<<(std::ostream& out, Rectangle const& value);
89 }
90 }
91
92
93=== modified file 'include/shared/mir/geometry/size.h'
94--- include/shared/mir/geometry/size.h 2013-08-28 03:41:48 +0000
95+++ include/shared/mir/geometry/size.h 2013-11-08 13:06:22 +0000
96@@ -20,7 +20,7 @@
97 #define MIR_GEOMETRY_SIZE_H_
98
99 #include "dimensions.h"
100-#include <ostream>
101+#include <iosfwd>
102
103 namespace mir
104 {
105@@ -50,12 +50,7 @@
106 return lhs.width != rhs.width || lhs.height != rhs.height;
107 }
108
109-inline std::ostream& operator<<(std::ostream& out, Size const& value)
110-{
111- out << '(' << value.width << ", " << value.height << ')';
112- return out;
113-}
114-
115+std::ostream& operator<<(std::ostream& out, Size const& value);
116 }
117 }
118
119
120=== modified file 'src/server/CMakeLists.txt'
121--- src/server/CMakeLists.txt 2013-11-05 03:39:55 +0000
122+++ src/server/CMakeLists.txt 2013-11-08 13:06:22 +0000
123@@ -49,6 +49,7 @@
124 mirplatform
125 mirinput
126 mirsharedinput
127+ mirsharedgeometry
128 mirsharedlogging
129 mirsurfaces
130 mirtime
131
132=== modified file 'src/shared/geometry/CMakeLists.txt'
133--- src/shared/geometry/CMakeLists.txt 2013-08-28 03:41:48 +0000
134+++ src/shared/geometry/CMakeLists.txt 2013-11-08 13:06:22 +0000
135@@ -19,5 +19,6 @@
136
137 rectangle.cpp
138 rectangles.cpp
139+ ostream.cpp
140 )
141
142
143=== added file 'src/shared/geometry/ostream.cpp'
144--- src/shared/geometry/ostream.cpp 1970-01-01 00:00:00 +0000
145+++ src/shared/geometry/ostream.cpp 2013-11-08 13:06:22 +0000
146@@ -0,0 +1,60 @@
147+/*
148+ * Copyright © 2013 Canonical Ltd.
149+ *
150+ * This program is free software: you can redistribute it and/or modify it
151+ * under the terms of the GNU Lesser General Public License version 3,
152+ * as published by the Free Software Foundation.
153+ *
154+ * This program is distributed in the hope that it will be useful,
155+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
156+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
157+ * GNU Lesser General Public License for more details.
158+ *
159+ * You should have received a copy of the GNU Lesser General Public License
160+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
161+ *
162+ * Authored by: Alan Griffiths <alan@octopull.co.uk>
163+ */
164+
165+#include "mir/geometry/displacement.h"
166+#include "mir/geometry/point.h"
167+#include "mir/geometry/size.h"
168+#include "mir/geometry/rectangle.h"
169+#include "mir/geometry/rectangles.h"
170+
171+#include <ostream>
172+
173+namespace geom = mir::geometry;
174+
175+std::ostream& geom::operator<<(std::ostream& out, Displacement const& value)
176+{
177+ out << '(' << value.dx << ", " << value.dy << ')';
178+ return out;
179+}
180+
181+std::ostream& geom::operator<<(std::ostream& out, Point const& value)
182+{
183+ out << '(' << value.x << ", " << value.y << ')';
184+ return out;
185+}
186+
187+std::ostream& geom::operator<<(std::ostream& out, Size const& value)
188+{
189+ out << '(' << value.width << ", " << value.height << ')';
190+ return out;
191+}
192+
193+std::ostream& geom::operator<<(std::ostream& out, Rectangle const& value)
194+{
195+ out << '(' << value.top_left << ", " << value.size << ')';
196+ return out;
197+}
198+
199+std::ostream& geom::operator<<(std::ostream& out, Rectangles const& value)
200+{
201+ out << '[';
202+ for (auto const& rect : value)
203+ out << rect << ", ";
204+ out << ']';
205+ return out;
206+}
207
208=== modified file 'src/shared/geometry/rectangles.cpp'
209--- src/shared/geometry/rectangles.cpp 2013-08-28 03:41:48 +0000
210+++ src/shared/geometry/rectangles.cpp 2013-11-08 13:06:22 +0000
211@@ -187,12 +187,3 @@
212 {
213 return !(*this == rects);
214 }
215-
216-std::ostream& geom::operator<<(std::ostream& out, Rectangles const& value)
217-{
218- out << '[';
219- for (auto const& rect : value)
220- out << rect << ", ";
221- out << ']';
222- return out;
223-}

Subscribers

People subscribed via source and target branches