Merge lp:~widelands-dev/widelands/bug-1332627 into lp:widelands
- bug-1332627
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 7088 | ||||
Proposed branch: | lp:~widelands-dev/widelands/bug-1332627 | ||||
Merge into: | lp:widelands | ||||
Diff against target: |
1173 lines (+164/-79) (has conflicts) 39 files modified
cmake/codecheck/rules/do_not_use_BOOST_noncopyable (+18/-0) src/ai/ai_hints.h (+7/-1) src/ai/computer_player.h (+2/-3) src/base/macros.h (+6/-0) src/base/scoped_timer.h (+4/-2) src/economy/economy.h (+3/-2) src/economy/itransport_cost_calculator.h (+4/-3) src/editor/tools/editor_tool.h (+4/-3) src/graphic/animation.cc (+3/-1) src/graphic/animation.h (+4/-1) src/graphic/font_handler1.h (+6/-4) src/graphic/image.h (+5/-2) src/graphic/image_cache.h (+3/-1) src/graphic/render/gamerenderer.h (+3/-1) src/graphic/surface.h (+5/-3) src/graphic/surface_cache.h (+5/-1) src/io/filesystem/filesystem.h (+0/-1) src/io/streamread.h (+4/-3) src/io/streamwrite.h (+3/-3) src/logic/cookie_priority_queue.h (+4/-2) src/logic/editor_game_base.h (+2/-3) src/logic/expedition_bootstrap.h (+3/-3) src/logic/immovable_program.h (+5/-2) src/logic/instances.h (+8/-4) src/logic/message_queue.h (+4/-3) src/logic/player.h (+5/-2) src/logic/production_program.h (+5/-2) src/logic/terrain_affinity.h (+4/-3) src/logic/tribe.h (+4/-1) src/logic/world/editor_category.h (+3/-2) src/logic/world/resource_description.h (+4/-3) src/logic/world/terrain_description.h (+4/-3) src/logic/world/world.h (+4/-1) src/map_io/one_world_legacy_lookup_table.h (+5/-2) src/map_io/s2map.cc (+3/-1) src/map_io/s2map.h (+1/-0) src/profile/profile.h (+3/-3) src/ui_basic/panel.h (+4/-2) src/ui_basic/unique_window.h (+0/-2) Text conflict in src/ai/ai_hints.h |
||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1332627 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Needs Fixing | ||
Review via email: mp+226628@code.launchpad.net |
Commit message
Description of the change
Removes boost::noncopyable and replaces it through a macro.
GunChleoc (gunchleoc) wrote : | # |
I did the change to the macro.
struct ITransportCostC
virtual ~ITransportCost
virtual int32_t calc_cost_
DISALLOW_
TypeName() = default;
};
results in:
[ 5%] Building CXX object src/wui/
In file included from /home/bratzbert
/home/bratzbert
/home/bratzbert
=======
struct ITransportCostC
virtual ~ITransportCost
virtual int32_t calc_cost_
DISALLOW_
};
results in:
[ 19%] Building CXX object src/logic/
/home/bratzbert
/home/bratzbert
/home/bratzbert
In file included from /home/bratzbert
/home/bratzbert
/home/bratzbert
SirVer (sirver) wrote : | # |
TypeName() = default; should be here
ITransportCostC
And I was wrong in my first comment. It is needed when the copy constructor is deleted.
GunChleoc (gunchleoc) wrote : | # |
src/wui/
SirVer (sirver) wrote : | # |
Awesome! Merged. I tweaked the codecheck rule and fixed the remaining boost::noncopyable. The linking error probably came from not fixing the dependencies in the CMakeLists.txt files. make codecheck lists those.
SirVer (sirver) wrote : | # |
On second thought, that cannot really explain linker errors. If you still have them after a make clean please open a bug report and we'll investigate.
GunChleoc (gunchleoc) wrote : | # |
I merged it into another branch and it worked :)
Preview Diff
1 | === added file 'cmake/codecheck/rules/do_not_use_BOOST_noncopyable' |
2 | --- cmake/codecheck/rules/do_not_use_BOOST_noncopyable 1970-01-01 00:00:00 +0000 |
3 | +++ cmake/codecheck/rules/do_not_use_BOOST_noncopyable 2014-07-14 19:24:49 +0000 |
4 | @@ -0,0 +1,18 @@ |
5 | +#!/usr/bin/python |
6 | + |
7 | +""" |
8 | +Prefer DEBUG. |
9 | +""" |
10 | + |
11 | +error_msg="Do not inherit from boost::noncopyable. Instead #include \"base/macros.h\" and add \"DISALLOW_COPY_AND_ASSIGN(<Objectname>);\" to the private section of the object or type." |
12 | + |
13 | +regexp=r"""(^#include.*boost.noncopyable\.hpp|noncopyable)""" |
14 | + |
15 | +forbidden = [ |
16 | + "#include <boost/noncopyable.hpp>", |
17 | + "noncopyable" |
18 | +] |
19 | + |
20 | +allowed = [ |
21 | + "DISALLOW_COPY_AND_ASSIGN", |
22 | +] |
23 | |
24 | === modified file 'src/ai/ai_hints.h' |
25 | --- src/ai/ai_hints.h 2014-07-14 07:31:18 +0000 |
26 | +++ src/ai/ai_hints.h 2014-07-14 19:24:49 +0000 |
27 | @@ -21,14 +21,19 @@ |
28 | #define WL_AI_AI_HINTS_H |
29 | |
30 | #include <stdint.h> |
31 | +<<<<<<< TREE |
32 | #include <boost/noncopyable.hpp> |
33 | +======= |
34 | + |
35 | +#include "base/macros.h" |
36 | +>>>>>>> MERGE-SOURCE |
37 | |
38 | class Section; |
39 | |
40 | /// This struct is used to read out the data given in [aihints] section of a |
41 | /// buildings conf file. It is used to tell the computer player about the |
42 | /// special properties of a building. |
43 | -struct BuildingHints : boost::noncopyable { |
44 | +struct BuildingHints { |
45 | BuildingHints(Section*); |
46 | ~BuildingHints(); |
47 | |
48 | @@ -110,6 +115,7 @@ |
49 | bool fighting_; |
50 | bool mountain_conqueror_; |
51 | uint8_t mines_percent_; |
52 | + DISALLOW_COPY_AND_ASSIGN(BuildingHints); |
53 | }; |
54 | |
55 | #endif // end of include guard: WL_AI_AI_HINTS_H |
56 | |
57 | === modified file 'src/ai/computer_player.h' |
58 | --- src/ai/computer_player.h 2014-07-05 16:41:51 +0000 |
59 | +++ src/ai/computer_player.h 2014-07-14 19:24:49 +0000 |
60 | @@ -20,8 +20,7 @@ |
61 | #ifndef WL_AI_COMPUTER_PLAYER_H |
62 | #define WL_AI_COMPUTER_PLAYER_H |
63 | |
64 | -#include <boost/noncopyable.hpp> |
65 | - |
66 | +#include "base/macros.h" |
67 | #include "logic/game.h" |
68 | #include "logic/notification.h" |
69 | |
70 | @@ -32,7 +31,6 @@ |
71 | * \ref Implementation interface. |
72 | */ |
73 | struct Computer_Player : |
74 | - boost::noncopyable, |
75 | Widelands::NoteReceiver<Widelands::NoteImmovable>, |
76 | Widelands::NoteReceiver<Widelands::NoteFieldPossession> |
77 | { |
78 | @@ -74,6 +72,7 @@ |
79 | private: |
80 | Widelands::Game & m_game; |
81 | Widelands::Player_Number const m_player_number; |
82 | + DISALLOW_COPY_AND_ASSIGN(Computer_Player); |
83 | }; |
84 | |
85 | #endif // end of include guard: WL_AI_COMPUTER_PLAYER_H |
86 | |
87 | === modified file 'src/base/macros.h' |
88 | --- src/base/macros.h 2014-07-05 16:41:51 +0000 |
89 | +++ src/base/macros.h 2014-07-14 19:24:49 +0000 |
90 | @@ -65,6 +65,12 @@ |
91 | #define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x) |
92 | #define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x) |
93 | |
94 | +// disallow copying or assigning a class |
95 | +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
96 | +TypeName(const TypeName&) = delete; \ |
97 | +void operator=(const TypeName&) = delete |
98 | + |
99 | + |
100 | /// Wrapper macro around a dynamic_cast. |
101 | #define upcast(type, identifier, source) type * const identifier = \ |
102 | dynamic_cast<type *>(source) |
103 | |
104 | === modified file 'src/base/scoped_timer.h' |
105 | --- src/base/scoped_timer.h 2014-07-05 16:41:51 +0000 |
106 | +++ src/base/scoped_timer.h 2014-07-14 19:24:49 +0000 |
107 | @@ -23,13 +23,13 @@ |
108 | #include <string> |
109 | #include <stdint.h> |
110 | |
111 | -#include <boost/noncopyable.hpp> |
112 | +#include "base/macros.h" |
113 | |
114 | /** |
115 | * A cheap timer class that can be queried for timings and will print out |
116 | * it's total time in existence on destruction. |
117 | */ |
118 | -class ScopedTimer : boost::noncopyable { |
119 | +class ScopedTimer { |
120 | public: |
121 | // Takes the output message that will be boost::format() with the total time |
122 | // this object existed (in ms, use %u). |
123 | @@ -44,6 +44,8 @@ |
124 | private: |
125 | std::string message_; |
126 | uint32_t startime_, lasttime_; |
127 | + |
128 | + DISALLOW_COPY_AND_ASSIGN(ScopedTimer); |
129 | }; |
130 | |
131 | #endif // end of include guard: WL_BASE_SCOPED_TIMER_H |
132 | |
133 | === modified file 'src/economy/economy.h' |
134 | --- src/economy/economy.h 2014-07-05 16:41:51 +0000 |
135 | +++ src/economy/economy.h 2014-07-14 19:24:49 +0000 |
136 | @@ -27,6 +27,7 @@ |
137 | #include <boost/function.hpp> |
138 | #include <boost/utility.hpp> |
139 | |
140 | +#include "base/macros.h" |
141 | #include "logic/instances.h" |
142 | #include "logic/warelist.h" |
143 | #include "logic/wareworker.h" |
144 | @@ -71,7 +72,7 @@ |
145 | * connected by roads or the seafaring network - though of course, most code operates |
146 | * on the assumption that they are, with fallbacks for when they aren't. |
147 | */ |
148 | -class Economy : boost::noncopyable { |
149 | +class Economy { |
150 | public: |
151 | friend class EconomyDataPacket; |
152 | |
153 | @@ -182,7 +183,7 @@ |
154 | |
155 | void rebalance_supply() {_start_request_timer();} |
156 | |
157 | -private: |
158 | + DISALLOW_COPY_AND_ASSIGN(Economy); |
159 | /*************/ |
160 | /* Functions */ |
161 | /*************/ |
162 | |
163 | === modified file 'src/economy/itransport_cost_calculator.h' |
164 | --- src/economy/itransport_cost_calculator.h 2014-07-05 16:41:51 +0000 |
165 | +++ src/economy/itransport_cost_calculator.h 2014-07-14 19:24:49 +0000 |
166 | @@ -20,8 +20,7 @@ |
167 | #ifndef WL_ECONOMY_ITRANSPORT_COST_CALCULATOR_H |
168 | #define WL_ECONOMY_ITRANSPORT_COST_CALCULATOR_H |
169 | |
170 | -#include <boost/noncopyable.hpp> |
171 | - |
172 | +#include "base/macros.h" |
173 | #include "logic/widelands_geometry.h" |
174 | |
175 | namespace Widelands { |
176 | @@ -33,10 +32,12 @@ |
177 | * At the time of this writing, Map implements all of this functionality |
178 | * but most economy code doesn't need all of maps functionality |
179 | */ |
180 | -struct ITransportCostCalculator : boost::noncopyable { |
181 | +struct ITransportCostCalculator { |
182 | + ITransportCostCalculator() = default; |
183 | virtual ~ITransportCostCalculator() {} |
184 | |
185 | virtual int32_t calc_cost_estimate(Coords, Coords) const = 0; |
186 | + DISALLOW_COPY_AND_ASSIGN(ITransportCostCalculator); |
187 | }; |
188 | |
189 | } |
190 | |
191 | === modified file 'src/editor/tools/editor_tool.h' |
192 | --- src/editor/tools/editor_tool.h 2014-07-05 16:41:51 +0000 |
193 | +++ src/editor/tools/editor_tool.h 2014-07-14 19:24:49 +0000 |
194 | @@ -22,8 +22,7 @@ |
195 | |
196 | #define MAX_TOOL_AREA 9 |
197 | |
198 | -#include <boost/noncopyable.hpp> |
199 | - |
200 | +#include "base/macros.h" |
201 | #include "editor/tools/editor_action_args.h" |
202 | #include "logic/widelands_geometry.h" |
203 | |
204 | @@ -39,7 +38,7 @@ |
205 | * one function (like delete_building, place building, modify building are 3 |
206 | * tools). |
207 | */ |
208 | -class Editor_Tool : boost::noncopyable { |
209 | +class Editor_Tool { |
210 | public: |
211 | Editor_Tool(Editor_Tool & second, Editor_Tool & third, bool uda = true) : |
212 | m_second(second), m_third(third), undoable(uda) |
213 | @@ -102,6 +101,8 @@ |
214 | protected: |
215 | Editor_Tool & m_second, & m_third; |
216 | bool undoable; |
217 | + |
218 | + DISALLOW_COPY_AND_ASSIGN(Editor_Tool); |
219 | }; |
220 | |
221 | #endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_TOOL_H |
222 | |
223 | === modified file 'src/graphic/animation.cc' |
224 | --- src/graphic/animation.cc 2014-07-12 20:37:13 +0000 |
225 | +++ src/graphic/animation.cc 2014-07-14 19:24:49 +0000 |
226 | @@ -33,6 +33,7 @@ |
227 | #include "base/deprecated.h" |
228 | #include "base/i18n.h" |
229 | #include "base/log.h" |
230 | +#include "base/macros.h" |
231 | #include "base/wexception.h" |
232 | #include "graphic/diranimations.h" |
233 | #include "graphic/graphic.h" |
234 | @@ -55,7 +56,7 @@ |
235 | namespace { |
236 | |
237 | /// A class that makes iteration over filename_?.png templates easy. |
238 | -class NumberGlob : boost::noncopyable { |
239 | +class NumberGlob { |
240 | public: |
241 | typedef uint32_t type; |
242 | NumberGlob(const std::string& pictmp); |
243 | @@ -69,6 +70,7 @@ |
244 | std::string replstr_; |
245 | uint32_t cur_; |
246 | uint32_t max_; |
247 | + DISALLOW_COPY_AND_ASSIGN(NumberGlob); |
248 | }; |
249 | |
250 | /** |
251 | |
252 | === modified file 'src/graphic/animation.h' |
253 | --- src/graphic/animation.h 2014-07-05 16:41:51 +0000 |
254 | +++ src/graphic/animation.h 2014-07-14 19:24:49 +0000 |
255 | @@ -27,6 +27,7 @@ |
256 | |
257 | #include <boost/utility.hpp> |
258 | |
259 | +#include "base/macros.h" |
260 | #include "base/point.h" |
261 | #include "base/rect.h" |
262 | |
263 | @@ -48,7 +49,7 @@ |
264 | * The dimensions of an animation is constant and can not change from frame to |
265 | * frame. |
266 | */ |
267 | -class Animation : boost::noncopyable { |
268 | +class Animation { |
269 | public: |
270 | Animation() {} |
271 | virtual ~Animation() {} |
272 | @@ -87,6 +88,8 @@ |
273 | |
274 | /// Play the sound effect associated with this animation at the given time. |
275 | virtual void trigger_soundfx(uint32_t time, uint32_t stereo_position) const = 0; |
276 | + |
277 | + DISALLOW_COPY_AND_ASSIGN(Animation); |
278 | }; |
279 | |
280 | /** |
281 | |
282 | === modified file 'src/graphic/font_handler1.h' |
283 | --- src/graphic/font_handler1.h 2014-07-05 19:33:23 +0000 |
284 | +++ src/graphic/font_handler1.h 2014-07-14 19:24:49 +0000 |
285 | @@ -23,10 +23,10 @@ |
286 | |
287 | #include <string> |
288 | |
289 | -#include <boost/noncopyable.hpp> |
290 | - |
291 | +#include "base/macros.h" |
292 | +#include "base/point.h" |
293 | #include "graphic/align.h" |
294 | -#include "base/point.h" |
295 | + |
296 | |
297 | class FileSystem; |
298 | class Image; |
299 | @@ -37,8 +37,9 @@ |
300 | /** |
301 | * Main class for string rendering. Manages the cache of pre-rendered strings. |
302 | */ |
303 | -class IFont_Handler1 : boost::noncopyable { |
304 | +class IFont_Handler1 { |
305 | public: |
306 | + IFont_Handler1() = default; |
307 | virtual ~IFont_Handler1() {} |
308 | |
309 | /* |
310 | @@ -46,6 +47,7 @@ |
311 | * ownership remains with this class. Will throw on error. |
312 | */ |
313 | virtual const Image* render(const std::string& text, uint16_t w = 0) = 0; |
314 | + DISALLOW_COPY_AND_ASSIGN(IFont_Handler1); |
315 | }; |
316 | |
317 | // Create a new Font_Handler1. Ownership for the objects is not taken. |
318 | |
319 | === modified file 'src/graphic/image.h' |
320 | --- src/graphic/image.h 2014-07-05 16:41:51 +0000 |
321 | +++ src/graphic/image.h 2014-07-14 19:24:49 +0000 |
322 | @@ -22,17 +22,19 @@ |
323 | |
324 | #include <string> |
325 | |
326 | -#include <boost/noncopyable.hpp> |
327 | #include <stdint.h> |
328 | |
329 | +#include "base/macros.h" |
330 | + |
331 | /** |
332 | * Interface to a bitmap that can act as the source of a rendering |
333 | * operation. |
334 | */ |
335 | class Surface; |
336 | |
337 | -class Image : boost::noncopyable { |
338 | +class Image { |
339 | public: |
340 | + Image() = default; |
341 | virtual ~Image() {} |
342 | |
343 | virtual uint16_t width() const = 0; |
344 | @@ -41,6 +43,7 @@ |
345 | // Internal functions needed for caching. |
346 | virtual Surface* surface() const = 0; |
347 | virtual const std::string& hash() const = 0; |
348 | + DISALLOW_COPY_AND_ASSIGN(Image); |
349 | }; |
350 | |
351 | |
352 | |
353 | === modified file 'src/graphic/image_cache.h' |
354 | --- src/graphic/image_cache.h 2014-07-05 19:33:23 +0000 |
355 | +++ src/graphic/image_cache.h 2014-07-14 19:24:49 +0000 |
356 | @@ -25,6 +25,7 @@ |
357 | |
358 | #include <boost/utility.hpp> |
359 | |
360 | +#include "base/macros.h" |
361 | #include "graphic/image.h" |
362 | |
363 | class SurfaceCache; |
364 | @@ -36,7 +37,7 @@ |
365 | // its hash is not found. Other parts of Widelands will create images when they |
366 | // do not exist in the cache yet and then put it into the cache and therefore |
367 | // releasing their ownership. |
368 | -class ImageCache : boost::noncopyable { |
369 | +class ImageCache { |
370 | public: |
371 | // Does not take ownership. |
372 | ImageCache(SurfaceCache* surface_cache); |
373 | @@ -60,6 +61,7 @@ |
374 | |
375 | ImageMap images_; /// hash of cached filename/image pairs |
376 | SurfaceCache* const surface_cache_; // Not owned. |
377 | + DISALLOW_COPY_AND_ASSIGN(ImageCache); |
378 | }; |
379 | |
380 | #endif // end of include guard: WL_GRAPHIC_IMAGE_CACHE_H |
381 | |
382 | === modified file 'src/graphic/render/gamerenderer.h' |
383 | --- src/graphic/render/gamerenderer.h 2014-07-05 16:41:51 +0000 |
384 | +++ src/graphic/render/gamerenderer.h 2014-07-14 19:24:49 +0000 |
385 | @@ -22,6 +22,7 @@ |
386 | |
387 | #include <boost/utility.hpp> |
388 | |
389 | +#include "base/macros.h" |
390 | #include "base/point.h" |
391 | |
392 | namespace Widelands { |
393 | @@ -41,7 +42,7 @@ |
394 | * so that target-specific optimizations (such as caching data) can |
395 | * be effective. |
396 | */ |
397 | -class GameRenderer : boost::noncopyable { |
398 | +class GameRenderer { |
399 | public: |
400 | GameRenderer(); |
401 | virtual ~GameRenderer(); |
402 | @@ -94,6 +95,7 @@ |
403 | |
404 | private: |
405 | void draw_wrapper(); |
406 | + DISALLOW_COPY_AND_ASSIGN(GameRenderer); |
407 | }; |
408 | |
409 | #endif // end of include guard: WL_GRAPHIC_RENDER_GAMERENDERER_H |
410 | |
411 | === modified file 'src/graphic/surface.h' |
412 | --- src/graphic/surface.h 2014-07-05 19:33:23 +0000 |
413 | +++ src/graphic/surface.h 2014-07-14 19:24:49 +0000 |
414 | @@ -20,8 +20,7 @@ |
415 | #ifndef WL_GRAPHIC_SURFACE_H |
416 | #define WL_GRAPHIC_SURFACE_H |
417 | |
418 | -#include <boost/noncopyable.hpp> |
419 | - |
420 | +#include "base/macros.h" |
421 | #include "base/rect.h" |
422 | #include "graphic/color.h" |
423 | #include "graphic/compositemode.h" |
424 | @@ -30,7 +29,7 @@ |
425 | * Interface to a basic surfaces that can be used as destination for blitting and drawing. |
426 | * It also allows low level pixel access. |
427 | */ |
428 | -class Surface : boost::noncopyable { |
429 | +class Surface { |
430 | public: |
431 | // Surfaces can either be converted to display format on creation or kept in |
432 | // the format they were created. The only reason not to convert to display |
433 | @@ -46,6 +45,7 @@ |
434 | // dimensions. |
435 | static Surface* create(uint16_t w, uint16_t h); |
436 | |
437 | + Surface() = default; |
438 | virtual ~Surface() {} |
439 | |
440 | /// Dimensions. |
441 | @@ -135,6 +135,8 @@ |
442 | * \warning May only be called inside lock/unlock pairs. |
443 | */ |
444 | virtual uint8_t * get_pixels() const = 0; |
445 | + |
446 | + DISALLOW_COPY_AND_ASSIGN(Surface); |
447 | }; |
448 | |
449 | #endif // end of include guard: WL_GRAPHIC_SURFACE_H |
450 | |
451 | === modified file 'src/graphic/surface_cache.h' |
452 | --- src/graphic/surface_cache.h 2014-07-05 16:41:51 +0000 |
453 | +++ src/graphic/surface_cache.h 2014-07-14 19:24:49 +0000 |
454 | @@ -24,6 +24,8 @@ |
455 | |
456 | #include <boost/utility.hpp> |
457 | |
458 | +#include "base/macros.h" |
459 | + |
460 | class Surface; |
461 | |
462 | // Caches Surfaces. It contains surfaces which must not be deleted and |
463 | @@ -33,7 +35,7 @@ |
464 | // Nobody in Widelands should hold onto a Surface they get from this class, |
465 | // instead, they should use it only temporarily and rerequest it whenever they |
466 | // need it. |
467 | -class SurfaceCache : boost::noncopyable { |
468 | +class SurfaceCache { |
469 | public: |
470 | SurfaceCache() {} |
471 | virtual ~SurfaceCache() {} |
472 | @@ -50,6 +52,8 @@ |
473 | // automatically - use this if surfaces are around for a long time and |
474 | // recreation is expensive (i.e. images loaded from disk). |
475 | virtual Surface* insert(const std::string& hash, Surface*, bool transient) = 0; |
476 | + |
477 | + DISALLOW_COPY_AND_ASSIGN(SurfaceCache); |
478 | }; |
479 | |
480 | // Create a new Cache whichs combined pixels in all transient surfaces are |
481 | |
482 | === modified file 'src/io/filesystem/filesystem.h' |
483 | --- src/io/filesystem/filesystem.h 2014-07-05 16:41:51 +0000 |
484 | +++ src/io/filesystem/filesystem.h 2014-07-14 19:24:49 +0000 |
485 | @@ -28,7 +28,6 @@ |
486 | #include <vector> |
487 | |
488 | #include <stdint.h> |
489 | -#include <boost/noncopyable.hpp> |
490 | |
491 | #include "io/filesystem/filesystem_exceptions.h" |
492 | |
493 | |
494 | === modified file 'src/io/streamread.h' |
495 | --- src/io/streamread.h 2014-07-05 16:41:51 +0000 |
496 | +++ src/io/streamread.h 2014-07-14 19:24:49 +0000 |
497 | @@ -23,8 +23,7 @@ |
498 | #include <cstring> |
499 | #include <string> |
500 | |
501 | -#include <boost/noncopyable.hpp> |
502 | - |
503 | +#include "base/macros.h" |
504 | #include "base/wexception.h" |
505 | #include "machdep.h" |
506 | |
507 | @@ -42,7 +41,7 @@ |
508 | * |
509 | * Convenience functions are provided for many data types. |
510 | */ |
511 | -class StreamRead : boost::noncopyable { |
512 | +class StreamRead { |
513 | public: |
514 | explicit StreamRead() {} |
515 | virtual ~StreamRead(); |
516 | @@ -77,6 +76,8 @@ |
517 | _data_error(char const * const fmt, ...) PRINTF_FORMAT(2, 3); |
518 | }; |
519 | #define data_error(...) _data_error(__VA_ARGS__) |
520 | + |
521 | + DISALLOW_COPY_AND_ASSIGN(StreamRead); |
522 | }; |
523 | |
524 | #endif // end of include guard: WL_IO_STREAMREAD_H |
525 | |
526 | === modified file 'src/io/streamwrite.h' |
527 | --- src/io/streamwrite.h 2014-07-05 16:41:51 +0000 |
528 | +++ src/io/streamwrite.h 2014-07-14 19:24:49 +0000 |
529 | @@ -25,8 +25,6 @@ |
530 | #include <limits> |
531 | #include <string> |
532 | |
533 | -#include <boost/noncopyable.hpp> |
534 | - |
535 | #include "base/macros.h" |
536 | #include "machdep.h" |
537 | |
538 | @@ -40,7 +38,7 @@ |
539 | * |
540 | * Convenience functions are provided for many data types. |
541 | */ |
542 | -class StreamWrite : boost::noncopyable { |
543 | +class StreamWrite { |
544 | public: |
545 | explicit StreamWrite() {} |
546 | virtual ~StreamWrite(); |
547 | @@ -90,6 +88,8 @@ |
548 | // Write strings without null terminator. |
549 | void Text (char const * const x) {Data(x, strlen(x));} |
550 | void Text (const std::string & x) {Data(x.c_str(), x.size());} |
551 | + |
552 | + DISALLOW_COPY_AND_ASSIGN(StreamWrite); |
553 | }; |
554 | |
555 | #endif // end of include guard: WL_IO_STREAMWRITE_H |
556 | |
557 | === modified file 'src/logic/cookie_priority_queue.h' |
558 | --- src/logic/cookie_priority_queue.h 2014-07-05 16:41:51 +0000 |
559 | +++ src/logic/cookie_priority_queue.h 2014-07-14 19:24:49 +0000 |
560 | @@ -25,7 +25,7 @@ |
561 | #include <limits> |
562 | #include <vector> |
563 | |
564 | -#include <boost/noncopyable.hpp> |
565 | +#include "base/macros.h" |
566 | |
567 | template<typename _Type> |
568 | struct default_cookie_accessor; |
569 | @@ -36,7 +36,7 @@ |
570 | typedef std::vector<type *> container; |
571 | typedef typename container::size_type size_type; |
572 | |
573 | - struct cookie : boost::noncopyable { |
574 | + struct cookie { |
575 | cookie() : pos(bad_pos()) {} |
576 | ~cookie() {} |
577 | |
578 | @@ -47,6 +47,8 @@ |
579 | friend struct cookie_priority_queue_base<_Type>; |
580 | |
581 | size_type pos; |
582 | + |
583 | + DISALLOW_COPY_AND_ASSIGN(cookie); |
584 | }; |
585 | |
586 | protected: |
587 | |
588 | === modified file 'src/logic/editor_game_base.h' |
589 | --- src/logic/editor_game_base.h 2014-07-14 07:31:18 +0000 |
590 | +++ src/logic/editor_game_base.h 2014-07-14 19:24:49 +0000 |
591 | @@ -25,8 +25,7 @@ |
592 | #include <string> |
593 | #include <vector> |
594 | |
595 | -#include <boost/noncopyable.hpp> |
596 | - |
597 | +#include "base/macros.h" |
598 | #include "logic/bob.h" |
599 | #include "logic/building.h" |
600 | #include "logic/map.h" |
601 | @@ -55,7 +54,6 @@ |
602 | struct AttackController; |
603 | |
604 | class Editor_Game_Base : |
605 | - boost::noncopyable, |
606 | NoteReceiver<NoteImmovable>, |
607 | NoteReceiver<NoteFieldPossession>, |
608 | NoteReceiver<NoteFieldTransformed> |
609 | @@ -222,6 +220,7 @@ |
610 | bool neutral_when_competing_influence = false, |
611 | bool conquer_guarded_location_by_superior_influence = false); |
612 | void cleanup_playerimmovables_area(Player_Area<Area<FCoords> >); |
613 | + DISALLOW_COPY_AND_ASSIGN(Editor_Game_Base); |
614 | }; |
615 | |
616 | #define iterate_players_existing(p, nr_players, egbase, player) \ |
617 | |
618 | === modified file 'src/logic/expedition_bootstrap.h' |
619 | --- src/logic/expedition_bootstrap.h 2014-07-05 16:41:51 +0000 |
620 | +++ src/logic/expedition_bootstrap.h 2014-07-14 19:24:49 +0000 |
621 | @@ -23,8 +23,7 @@ |
622 | #include <vector> |
623 | #include <memory> |
624 | |
625 | -#include <boost/noncopyable.hpp> |
626 | - |
627 | +#include "base/macros.h" |
628 | #include "economy/wares_queue.h" |
629 | |
630 | namespace Widelands { |
631 | @@ -43,7 +42,7 @@ |
632 | // Handles the mustering of workers and wares in a port for one Expedition. This |
633 | // object is created in the port dock as soon as the start expedition button is |
634 | // pressed. As soon as the ship is loaded, this object gets destroyed. |
635 | -class ExpeditionBootstrap : boost::noncopyable { |
636 | +class ExpeditionBootstrap { |
637 | public: |
638 | ExpeditionBootstrap(PortDock* const portdock); |
639 | virtual ~ExpeditionBootstrap(); |
640 | @@ -97,6 +96,7 @@ |
641 | |
642 | std::vector<std::unique_ptr<WaresQueue>> wares_; |
643 | std::vector<std::unique_ptr<ExpeditionWorker>> workers_; |
644 | + DISALLOW_COPY_AND_ASSIGN(ExpeditionBootstrap); |
645 | }; |
646 | |
647 | } // namespace Widelands |
648 | |
649 | === modified file 'src/logic/immovable_program.h' |
650 | --- src/logic/immovable_program.h 2014-07-05 16:41:51 +0000 |
651 | +++ src/logic/immovable_program.h 2014-07-14 19:24:49 +0000 |
652 | @@ -23,7 +23,7 @@ |
653 | #include <cstring> |
654 | #include <string> |
655 | |
656 | -#include <boost/noncopyable.hpp> |
657 | +#include "base/macros.h" |
658 | |
659 | /* |
660 | * Implementation is in immovable.cc |
661 | @@ -40,9 +40,12 @@ |
662 | struct ImmovableProgram { |
663 | |
664 | /// Can be executed on an Immovable. |
665 | - struct Action : boost::noncopyable { |
666 | + struct Action { |
667 | + Action() = default; |
668 | virtual ~Action(); |
669 | virtual void execute(Game &, Immovable &) const = 0; |
670 | + |
671 | + DISALLOW_COPY_AND_ASSIGN(Action); |
672 | }; |
673 | |
674 | /// Runs an animation. |
675 | |
676 | === modified file 'src/logic/instances.h' |
677 | --- src/logic/instances.h 2014-07-05 16:41:51 +0000 |
678 | +++ src/logic/instances.h 2014-07-14 19:24:49 +0000 |
679 | @@ -27,7 +27,6 @@ |
680 | #include <vector> |
681 | |
682 | #include <boost/function.hpp> |
683 | -#include <boost/noncopyable.hpp> |
684 | #include <boost/unordered_map.hpp> |
685 | #include <boost/signals2.hpp> |
686 | |
687 | @@ -53,7 +52,7 @@ |
688 | * Base class for descriptions of worker, files and so on. This must just |
689 | * link them together |
690 | */ |
691 | -struct Map_Object_Descr : boost::noncopyable { |
692 | +struct Map_Object_Descr { |
693 | Map_Object_Descr(const std::string& init_name, const std::string& init_descname) |
694 | : m_name(init_name), m_descname(init_descname) { |
695 | } |
696 | @@ -102,6 +101,7 @@ |
697 | static uint32_t s_dyn_attribhigh; ///< highest attribute ID used |
698 | static AttribMap s_dyn_attribs; |
699 | |
700 | + DISALLOW_COPY_AND_ASSIGN(Map_Object_Descr); |
701 | }; |
702 | |
703 | /** |
704 | @@ -148,7 +148,7 @@ |
705 | return ref_cast<type const, Map_Object_Descr const>(*m_descr); \ |
706 | } \ |
707 | |
708 | -class Map_Object : boost::noncopyable { |
709 | +class Map_Object { |
710 | friend struct Object_Manager; |
711 | friend struct Object_Ptr; |
712 | |
713 | @@ -326,6 +326,8 @@ |
714 | const Map_Object_Descr * m_descr; |
715 | Serial m_serial; |
716 | LogSink * m_logsink; |
717 | + |
718 | + DISALLOW_COPY_AND_ASSIGN(Map_Object); |
719 | }; |
720 | |
721 | inline int32_t get_reverse_dir(int32_t const dir) { |
722 | @@ -337,7 +339,7 @@ |
723 | * |
724 | * Keeps the list of all objects currently in the game. |
725 | */ |
726 | -struct Object_Manager : boost::noncopyable { |
727 | +struct Object_Manager { |
728 | typedef boost::unordered_map<Serial, Map_Object *> objmap_t; |
729 | |
730 | Object_Manager() {m_lastserial = 0;} |
731 | @@ -374,6 +376,8 @@ |
732 | private: |
733 | Serial m_lastserial; |
734 | objmap_t m_objects; |
735 | + |
736 | + DISALLOW_COPY_AND_ASSIGN(Object_Manager); |
737 | }; |
738 | |
739 | /** |
740 | |
741 | === modified file 'src/logic/message_queue.h' |
742 | --- src/logic/message_queue.h 2014-07-05 16:41:51 +0000 |
743 | +++ src/logic/message_queue.h 2014-07-14 19:24:49 +0000 |
744 | @@ -23,14 +23,13 @@ |
745 | #include <cassert> |
746 | #include <map> |
747 | |
748 | -#include <boost/noncopyable.hpp> |
749 | - |
750 | +#include "base/macros.h" |
751 | #include "logic/message.h" |
752 | #include "logic/message_id.h" |
753 | |
754 | namespace Widelands { |
755 | |
756 | -struct MessageQueue : boost::noncopyable, private std::map<Message_Id, Message *> { |
757 | +struct MessageQueue : private std::map<Message_Id, Message *> { |
758 | friend class Map_Players_Messages_Data_Packet; |
759 | // Make typedefs public so that this looks like proper |
760 | // STL container to templated algorithms. |
761 | @@ -181,6 +180,8 @@ |
762 | m_counts[Message::Read] + |
763 | m_counts[Message::Archived]); |
764 | } |
765 | + |
766 | + DISALLOW_COPY_AND_ASSIGN(MessageQueue); |
767 | }; |
768 | |
769 | } |
770 | |
771 | === modified file 'src/logic/player.h' |
772 | --- src/logic/player.h 2014-07-05 16:41:51 +0000 |
773 | +++ src/logic/player.h 2014-07-14 19:24:49 +0000 |
774 | @@ -20,6 +20,7 @@ |
775 | #ifndef WL_LOGIC_PLAYER_H |
776 | #define WL_LOGIC_PLAYER_H |
777 | |
778 | +#include "base/macros.h" |
779 | #include "graphic/color.h" |
780 | #include "logic/building.h" |
781 | #include "logic/constants.h" |
782 | @@ -54,7 +55,6 @@ |
783 | * properly. |
784 | */ |
785 | class Player : |
786 | - boost::noncopyable, |
787 | public NoteReceiver<NoteImmovable>, public NoteReceiver<NoteFieldPossession>, |
788 | public NoteSender <NoteImmovable>, public NoteSender <NoteFieldPossession> |
789 | { |
790 | @@ -140,7 +140,7 @@ |
791 | }; |
792 | |
793 | /// Per-player field information. |
794 | - struct Field : boost::noncopyable { |
795 | + struct Field { |
796 | Field() : |
797 | military_influence(0), |
798 | vision (0), |
799 | @@ -352,6 +352,7 @@ |
800 | // border_br |
801 | // border_bl |
802 | // <end> 0x100 0x160 |
803 | + DISALLOW_COPY_AND_ASSIGN(Field); |
804 | }; |
805 | |
806 | const Field * fields() const {return m_fields;} |
807 | @@ -593,6 +594,8 @@ |
808 | std::vector< std::vector<uint32_t> > m_ware_stocks; |
809 | |
810 | BuildingStats m_building_stats; |
811 | + |
812 | + DISALLOW_COPY_AND_ASSIGN(Player); |
813 | }; |
814 | |
815 | void find_former_buildings |
816 | |
817 | === modified file 'src/logic/production_program.h' |
818 | --- src/logic/production_program.h 2014-07-05 16:41:51 +0000 |
819 | +++ src/logic/production_program.h 2014-07-14 19:24:49 +0000 |
820 | @@ -26,11 +26,11 @@ |
821 | #include <string> |
822 | #include <vector> |
823 | |
824 | -#include <boost/noncopyable.hpp> |
825 | #include <stdint.h> |
826 | |
827 | #include "base/deprecated.h" |
828 | #include "base/log.h" |
829 | +#include "base/macros.h" |
830 | #include "logic/bill_of_materials.h" |
831 | #include "logic/program_result.h" |
832 | #include "logic/tattribute.h" |
833 | @@ -52,7 +52,8 @@ |
834 | struct ProductionProgram { |
835 | |
836 | /// Can be executed on a ProductionSite. |
837 | - struct Action : boost::noncopyable { |
838 | + struct Action { |
839 | + Action() = default; |
840 | virtual ~Action(); |
841 | virtual void execute(Game &, ProductionSite &) const = 0; |
842 | |
843 | @@ -70,6 +71,8 @@ |
844 | * a failed status. |
845 | */ |
846 | virtual void building_work_failed(Game &, ProductionSite &, Worker &) const; |
847 | + |
848 | + DISALLOW_COPY_AND_ASSIGN(Action); |
849 | }; |
850 | |
851 | /// A group of ware types with a count. |
852 | |
853 | === modified file 'src/logic/terrain_affinity.h' |
854 | --- src/logic/terrain_affinity.h 2014-07-06 08:25:05 +0000 |
855 | +++ src/logic/terrain_affinity.h 2014-07-14 19:24:49 +0000 |
856 | @@ -22,8 +22,7 @@ |
857 | |
858 | #include <string> |
859 | |
860 | -#include <boost/noncopyable.hpp> |
861 | - |
862 | +#include "base/macros.h" |
863 | #include "logic/description_maintainer.h" |
864 | |
865 | class LuaTable; |
866 | @@ -38,7 +37,7 @@ |
867 | // Describes the parameters and the pickiness of Immovables towards terrain |
868 | // parameters. Alls immovables that use 'grow' in any of their programs must |
869 | // define this. |
870 | -class TerrainAffinity : boost::noncopyable { |
871 | +class TerrainAffinity { |
872 | public: |
873 | explicit TerrainAffinity(const LuaTable& table, const std::string& immovable_name); |
874 | |
875 | @@ -60,6 +59,8 @@ |
876 | double preferred_humidity_; |
877 | double preferred_temperature_; |
878 | double pickiness_; |
879 | + |
880 | + DISALLOW_COPY_AND_ASSIGN(TerrainAffinity); |
881 | }; |
882 | |
883 | // Returns a value in [0., 1.] that describes the suitability for the |
884 | |
885 | === modified file 'src/logic/tribe.h' |
886 | --- src/logic/tribe.h 2014-07-05 16:41:51 +0000 |
887 | +++ src/logic/tribe.h 2014-07-14 19:24:49 +0000 |
888 | @@ -23,6 +23,7 @@ |
889 | #include <map> |
890 | #include <vector> |
891 | |
892 | +#include "base/macros.h" |
893 | #include "graphic/animation.h" |
894 | #include "logic/bob.h" |
895 | #include "logic/building.h" |
896 | @@ -51,7 +52,7 @@ |
897 | buildings it can build and the associated graphics. |
898 | Two players can choose the same tribe. |
899 | */ |
900 | -struct Tribe_Descr : boost::noncopyable { |
901 | +struct Tribe_Descr { |
902 | Tribe_Descr(const std::string & name, Editor_Game_Base &); |
903 | |
904 | // Static function to check for tribes. |
905 | @@ -192,6 +193,8 @@ |
906 | std::vector<Ware_Index> m_worker_types_without_cost; |
907 | |
908 | std::vector<Initialization> m_initializations; |
909 | + |
910 | + DISALLOW_COPY_AND_ASSIGN(Tribe_Descr); |
911 | }; |
912 | |
913 | } |
914 | |
915 | === modified file 'src/logic/world/editor_category.h' |
916 | --- src/logic/world/editor_category.h 2014-07-05 16:41:51 +0000 |
917 | +++ src/logic/world/editor_category.h 2014-07-14 19:24:49 +0000 |
918 | @@ -22,7 +22,7 @@ |
919 | |
920 | #include <string> |
921 | |
922 | -#include <boost/noncopyable.hpp> |
923 | +#include "base/macros.h" |
924 | |
925 | class Image; |
926 | class LuaTable; |
927 | @@ -31,7 +31,7 @@ |
928 | |
929 | /// Represents a category for grouping items in the Editor, so purely a UI |
930 | /// distinction and not a logical one. |
931 | -class EditorCategory : boost::noncopyable { |
932 | +class EditorCategory { |
933 | public: |
934 | EditorCategory(const LuaTable& table); |
935 | |
936 | @@ -48,6 +48,7 @@ |
937 | const std::string name_; |
938 | const std::string descname_; |
939 | const std::string image_file_; |
940 | + DISALLOW_COPY_AND_ASSIGN(EditorCategory); |
941 | }; |
942 | |
943 | } // namespace Widelands |
944 | |
945 | === modified file 'src/logic/world/resource_description.h' |
946 | --- src/logic/world/resource_description.h 2014-07-05 16:41:51 +0000 |
947 | +++ src/logic/world/resource_description.h 2014-07-14 19:24:49 +0000 |
948 | @@ -23,15 +23,14 @@ |
949 | #include <string> |
950 | #include <vector> |
951 | |
952 | -#include <boost/noncopyable.hpp> |
953 | - |
954 | +#include "base/macros.h" |
955 | #include "logic/widelands.h" |
956 | |
957 | class LuaTable; |
958 | |
959 | namespace Widelands { |
960 | |
961 | -class ResourceDescription : boost::noncopyable { |
962 | +class ResourceDescription { |
963 | public: |
964 | struct EditorPicture { |
965 | std::string picname; |
966 | @@ -62,6 +61,8 @@ |
967 | const bool detectable_; |
968 | const int32_t max_amount_; |
969 | std::vector<EditorPicture> editor_pictures_; |
970 | + |
971 | + DISALLOW_COPY_AND_ASSIGN(ResourceDescription); |
972 | }; |
973 | |
974 | } // namespace Widelands |
975 | |
976 | === modified file 'src/logic/world/terrain_description.h' |
977 | --- src/logic/world/terrain_description.h 2014-07-06 08:17:24 +0000 |
978 | +++ src/logic/world/terrain_description.h 2014-07-14 19:24:49 +0000 |
979 | @@ -22,8 +22,7 @@ |
980 | |
981 | #include <string> |
982 | |
983 | -#include <boost/noncopyable.hpp> |
984 | - |
985 | +#include "base/macros.h" |
986 | #include "logic/widelands.h" |
987 | #include "logic/world/resource_description.h" |
988 | |
989 | @@ -34,7 +33,7 @@ |
990 | class EditorCategory; |
991 | class World; |
992 | |
993 | -class TerrainDescription : boost::noncopyable { |
994 | +class TerrainDescription { |
995 | public: |
996 | enum Type { |
997 | GREEN = 0, |
998 | @@ -107,6 +106,8 @@ |
999 | double temperature_; |
1000 | double fertility_; |
1001 | double humidity_; |
1002 | + |
1003 | + DISALLOW_COPY_AND_ASSIGN(TerrainDescription); |
1004 | }; |
1005 | |
1006 | } // namespace Widelands |
1007 | |
1008 | === modified file 'src/logic/world/world.h' |
1009 | --- src/logic/world/world.h 2014-07-05 16:41:51 +0000 |
1010 | +++ src/logic/world/world.h 2014-07-14 19:24:49 +0000 |
1011 | @@ -22,6 +22,7 @@ |
1012 | |
1013 | #include <memory> |
1014 | |
1015 | +#include "base/macros.h" |
1016 | #include "logic/bob.h" |
1017 | #include "logic/description_maintainer.h" |
1018 | |
1019 | @@ -36,7 +37,7 @@ |
1020 | |
1021 | /// This is the in memory descriptions of the world and provides access to |
1022 | /// terrains, immovables and resources. |
1023 | -class World : boost::noncopyable { |
1024 | +class World { |
1025 | public: |
1026 | World(); |
1027 | ~World(); // Defined in .cc because all forward declarations are known then. |
1028 | @@ -89,6 +90,8 @@ |
1029 | std::unique_ptr<DescriptionMaintainer<ResourceDescription>> resources_; |
1030 | std::unique_ptr<DescriptionMaintainer<EditorCategory>> editor_terrain_categories_; |
1031 | std::unique_ptr<DescriptionMaintainer<EditorCategory>> editor_immovable_categories_; |
1032 | + |
1033 | + DISALLOW_COPY_AND_ASSIGN(World); |
1034 | }; |
1035 | |
1036 | } // namespace Widelands |
1037 | |
1038 | === modified file 'src/map_io/one_world_legacy_lookup_table.h' |
1039 | --- src/map_io/one_world_legacy_lookup_table.h 2014-07-05 16:41:51 +0000 |
1040 | +++ src/map_io/one_world_legacy_lookup_table.h 2014-07-14 19:24:49 +0000 |
1041 | @@ -24,10 +24,11 @@ |
1042 | #include <memory> |
1043 | #include <string> |
1044 | |
1045 | -#include <boost/noncopyable.hpp> |
1046 | +#include "base/macros.h" |
1047 | |
1048 | -class OneWorldLegacyLookupTable : boost::noncopyable { |
1049 | +class OneWorldLegacyLookupTable { |
1050 | public: |
1051 | + OneWorldLegacyLookupTable() = default; |
1052 | virtual ~OneWorldLegacyLookupTable(); |
1053 | |
1054 | /// Looks up the new name for the 'resource'. |
1055 | @@ -41,6 +42,8 @@ |
1056 | |
1057 | /// Looks up the new name for the 'immovable'. |
1058 | virtual std::string lookup_immovable(const std::string& immovable) const = 0; |
1059 | + |
1060 | + DISALLOW_COPY_AND_ASSIGN(OneWorldLegacyLookupTable); |
1061 | }; |
1062 | |
1063 | std::unique_ptr<OneWorldLegacyLookupTable> |
1064 | |
1065 | === modified file 'src/map_io/s2map.cc' |
1066 | --- src/map_io/s2map.cc 2014-07-05 14:22:44 +0000 |
1067 | +++ src/map_io/s2map.cc 2014-07-14 19:24:49 +0000 |
1068 | @@ -229,7 +229,7 @@ |
1069 | /// Returns S2 terrain index into (pre one-world) terrain names. Those are then |
1070 | /// looked up in the legacy conversion code and this gives the Widelands |
1071 | /// terrain. |
1072 | -class TerrainConverter : boost::noncopyable { |
1073 | +class TerrainConverter { |
1074 | public: |
1075 | TerrainConverter(const Widelands::World& world, const OneWorldLegacyLookupTable& lookup_table); |
1076 | Widelands::Terrain_Index lookup(S2_Map_Loader::WorldType world, int8_t c) const; |
1077 | @@ -238,6 +238,8 @@ |
1078 | const OneWorldLegacyLookupTable& one_world_legacy_lookup_table_; |
1079 | const Widelands::World& world_; |
1080 | const std::map<S2_Map_Loader::WorldType, std::vector<std::string>> table_; |
1081 | + |
1082 | + DISALLOW_COPY_AND_ASSIGN(TerrainConverter); |
1083 | }; |
1084 | |
1085 | TerrainConverter::TerrainConverter |
1086 | |
1087 | === modified file 'src/map_io/s2map.h' |
1088 | --- src/map_io/s2map.h 2014-07-05 16:41:51 +0000 |
1089 | +++ src/map_io/s2map.h 2014-07-14 19:24:49 +0000 |
1090 | @@ -22,6 +22,7 @@ |
1091 | |
1092 | #include <string> |
1093 | |
1094 | +#include "base/macros.h" |
1095 | #include "map_io/map_loader.h" |
1096 | |
1097 | class FileRead; |
1098 | |
1099 | === modified file 'src/profile/profile.h' |
1100 | --- src/profile/profile.h 2014-07-05 16:41:51 +0000 |
1101 | +++ src/profile/profile.h 2014-07-14 19:24:49 +0000 |
1102 | @@ -23,8 +23,6 @@ |
1103 | #include <cstring> |
1104 | #include <vector> |
1105 | |
1106 | -#include <boost/noncopyable.hpp> |
1107 | - |
1108 | #include "base/macros.h" |
1109 | #include "base/point.h" |
1110 | #include "io/filesystem/layered_filesystem.h" |
1111 | @@ -188,7 +186,7 @@ |
1112 | * Returns the next unused section of the given name, or 0 if all sections |
1113 | * have been used. name can be 0 to retrieve any remaining sections. |
1114 | */ |
1115 | -class Profile : boost::noncopyable { |
1116 | +class Profile { |
1117 | public: |
1118 | enum { |
1119 | err_ignore = 0, |
1120 | @@ -237,6 +235,8 @@ |
1121 | typedef std::vector<Section> Section_list; |
1122 | Section_list m_sections; |
1123 | int32_t m_error_level; |
1124 | + |
1125 | + DISALLOW_COPY_AND_ASSIGN(Profile); |
1126 | }; |
1127 | |
1128 | #endif // end of include guard: WL_PROFILE_PROFILE_H |
1129 | |
1130 | === modified file 'src/ui_basic/panel.h' |
1131 | --- src/ui_basic/panel.h 2014-07-13 14:36:19 +0000 |
1132 | +++ src/ui_basic/panel.h 2014-07-14 19:24:49 +0000 |
1133 | @@ -27,9 +27,9 @@ |
1134 | #include <string> |
1135 | |
1136 | #include <SDL_keyboard.h> |
1137 | -#include <boost/noncopyable.hpp> |
1138 | #include <boost/signals2/trackable.hpp> |
1139 | |
1140 | +#include "base/macros.h" |
1141 | #include "base/point.h" |
1142 | |
1143 | class RenderTarget; |
1144 | @@ -57,7 +57,7 @@ |
1145 | * its desired size changes, this automatically changes the actual size (which then invokes |
1146 | * \ref layout and \ref move_inside_parent). |
1147 | */ |
1148 | -struct Panel : boost::signals2::trackable, boost::noncopyable { |
1149 | +struct Panel : boost::signals2::trackable { |
1150 | enum { |
1151 | pf_handle_mouse = 1, ///< receive mouse events |
1152 | pf_think = 2, ///< call think() function during run |
1153 | @@ -305,6 +305,8 @@ |
1154 | static bool _g_allow_user_input; |
1155 | static const Image* s_default_cursor; |
1156 | static const Image* s_default_cursor_click; |
1157 | + |
1158 | + DISALLOW_COPY_AND_ASSIGN(Panel); |
1159 | }; |
1160 | |
1161 | inline void Panel::set_snap_windows_only_when_overlapping(const bool on) { |
1162 | |
1163 | === modified file 'src/ui_basic/unique_window.h' |
1164 | --- src/ui_basic/unique_window.h 2014-07-05 16:41:51 +0000 |
1165 | +++ src/ui_basic/unique_window.h 2014-07-14 19:24:49 +0000 |
1166 | @@ -22,8 +22,6 @@ |
1167 | |
1168 | #include <functional> |
1169 | |
1170 | -#include "boost/noncopyable.hpp" |
1171 | - |
1172 | #include "ui_basic/button.h" |
1173 | #include "ui_basic/window.h" |
1174 |
Great work!!!
- I think we should be consistent about where to place these macros.
1) Google style is to have them as the last thing in the class and always in a private statement. I like this because I am used to it and because it is already 'out there'.
2) One could argue that being not copyable is part of the public API - so it should be in the face of the user of the class (around the constructor or so). It is never that important in practice though since most classes that are designed not be copied will only be copied on accident - and it is fine if the compiler gives a warning then.
I vote for 1 with a slight variation: For c++11 it is no longer necessary for this to be in the private section of the class, so I would just state 'as last statement in your class' in the codecheck rule.
- Compile errors:
I think the problem you saw came from not delete'ing the copy constructor and operator=, but defining them and never declaring them. This is the prec++11 way of doing this macro - it has the disadvantage, that you promise the compiler to implement any constructor (the copy constructor) and so it no longer defines a default constructor for you. If you use the c++11 way:
#define DISALLOW_ COPY_AND_ ASSIGN( TypeName) \
TypeName(const TypeName&) = delete; \
void operator=(const TypeName&) = delete
it should no longer complain. If am wrong and it still does adding a `TypeName() = default;` into the class that blows up should help out.