Merge lp:~p12/kicad/remove-uses-namespace-std into lp:kicad/product
- remove-uses-namespace-std
- Merge into product
Proposed by
Povilas Kanapickas
Status: | Merged |
---|---|
Merge reported by: | Dick Hollenbeck |
Merged at revision: | not available |
Proposed branch: | lp:~p12/kicad/remove-uses-namespace-std |
Merge into: | lp:kicad/product |
Diff against target: |
1780 lines (+184/-244) 47 files modified
CMakeModules/PerformFeatureChecks.cmake (+1/-1) common/geometry/shape_line_chain.cpp (+4/-5) common/gr_basic.cpp (+2/-2) common/tool/tool_event.cpp (+1/-3) common/tool/tool_manager.cpp (+0/-1) eeschema/annotate.cpp (+1/-2) eeschema/component_references_lister.cpp (+1/-1) eeschema/hierarch.cpp (+1/-1) eeschema/sch_bus_entry.cpp (+1/-1) eeschema/sch_bus_entry.h (+1/-1) eeschema/sch_component.cpp (+2/-2) eeschema/sch_component.h (+2/-2) eeschema/sch_junction.cpp (+1/-1) eeschema/sch_junction.h (+1/-1) eeschema/sch_line.cpp (+1/-1) eeschema/sch_line.h (+3/-3) eeschema/sch_no_connect.cpp (+1/-1) eeschema/sch_no_connect.h (+1/-1) eeschema/sch_sheet.cpp (+1/-1) eeschema/sch_sheet.h (+1/-1) eeschema/sch_text.cpp (+1/-1) eeschema/sch_text.h (+1/-1) include/sch_item_struct.h (+4/-7) include/tool/examples/coroutine_example.cpp (+0/-2) include/tool/examples/delegate_example.cpp (+0/-2) kicad/dialogs/dialog_template_selector.h (+1/-1) kicad/project_template.cpp (+4/-6) kicad/project_template.h (+1/-4) new/sch_dir_lib_source.cpp (+0/-3) new/sch_lib_table.cpp (+0/-1) pcbnew/eagle_plugin.cpp (+64/-65) pcbnew/github/github_plugin.cpp (+13/-18) pcbnew/gpcb_plugin.cpp (+8/-11) pcbnew/kicad_plugin.cpp (+1/-4) pcbnew/legacy_plugin.cpp (+13/-16) pcbnew/pcb_parser.cpp (+13/-17) pcbnew/router/pns_line.cpp (+2/-3) pcbnew/router/pns_line_placer.cpp (+1/-3) pcbnew/router/pns_node.cpp (+7/-9) pcbnew/router/pns_optimizer.cpp (+3/-5) pcbnew/router/pns_router.cpp (+5/-7) pcbnew/router/pns_shove.cpp (+2/-4) pcbnew/router/pns_walkaround.cpp (+0/-4) pcbnew/router/router_tool.cpp (+0/-1) polygon/SutherlandHodgmanClipPoly.h (+7/-8) polygon/poly2tri/common/shapes.cc (+6/-7) scripting/kicad.i (+0/-2) |
To merge this branch: | bzr merge lp:~p12/kicad/remove-uses-namespace-std |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
KiCad Lead Developers | Pending | ||
Review via email: mp+197657@code.launchpad.net |
Commit message
Description of the change
Remove uses of using namespace std.
To post a comment you must log in.
Revision history for this message
Dick Hollenbeck (dickelbeck) wrote : | # |
Revision history for this message
Dick Hollenbeck (dickelbeck) wrote : | # |
The negotiated result was that we are to add these lines to the Coding Standards document:
The project should never use 'using namespace ...' in a header file, but using
it in a *.cpp file is OK, according to the author of the *.cpp file's preference.
If it occurs in a *.cpp file, it must occur after any #include statements.
(Wayne agreed to do that.)
Then I consulted authors/developers who have made use of 'using namespace' in *.cpp files, which is still legal, to find out what they were willing to give up. The applied patch is a result of this process, and it is a subset of the original request.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeModules/PerformFeatureChecks.cmake' |
2 | --- CMakeModules/PerformFeatureChecks.cmake 2013-10-03 22:53:42 +0000 |
3 | +++ CMakeModules/PerformFeatureChecks.cmake 2013-12-04 08:51:30 +0000 |
4 | @@ -92,7 +92,7 @@ |
5 | |
6 | # CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a |
7 | # small program to verify isinf() exists in cmath. |
8 | - check_cxx_source_compiles( "#include <cmath>\nusing namespace std;\nint main(int argc, char** argv)\n{\n (void)argv;\n isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF ) |
9 | + check_cxx_source_compiles( "#include <cmath>\nint main(int argc, char** argv)\n{\n (void)argv;\n std::isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF ) |
10 | |
11 | #check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work |
12 | check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) |
13 | |
14 | === modified file 'common/geometry/shape_line_chain.cpp' |
15 | --- common/geometry/shape_line_chain.cpp 2013-10-14 18:40:36 +0000 |
16 | +++ common/geometry/shape_line_chain.cpp 2013-12-04 08:51:30 +0000 |
17 | @@ -25,7 +25,6 @@ |
18 | #include <geometry/shape_line_chain.h> |
19 | #include <geometry/shape_circle.h> |
20 | |
21 | -using namespace std; |
22 | using boost::optional; |
23 | |
24 | bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const |
25 | @@ -137,7 +136,7 @@ |
26 | int d = INT_MAX; |
27 | |
28 | for( int s = 0; s < SegmentCount(); s++ ) |
29 | - d = min( d, CSegment( s ).Distance( aP ) ); |
30 | + d = std::min( d, CSegment( s ).Distance( aP ) ); |
31 | |
32 | return d; |
33 | } |
34 | @@ -437,7 +436,7 @@ |
35 | |
36 | SHAPE_LINE_CHAIN& SHAPE_LINE_CHAIN::Simplify() |
37 | { |
38 | - vector<VECTOR2I> pts_unique; |
39 | + std::vector<VECTOR2I> pts_unique; |
40 | |
41 | if( PointCount() < 2 ) |
42 | { |
43 | @@ -524,9 +523,9 @@ |
44 | } |
45 | |
46 | |
47 | -const string SHAPE_LINE_CHAIN::Format() const |
48 | +const std::string SHAPE_LINE_CHAIN::Format() const |
49 | { |
50 | - stringstream ss; |
51 | + std::stringstream ss; |
52 | |
53 | ss << m_points.size() << " " << ( m_closed ? 1 : 0 ) << " "; |
54 | |
55 | |
56 | === modified file 'common/gr_basic.cpp' |
57 | --- common/gr_basic.cpp 2013-09-11 09:11:27 +0000 |
58 | +++ common/gr_basic.cpp 2013-12-04 08:51:30 +0000 |
59 | @@ -1358,8 +1358,8 @@ |
60 | } |
61 | |
62 | // A clip box exists: clip and draw the polygon. |
63 | - static vector<wxPoint> clippedPolygon; |
64 | - static pointVector inputPolygon, outputPolygon; |
65 | + static std::vector<wxPoint> clippedPolygon; |
66 | + static pointVector inputPolygon, outputPolygon; |
67 | |
68 | inputPolygon.clear(); |
69 | outputPolygon.clear(); |
70 | |
71 | === modified file 'common/tool/tool_event.cpp' |
72 | --- common/tool/tool_event.cpp 2013-10-15 08:41:00 +0000 |
73 | +++ common/tool/tool_event.cpp 2013-12-04 08:51:30 +0000 |
74 | @@ -31,8 +31,6 @@ |
75 | |
76 | #include <boost/foreach.hpp> |
77 | |
78 | -using namespace std; |
79 | - |
80 | struct FlagString |
81 | { |
82 | int flag; |
83 | @@ -153,7 +151,7 @@ |
84 | |
85 | const std::string TOOL_EVENT_LIST::Format() const |
86 | { |
87 | - string s; |
88 | + std::string s; |
89 | |
90 | BOOST_FOREACH( TOOL_EVENT e, m_events ) |
91 | s += e.Format() + " "; |
92 | |
93 | === modified file 'common/tool/tool_manager.cpp' |
94 | --- common/tool/tool_manager.cpp 2013-11-13 19:59:47 +0000 |
95 | +++ common/tool/tool_manager.cpp 2013-12-04 08:51:30 +0000 |
96 | @@ -47,7 +47,6 @@ |
97 | #include <class_drawpanel_gal.h> |
98 | |
99 | using boost::optional; |
100 | -using namespace std; |
101 | |
102 | /// Struct describing the current execution state of a TOOL |
103 | struct TOOL_MANAGER::TOOL_STATE |
104 | |
105 | === modified file 'eeschema/annotate.cpp' |
106 | --- eeschema/annotate.cpp 2013-07-03 07:27:52 +0000 |
107 | +++ eeschema/annotate.cpp 2013-12-04 08:51:30 +0000 |
108 | @@ -26,8 +26,7 @@ |
109 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
110 | */ |
111 | |
112 | -#include <algorithm> // to use sort vector |
113 | -#include <vector> |
114 | +#include <algorithm> |
115 | |
116 | #include <fctsys.h> |
117 | #include <class_drawpanel.h> |
118 | |
119 | === modified file 'eeschema/component_references_lister.cpp' |
120 | --- eeschema/component_references_lister.cpp 2013-06-14 14:59:52 +0000 |
121 | +++ eeschema/component_references_lister.cpp 2013-12-04 08:51:30 +0000 |
122 | @@ -30,7 +30,7 @@ |
123 | |
124 | |
125 | #include <wx/regex.h> |
126 | -#include <algorithm> // to use sort vector |
127 | +#include <algorithm> |
128 | #include <vector> |
129 | |
130 | #include <fctsys.h> |
131 | |
132 | === modified file 'eeschema/hierarch.cpp' |
133 | --- eeschema/hierarch.cpp 2013-11-15 09:28:31 +0000 |
134 | +++ eeschema/hierarch.cpp 2013-12-04 08:51:30 +0000 |
135 | @@ -169,7 +169,7 @@ |
136 | |
137 | // Set dialog window size to be large enough |
138 | m_TreeSize.x = itemrect.GetWidth() + 20; |
139 | - m_TreeSize.x = max( m_TreeSize.x, 250 ); |
140 | + m_TreeSize.x = std::max( m_TreeSize.x, 250 ); |
141 | |
142 | // Readjust the size of the frame to an optimal value. |
143 | m_TreeSize.y = m_nbsheets * itemrect.GetHeight(); |
144 | |
145 | === modified file 'eeschema/sch_bus_entry.cpp' |
146 | --- eeschema/sch_bus_entry.cpp 2013-11-24 17:48:14 +0000 |
147 | +++ eeschema/sch_bus_entry.cpp 2013-12-04 08:51:30 +0000 |
148 | @@ -246,7 +246,7 @@ |
149 | } |
150 | |
151 | |
152 | -void SCH_BUS_ENTRY_BASE::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
153 | +void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
154 | { |
155 | aPoints.push_back( m_pos ); |
156 | aPoints.push_back( m_End() ); |
157 | |
158 | === modified file 'eeschema/sch_bus_entry.h' |
159 | --- eeschema/sch_bus_entry.h 2013-11-24 17:48:14 +0000 |
160 | +++ eeschema/sch_bus_entry.h 2013-12-04 08:51:30 +0000 |
161 | @@ -96,7 +96,7 @@ |
162 | |
163 | bool IsConnectable() const { return true; } |
164 | |
165 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
166 | + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; |
167 | |
168 | BITMAP_DEF GetMenuImage() const { return add_entry_xpm; } |
169 | |
170 | |
171 | === modified file 'eeschema/sch_component.cpp' |
172 | --- eeschema/sch_component.cpp 2013-11-26 09:15:20 +0000 |
173 | +++ eeschema/sch_component.cpp 2013-12-04 08:51:30 +0000 |
174 | @@ -1605,7 +1605,7 @@ |
175 | } |
176 | |
177 | |
178 | -void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
179 | +void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
180 | { |
181 | LIB_PIN* pin; |
182 | LIB_COMPONENT* component = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); |
183 | @@ -1876,7 +1876,7 @@ |
184 | |
185 | bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const |
186 | { |
187 | - vector< wxPoint > pts; |
188 | + std::vector< wxPoint > pts; |
189 | |
190 | GetConnectionPoints( pts ); |
191 | |
192 | |
193 | === modified file 'eeschema/sch_component.h' |
194 | --- eeschema/sch_component.h 2013-11-24 17:48:14 +0000 |
195 | +++ eeschema/sch_component.h 2013-12-04 08:51:30 +0000 |
196 | @@ -357,7 +357,7 @@ |
197 | |
198 | bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); |
199 | |
200 | - void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); |
201 | + void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ); |
202 | |
203 | wxPoint GetPinPhysicalPosition( LIB_PIN* Pin ); |
204 | |
205 | @@ -372,7 +372,7 @@ |
206 | */ |
207 | bool IsInNetlist() const; |
208 | |
209 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
210 | + void GetConnectionPoints( std::vector<wxPoint>& aPoints ) const; |
211 | |
212 | SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, |
213 | const KICAD_T scanTypes[] ); |
214 | |
215 | === modified file 'eeschema/sch_junction.cpp' |
216 | --- eeschema/sch_junction.cpp 2013-11-24 17:48:14 +0000 |
217 | +++ eeschema/sch_junction.cpp 2013-12-04 08:51:30 +0000 |
218 | @@ -168,7 +168,7 @@ |
219 | } |
220 | |
221 | |
222 | -void SCH_JUNCTION::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
223 | +void SCH_JUNCTION::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
224 | { |
225 | aPoints.push_back( m_pos ); |
226 | } |
227 | |
228 | === modified file 'eeschema/sch_junction.h' |
229 | --- eeschema/sch_junction.h 2013-11-24 17:48:14 +0000 |
230 | +++ eeschema/sch_junction.h 2013-12-04 08:51:30 +0000 |
231 | @@ -81,7 +81,7 @@ |
232 | |
233 | bool IsConnectable() const { return true; } |
234 | |
235 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
236 | + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; |
237 | |
238 | wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); } |
239 | |
240 | |
241 | === modified file 'eeschema/sch_line.cpp' |
242 | --- eeschema/sch_line.cpp 2013-11-24 17:48:14 +0000 |
243 | +++ eeschema/sch_line.cpp 2013-12-04 08:51:30 +0000 |
244 | @@ -461,7 +461,7 @@ |
245 | } |
246 | |
247 | |
248 | -void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
249 | +void SCH_LINE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
250 | { |
251 | aPoints.push_back( m_start ); |
252 | aPoints.push_back( m_end ); |
253 | |
254 | === modified file 'eeschema/sch_line.h' |
255 | --- eeschema/sch_line.h 2013-11-24 17:48:14 +0000 |
256 | +++ eeschema/sch_line.h 2013-12-04 08:51:30 +0000 |
257 | @@ -113,9 +113,9 @@ |
258 | */ |
259 | bool MergeOverlap( SCH_LINE* aLine ); |
260 | |
261 | - void GetEndPoints( vector <DANGLING_END_ITEM>& aItemList ); |
262 | + void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ); |
263 | |
264 | - bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ); |
265 | + bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ); |
266 | |
267 | bool IsDangling() const { return m_startIsDangling || m_endIsDangling; } |
268 | |
269 | @@ -123,7 +123,7 @@ |
270 | |
271 | bool IsConnectable() const; |
272 | |
273 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
274 | + void GetConnectionPoints(std::vector< wxPoint >& aPoints ) const; |
275 | |
276 | wxString GetSelectMenuText() const; |
277 | |
278 | |
279 | === modified file 'eeschema/sch_no_connect.cpp' |
280 | --- eeschema/sch_no_connect.cpp 2013-11-24 17:48:14 +0000 |
281 | +++ eeschema/sch_no_connect.cpp 2013-12-04 08:51:30 +0000 |
282 | @@ -182,7 +182,7 @@ |
283 | } |
284 | |
285 | |
286 | -void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
287 | +void SCH_NO_CONNECT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
288 | { |
289 | aPoints.push_back( m_pos ); |
290 | } |
291 | |
292 | === modified file 'eeschema/sch_no_connect.h' |
293 | --- eeschema/sch_no_connect.h 2013-11-24 17:48:14 +0000 |
294 | +++ eeschema/sch_no_connect.h 2013-12-04 08:51:30 +0000 |
295 | @@ -81,7 +81,7 @@ |
296 | |
297 | bool IsConnectable() const { return true; } |
298 | |
299 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
300 | + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; |
301 | |
302 | wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); } |
303 | |
304 | |
305 | === modified file 'eeschema/sch_sheet.cpp' |
306 | --- eeschema/sch_sheet.cpp 2013-11-24 17:48:14 +0000 |
307 | +++ eeschema/sch_sheet.cpp 2013-12-04 08:51:30 +0000 |
308 | @@ -1000,7 +1000,7 @@ |
309 | } |
310 | |
311 | |
312 | -void SCH_SHEET::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
313 | +void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
314 | { |
315 | for( size_t i = 0; i < GetPins().size(); i++ ) |
316 | aPoints.push_back( GetPins()[i].GetPosition() ); |
317 | |
318 | === modified file 'eeschema/sch_sheet.h' |
319 | --- eeschema/sch_sheet.h 2013-11-24 17:48:14 +0000 |
320 | +++ eeschema/sch_sheet.h 2013-12-04 08:51:30 +0000 |
321 | @@ -533,7 +533,7 @@ |
322 | |
323 | bool IsConnectable() const { return true; } |
324 | |
325 | - void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
326 | + void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; |
327 | |
328 | SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, |
329 | const KICAD_T scanTypes[] ); |
330 | |
331 | === modified file 'eeschema/sch_text.cpp' |
332 | --- eeschema/sch_text.cpp 2013-11-29 08:13:43 +0000 |
333 | +++ eeschema/sch_text.cpp 2013-12-04 08:51:30 +0000 |
334 | @@ -564,7 +564,7 @@ |
335 | } |
336 | |
337 | |
338 | -void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const |
339 | +void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const |
340 | { |
341 | // Normal text labels do not have connection points. All others do. |
342 | if( Type() == SCH_TEXT_T ) |
343 | |
344 | === modified file 'eeschema/sch_text.h' |
345 | --- eeschema/sch_text.h 2013-11-24 17:48:14 +0000 |
346 | +++ eeschema/sch_text.h 2013-12-04 08:51:30 +0000 |
347 | @@ -189,7 +189,7 @@ |
348 | |
349 | virtual bool IsSelectStateChanged( const wxRect& aRect ); |
350 | |
351 | - virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; |
352 | + virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const; |
353 | |
354 | virtual bool CanIncrementLabel() const { return true; } |
355 | |
356 | |
357 | === modified file 'include/sch_item_struct.h' |
358 | --- include/sch_item_struct.h 2013-10-27 18:21:53 +0000 |
359 | +++ include/sch_item_struct.h 2013-12-04 08:51:30 +0000 |
360 | @@ -34,9 +34,6 @@ |
361 | #include <class_base_screen.h> |
362 | #include <general.h> |
363 | |
364 | -using namespace std; |
365 | - |
366 | - |
367 | class SCH_ITEM; |
368 | class SCH_SHEET_PATH; |
369 | class LINE_READER; |
370 | @@ -49,7 +46,7 @@ |
371 | |
372 | typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS; |
373 | typedef SCH_ITEMS::iterator SCH_ITEMS_ITR; |
374 | -typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; |
375 | +typedef std::vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; |
376 | |
377 | |
378 | #define FMT_IU SCH_ITEM::FormatInternalUnits |
379 | @@ -228,7 +225,7 @@ |
380 | * |
381 | * @param aItemList - List of DANGLING_END_ITEMS to add to. |
382 | */ |
383 | - virtual void GetEndPoints( vector< DANGLING_END_ITEM >& aItemList ) {} |
384 | + virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {} |
385 | |
386 | /** |
387 | * Function IsDanglingStateChanged |
388 | @@ -243,7 +240,7 @@ |
389 | * @param aItemList - List of items to test item against. |
390 | * @return True if the dangling state has changed from it's current setting. |
391 | */ |
392 | - virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ) { return false; } |
393 | + virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) { return false; } |
394 | |
395 | virtual bool IsDangling() const { return false; } |
396 | |
397 | @@ -273,7 +270,7 @@ |
398 | * |
399 | * @param aPoints List of connection points to add to. |
400 | */ |
401 | - virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const { } |
402 | + virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { } |
403 | |
404 | /** |
405 | * Function ClearConnections |
406 | |
407 | === modified file 'include/tool/examples/coroutine_example.cpp' |
408 | --- include/tool/examples/coroutine_example.cpp 2013-10-14 14:13:35 +0000 |
409 | +++ include/tool/examples/coroutine_example.cpp 2013-12-04 08:51:30 +0000 |
410 | @@ -3,8 +3,6 @@ |
411 | |
412 | #include <tool/coroutine.h> |
413 | |
414 | -using namespace std; |
415 | - |
416 | typedef COROUTINE<int, int> MyCoroutine; |
417 | |
418 | class MyClass |
419 | |
420 | === modified file 'include/tool/examples/delegate_example.cpp' |
421 | --- include/tool/examples/delegate_example.cpp 2013-10-14 14:13:35 +0000 |
422 | +++ include/tool/examples/delegate_example.cpp 2013-12-04 08:51:30 +0000 |
423 | @@ -3,8 +3,6 @@ |
424 | |
425 | #include <tool/delegate.h> |
426 | |
427 | -using namespace std; |
428 | - |
429 | class MyClass |
430 | { |
431 | public: |
432 | |
433 | === modified file 'kicad/dialogs/dialog_template_selector.h' |
434 | --- kicad/dialogs/dialog_template_selector.h 2013-06-13 16:09:35 +0000 |
435 | +++ kicad/dialogs/dialog_template_selector.h 2013-12-04 08:51:30 +0000 |
436 | @@ -79,7 +79,7 @@ |
437 | class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE |
438 | { |
439 | protected: |
440 | - vector<TEMPLATE_SELECTION_PANEL*> m_panels; |
441 | + std::vector<TEMPLATE_SELECTION_PANEL*> m_panels; |
442 | void AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate ); |
443 | TEMPLATE_WIDGET* m_selectedWidget; |
444 | |
445 | |
446 | === modified file 'kicad/project_template.cpp' |
447 | --- kicad/project_template.cpp 2013-05-26 04:36:44 +0000 |
448 | +++ kicad/project_template.cpp 2013-12-04 08:51:30 +0000 |
449 | @@ -33,8 +33,6 @@ |
450 | #include <wx/txtstrm.h> |
451 | #include <wx/wfstream.h> |
452 | |
453 | -using namespace std; |
454 | - |
455 | #define SEP() wxFileName::GetPathSeparator() |
456 | |
457 | |
458 | @@ -71,9 +69,9 @@ |
459 | metaIcon = new wxBitmap( templateMetaIconFile.GetFullPath(), wxBITMAP_TYPE_PNG ); |
460 | } |
461 | |
462 | -vector<wxFileName> PROJECT_TEMPLATE::GetFileList() |
463 | +std::vector<wxFileName> PROJECT_TEMPLATE::GetFileList() |
464 | { |
465 | - vector<wxFileName> files; |
466 | + std::vector<wxFileName> files; |
467 | wxString f = templateBasePath.GetPath(); |
468 | wxArrayString allfiles; |
469 | wxFileName p; |
470 | @@ -122,8 +120,8 @@ |
471 | { |
472 | bool result = true; |
473 | |
474 | - vector<wxFileName> srcFiles = GetFileList(); |
475 | - vector<wxFileName> dstFiles; |
476 | + std::vector<wxFileName> srcFiles = GetFileList(); |
477 | + std::vector<wxFileName> dstFiles; |
478 | |
479 | for( size_t i=0; i < srcFiles.size(); i++ ) |
480 | { |
481 | |
482 | === modified file 'kicad/project_template.h' |
483 | --- kicad/project_template.h 2013-06-13 16:09:35 +0000 |
484 | +++ kicad/project_template.h 2013-12-04 08:51:30 +0000 |
485 | @@ -110,9 +110,6 @@ |
486 | #include <wx/image.h> |
487 | #include <wx/filename.h> |
488 | |
489 | -using namespace std; |
490 | - |
491 | - |
492 | /** |
493 | * @brief A directory which contains information about the project template and does not get |
494 | * copied. This define is the default filename for this directory |
495 | @@ -200,7 +197,7 @@ |
496 | * @brief Get a vector list of filenames for the template. The files are the source files, |
497 | * and have not yet been through any renaming |
498 | */ |
499 | - vector<wxFileName> GetFileList(); |
500 | + std::vector<wxFileName> GetFileList(); |
501 | }; |
502 | |
503 | #endif |
504 | |
505 | === modified file 'new/sch_dir_lib_source.cpp' |
506 | --- new/sch_dir_lib_source.cpp 2011-11-04 15:53:37 +0000 |
507 | +++ new/sch_dir_lib_source.cpp 2013-12-04 08:51:30 +0000 |
508 | @@ -52,9 +52,6 @@ |
509 | #include <errno.h> |
510 | #include <assert.h> |
511 | |
512 | -#include <vector> |
513 | -using namespace std; |
514 | - |
515 | #include <sch_dir_lib_source.h> |
516 | using namespace SCH; |
517 | |
518 | |
519 | === modified file 'new/sch_lib_table.cpp' |
520 | --- new/sch_lib_table.cpp 2012-11-15 16:04:10 +0000 |
521 | +++ new/sch_lib_table.cpp 2013-12-04 08:51:30 +0000 |
522 | @@ -31,7 +31,6 @@ |
523 | #include <sch_dir_lib_source.h> |
524 | |
525 | |
526 | -//using namespace std; // screws up Doxygen |
527 | using namespace SCH; |
528 | using namespace LT; // tokens, enum T for LIB_TABLE |
529 | |
530 | |
531 | === modified file 'pcbnew/eagle_plugin.cpp' |
532 | --- pcbnew/eagle_plugin.cpp 2013-11-29 18:29:41 +0000 |
533 | +++ pcbnew/eagle_plugin.cpp 2013-12-04 08:51:30 +0000 |
534 | @@ -77,7 +77,6 @@ |
535 | #include <class_pcb_text.h> |
536 | |
537 | using namespace boost::property_tree; |
538 | -using namespace std; |
539 | |
540 | typedef EAGLE_PLUGIN::BIU BIU; |
541 | typedef PTREE::const_assoc_iterator CA_ITER; |
542 | @@ -87,7 +86,7 @@ |
543 | typedef MODULE_MAP::iterator MODULE_ITER; |
544 | typedef MODULE_MAP::const_iterator MODULE_CITER; |
545 | |
546 | -typedef boost::optional<string> opt_string; |
547 | +typedef boost::optional<std::string> opt_string; |
548 | typedef boost::optional<int> opt_int; |
549 | typedef boost::optional<double> opt_double; |
550 | typedef boost::optional<bool> opt_bool; |
551 | @@ -151,11 +150,11 @@ |
552 | } |
553 | |
554 | /// return the contents of the XPATH as a single string |
555 | - string Contents() |
556 | + std::string Contents() |
557 | { |
558 | typedef std::vector<TRIPLET>::const_iterator CITER; |
559 | |
560 | - string ret; |
561 | + std::string ret; |
562 | |
563 | for( CITER it = p.begin(); it != p.end(); ++it ) |
564 | { |
565 | @@ -187,7 +186,7 @@ |
566 | static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) |
567 | { |
568 | opt_bool ret; |
569 | - opt_string stemp = attribs.get_optional<string>( aName ); |
570 | + opt_string stemp = attribs.get_optional<std::string>( aName ); |
571 | |
572 | if( stemp ) |
573 | ret = !stemp->compare( "yes" ); |
574 | @@ -227,7 +226,7 @@ |
575 | |
576 | /// parse an Eagle XML "rot" field. Unfortunately the DTD seems not to explain |
577 | /// this format very well. [S][M]R<degrees>. Examples: "R90", "MR180", "SR180" |
578 | -static EROT erot( const string& aRot ) |
579 | +static EROT erot( const std::string& aRot ) |
580 | { |
581 | EROT rot; |
582 | |
583 | @@ -245,7 +244,7 @@ |
584 | static opt_erot parseOptionalEROT( CPTREE& attribs ) |
585 | { |
586 | opt_erot ret; |
587 | - opt_string stemp = attribs.get_optional<string>( "rot" ); |
588 | + opt_string stemp = attribs.get_optional<std::string>( "rot" ); |
589 | if( stemp ) |
590 | ret = erot( *stemp ); |
591 | return ret; |
592 | @@ -316,7 +315,7 @@ |
593 | |
594 | curve = attribs.get_optional<double>( "curve" ); |
595 | |
596 | - opt_string s = attribs.get_optional<string>( "style" ); |
597 | + opt_string s = attribs.get_optional<std::string>( "style" ); |
598 | if( s ) |
599 | { |
600 | if( !s->compare( "continuous" ) ) |
601 | @@ -329,7 +328,7 @@ |
602 | style = EWIRE::DASHDOT; |
603 | } |
604 | |
605 | - s = attribs.get_optional<string>( "cap" ); |
606 | + s = attribs.get_optional<std::string>( "cap" ); |
607 | if( s ) |
608 | { |
609 | if( !s->compare( "round" ) ) |
610 | @@ -374,13 +373,13 @@ |
611 | x = attribs.get<double>( "x" ); |
612 | y = attribs.get<double>( "y" ); |
613 | |
614 | - string ext = attribs.get<string>( "extent" ); |
615 | + std::string ext = attribs.get<std::string>( "extent" ); |
616 | |
617 | sscanf( ext.c_str(), "%u-%u", &layer_front_most, &layer_back_most ); |
618 | |
619 | drill = attribs.get<double>( "drill" ); |
620 | diam = attribs.get_optional<double>( "diameter" ); |
621 | - shape = attribs.get_optional<string>( "shape" ); |
622 | + shape = attribs.get_optional<std::string>( "shape" ); |
623 | } |
624 | |
625 | |
626 | @@ -460,7 +459,7 @@ |
627 | /// Eagle "attribute" XML element, no foolin'. |
628 | struct EATTR |
629 | { |
630 | - string name; |
631 | + std::string name; |
632 | opt_string value; |
633 | opt_double x; |
634 | opt_double y; |
635 | @@ -508,8 +507,8 @@ |
636 | > |
637 | */ |
638 | |
639 | - name = attribs.get<string>( "name" ); // #REQUIRED |
640 | - value = attribs.get_optional<string>( "value" ); |
641 | + name = attribs.get<std::string>( "name" ); // #REQUIRED |
642 | + value = attribs.get_optional<std::string>( "value" ); |
643 | |
644 | x = attribs.get_optional<double>( "x" ); |
645 | y = attribs.get_optional<double>( "y" ); |
646 | @@ -522,7 +521,7 @@ |
647 | ratio = attribs.get_optional<double>( "ratio" ); |
648 | rot = parseOptionalEROT( attribs ); |
649 | |
650 | - opt_string stemp = attribs.get_optional<string>( "display" ); |
651 | + opt_string stemp = attribs.get_optional<std::string>( "display" ); |
652 | if( stemp ) |
653 | { |
654 | // (off | value | name | both) |
655 | @@ -541,7 +540,7 @@ |
656 | /// Eagle text element |
657 | struct ETEXT |
658 | { |
659 | - string text; |
660 | + std::string text; |
661 | double x; |
662 | double y; |
663 | double size; |
664 | @@ -593,11 +592,11 @@ |
665 | size = attribs.get<double>( "size" ); |
666 | layer = attribs.get<int>( "layer" ); |
667 | |
668 | - font = attribs.get_optional<string>( "font" ); |
669 | + font = attribs.get_optional<std::string>( "font" ); |
670 | ratio = attribs.get_optional<double>( "ratio" ); |
671 | rot = parseOptionalEROT( attribs ); |
672 | |
673 | - opt_string stemp = attribs.get_optional<string>( "align" ); |
674 | + opt_string stemp = attribs.get_optional<std::string>( "align" ); |
675 | if( stemp ) |
676 | { |
677 | // (bottom-left | bottom-center | bottom-right | center-left | |
678 | @@ -627,7 +626,7 @@ |
679 | /// Eagle thru hol pad |
680 | struct EPAD |
681 | { |
682 | - string name; |
683 | + std::string name; |
684 | double x; |
685 | double y; |
686 | double drill; |
687 | @@ -671,14 +670,14 @@ |
688 | */ |
689 | |
690 | // #REQUIRED says DTD, throw exception if not found |
691 | - name = attribs.get<string>( "name" ); |
692 | + name = attribs.get<std::string>( "name" ); |
693 | x = attribs.get<double>( "x" ); |
694 | y = attribs.get<double>( "y" ); |
695 | drill = attribs.get<double>( "drill" ); |
696 | |
697 | diameter = attribs.get_optional<double>( "diameter" ); |
698 | |
699 | - opt_string s = attribs.get_optional<string>( "shape" ); |
700 | + opt_string s = attribs.get_optional<std::string>( "shape" ); |
701 | if( s ) |
702 | { |
703 | // (square | round | octagon | long | offset) |
704 | @@ -704,7 +703,7 @@ |
705 | /// Eagle SMD pad |
706 | struct ESMD |
707 | { |
708 | - string name; |
709 | + std::string name; |
710 | double x; |
711 | double y; |
712 | double dx; |
713 | @@ -740,7 +739,7 @@ |
714 | */ |
715 | |
716 | // DTD #REQUIRED, throw exception if not found |
717 | - name = attribs.get<string>( "name" ); |
718 | + name = attribs.get<std::string>( "name" ); |
719 | x = attribs.get<double>( "x" ); |
720 | y = attribs.get<double>( "y" ); |
721 | dx = attribs.get<double>( "dx" ); |
722 | @@ -824,7 +823,7 @@ |
723 | layer = attribs.get<int>( "layer" ); |
724 | spacing = attribs.get_optional<double>( "spacing" ); |
725 | |
726 | - opt_string s = attribs.get_optional<string>( "pour" ); |
727 | + opt_string s = attribs.get_optional<std::string>( "pour" ); |
728 | if( s ) |
729 | { |
730 | // (solid | hatch | cutout) |
731 | @@ -874,10 +873,10 @@ |
732 | /// Eagle element element |
733 | struct EELEMENT |
734 | { |
735 | - string name; |
736 | - string library; |
737 | - string package; |
738 | - string value; |
739 | + std::string name; |
740 | + std::string library; |
741 | + std::string package; |
742 | + std::string value; |
743 | double x; |
744 | double y; |
745 | opt_bool locked; |
746 | @@ -907,11 +906,11 @@ |
747 | */ |
748 | |
749 | // #REQUIRED |
750 | - name = attribs.get<string>( "name" ); |
751 | - library = attribs.get<string>( "library" ); |
752 | - value = attribs.get<string>( "value" ); |
753 | + name = attribs.get<std::string>( "name" ); |
754 | + library = attribs.get<std::string>( "library" ); |
755 | + value = attribs.get<std::string>( "value" ); |
756 | |
757 | - package = attribs.get<string>( "package" ); |
758 | + package = attribs.get<std::string>( "package" ); |
759 | ReplaceIllegalFileNameChars( &package ); |
760 | |
761 | x = attribs.get<double>( "x" ); |
762 | @@ -927,7 +926,7 @@ |
763 | struct ELAYER |
764 | { |
765 | int number; |
766 | - string name; |
767 | + std::string name; |
768 | int color; |
769 | int fill; |
770 | opt_bool visible; |
771 | @@ -953,7 +952,7 @@ |
772 | */ |
773 | |
774 | number = attribs.get<int>( "number" ); |
775 | - name = attribs.get<string>( "name" ); |
776 | + name = attribs.get<std::string>( "name" ); |
777 | color = attribs.get<int>( "color" ); |
778 | visible = parseOptionalBool( attribs, "visible" ); |
779 | active = parseOptionalBool( attribs, "active" ); |
780 | @@ -962,7 +961,7 @@ |
781 | |
782 | /// Parse an eagle distance which is either mm, or mils if there is "mil" suffix. |
783 | /// Return is in BIU. |
784 | -static double parseEagle( const string& aDistance ) |
785 | +static double parseEagle( const std::string& aDistance ) |
786 | { |
787 | double ret = strtod( aDistance.c_str(), NULL ); |
788 | if( aDistance.npos != aDistance.find( "mil" ) ) |
789 | @@ -1019,7 +1018,7 @@ |
790 | |
791 | CPTREE& attribs = it->second.get_child( "<xmlattr>" ); |
792 | |
793 | - const string& name = attribs.get<string>( "name" ); |
794 | + const std::string& name = attribs.get<std::string>( "name" ); |
795 | |
796 | if( name == "psElongationLong" ) |
797 | psElongationLong = attribs.get<int>( "value" ); |
798 | @@ -1028,28 +1027,28 @@ |
799 | else if( name == "rvPadTop" ) |
800 | rvPadTop = attribs.get<double>( "value" ); |
801 | else if( name == "rlMinPadTop" ) |
802 | - rlMinPadTop = parseEagle( attribs.get<string>( "value" ) ); |
803 | + rlMinPadTop = parseEagle( attribs.get<std::string>( "value" ) ); |
804 | else if( name == "rlMaxPadTop" ) |
805 | - rlMaxPadTop = parseEagle( attribs.get<string>( "value" ) ); |
806 | + rlMaxPadTop = parseEagle( attribs.get<std::string>( "value" ) ); |
807 | |
808 | else if( name == "rvViaOuter" ) |
809 | rvViaOuter = attribs.get<double>( "value" ); |
810 | else if( name == "rlMinViaOuter" ) |
811 | - rlMinViaOuter = parseEagle( attribs.get<string>( "value" ) ); |
812 | + rlMinViaOuter = parseEagle( attribs.get<std::string>( "value" ) ); |
813 | else if( name == "rlMaxViaOuter" ) |
814 | - rlMaxViaOuter = parseEagle( attribs.get<string>( "value" ) ); |
815 | + rlMaxViaOuter = parseEagle( attribs.get<std::string>( "value" ) ); |
816 | else if( name == "mdWireWire" ) |
817 | - mdWireWire = parseEagle( attribs.get<string>( "value" ) ); |
818 | + mdWireWire = parseEagle( attribs.get<std::string>( "value" ) ); |
819 | } |
820 | } |
821 | |
822 | |
823 | /// Assemble a two part key as a simple concatonation of aFirst and aSecond parts, |
824 | /// using a separator. |
825 | -static inline string makeKey( const string& aFirst, const string& aSecond ) |
826 | +static inline std::string makeKey( const std::string& aFirst, |
827 | + const std::string& aSecond ) |
828 | { |
829 | - string key = aFirst + '\x02' + aSecond; |
830 | - return key; |
831 | + return (aFirst + '\x02' + aSecond); |
832 | } |
833 | |
834 | |
835 | @@ -1119,14 +1118,14 @@ |
836 | m_board->SetFileName( aFileName ); |
837 | |
838 | // delete on exception, iff I own m_board, according to aAppendToMe |
839 | - auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board ); |
840 | + std::auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board ); |
841 | |
842 | try |
843 | { |
844 | // 8 bit "filename" should be encoded according to disk filename encoding, |
845 | // (maybe this is current locale, maybe not, its a filesystem issue), |
846 | // and is not necessarily utf8. |
847 | - string filename = (const char*) aFileName.char_str( wxConvFile ); |
848 | + std::string filename = (const char*) aFileName.char_str( wxConvFile ); |
849 | |
850 | read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); |
851 | |
852 | @@ -1171,7 +1170,7 @@ |
853 | // so one catch should be OK for all errors. |
854 | catch( ptree_error pte ) |
855 | { |
856 | - string errmsg = pte.what(); |
857 | + std::string errmsg = pte.what(); |
858 | |
859 | errmsg += " @\n"; |
860 | errmsg += m_xpath->Contents(); |
861 | @@ -1571,7 +1570,7 @@ |
862 | } |
863 | |
864 | |
865 | -void EAGLE_PLUGIN::loadLibrary( CPTREE& aLib, const string* aLibName ) |
866 | +void EAGLE_PLUGIN::loadLibrary( CPTREE& aLib, const std::string* aLibName ) |
867 | { |
868 | m_xpath->push( "packages" ); |
869 | |
870 | @@ -1586,9 +1585,9 @@ |
871 | { |
872 | m_xpath->push( "package", "name" ); |
873 | |
874 | - const string& pack_ref = package->second.get<string>( "<xmlattr>.name" ); |
875 | + const std::string& pack_ref = package->second.get<std::string>( "<xmlattr>.name" ); |
876 | |
877 | - string pack_name( pack_ref ); |
878 | + std::string pack_name( pack_ref ); |
879 | |
880 | ReplaceIllegalFileNameChars( &pack_name ); |
881 | |
882 | @@ -1601,7 +1600,7 @@ |
883 | #endif |
884 | m_xpath->Value( pack_name.c_str() ); |
885 | |
886 | - string key = aLibName ? makeKey( *aLibName, pack_name ) : pack_name; |
887 | + std::string key = aLibName ? makeKey( *aLibName, pack_name ) : pack_name; |
888 | |
889 | MODULE* m = makeModule( package->second, pack_name ); |
890 | |
891 | @@ -1636,7 +1635,7 @@ |
892 | |
893 | for( CITER library = aLibs.begin(); library != aLibs.end(); ++library ) |
894 | { |
895 | - const string& lib_name = library->second.get<string>( "<xmlattr>.name" ); |
896 | + const std::string& lib_name = library->second.get<std::string>( "<xmlattr>.name" ); |
897 | |
898 | m_xpath->Value( lib_name.c_str() ); |
899 | |
900 | @@ -1667,7 +1666,7 @@ |
901 | |
902 | m_xpath->Value( e.name.c_str() ); |
903 | |
904 | - string key = makeKey( e.library, e.package ); |
905 | + std::string key = makeKey( e.library, e.package ); |
906 | |
907 | MODULE_CITER mi = m_templates.find( key ); |
908 | |
909 | @@ -1693,7 +1692,7 @@ |
910 | // update the nets within the pads of the clone |
911 | for( D_PAD* pad = m->Pads(); pad; pad = pad->Next() ) |
912 | { |
913 | - string key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); |
914 | + std::string key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); |
915 | |
916 | NET_MAP_CITER ni = m_pads_to_nets.find( key ); |
917 | if( ni != m_pads_to_nets.end() ) |
918 | @@ -1881,13 +1880,13 @@ |
919 | } |
920 | |
921 | |
922 | -MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const string& aPkgName ) const |
923 | +MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const |
924 | { |
925 | std::auto_ptr<MODULE> m( new MODULE( NULL ) ); |
926 | |
927 | m->SetFPID( FPID( aPkgName ) ); |
928 | |
929 | - opt_string description = aPackage.get_optional<string>( "description" ); |
930 | + opt_string description = aPackage.get_optional<std::string>( "description" ); |
931 | if( description ) |
932 | m->SetDescription( FROM_UTF8( description->c_str() ) ); |
933 | |
934 | @@ -2354,7 +2353,7 @@ |
935 | |
936 | zones.clear(); |
937 | |
938 | - const string& nname = net->second.get<string>( "<xmlattr>.name" ); |
939 | + const std::string& nname = net->second.get<std::string>( "<xmlattr>.name" ); |
940 | wxString netName = FROM_UTF8( nname.c_str() ); |
941 | |
942 | m_xpath->Value( nname.c_str() ); |
943 | @@ -2469,10 +2468,10 @@ |
944 | // <contactref element="RN1" pad="7"/> |
945 | CPTREE& attribs = it->second.get_child( "<xmlattr>" ); |
946 | |
947 | - const string& reference = attribs.get<string>( "element" ); |
948 | - const string& pad = attribs.get<string>( "pad" ); |
949 | + const std::string& reference = attribs.get<std::string>( "element" ); |
950 | + const std::string& pad = attribs.get<std::string>( "pad" ); |
951 | |
952 | - string key = makeKey( reference, pad ) ; |
953 | + std::string key = makeKey( reference, pad ) ; |
954 | |
955 | // D(printf( "adding refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", reference.c_str(), pad.c_str(), netCode, nname.c_str() );) |
956 | |
957 | @@ -2714,8 +2713,8 @@ |
958 | { |
959 | if( m_props ) |
960 | { |
961 | - string page_width; |
962 | - string page_height; |
963 | + std::string page_width; |
964 | + std::string page_height; |
965 | |
966 | if( m_props->Value( "page_width", &page_width ) && |
967 | m_props->Value( "page_height", &page_height ) ) |
968 | @@ -2785,7 +2784,7 @@ |
969 | // 8 bit "filename" should be encoded according to disk filename encoding, |
970 | // (maybe this is current locale, maybe not, its a filesystem issue), |
971 | // and is not necessarily utf8. |
972 | - string filename = (const char*) aLibPath.char_str( wxConvFile ); |
973 | + std::string filename = (const char*) aLibPath.char_str( wxConvFile ); |
974 | |
975 | read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); |
976 | |
977 | @@ -2816,7 +2815,7 @@ |
978 | // so one catch should be OK for all errors. |
979 | catch( ptree_error pte ) |
980 | { |
981 | - string errmsg = pte.what(); |
982 | + std::string errmsg = pte.what(); |
983 | |
984 | errmsg += " @\n"; |
985 | errmsg += m_xpath->Contents(); |
986 | @@ -2847,7 +2846,7 @@ |
987 | |
988 | cacheLib( aLibraryPath ); |
989 | |
990 | - string key = TO_UTF8( aFootprintName ); |
991 | + std::string key = TO_UTF8( aFootprintName ); |
992 | |
993 | MODULE_CITER mi = m_templates.find( key ); |
994 | |
995 | |
996 | === modified file 'pcbnew/github/github_plugin.cpp' |
997 | --- pcbnew/github/github_plugin.cpp 2013-12-03 18:37:21 +0000 |
998 | +++ pcbnew/github/github_plugin.cpp 2013-12-04 08:51:30 +0000 |
999 | @@ -63,15 +63,12 @@ |
1000 | #include <macros.h> |
1001 | #include <fp_lib_table.h> // ExpandSubstitutions() |
1002 | |
1003 | -using namespace std; |
1004 | - |
1005 | - |
1006 | static const char* PRETTY_DIR = "allow_pretty_writing_to_this_dir"; |
1007 | |
1008 | |
1009 | -typedef boost::ptr_map<string, wxZipEntry> MODULE_MAP; |
1010 | -typedef MODULE_MAP::iterator MODULE_ITER; |
1011 | -typedef MODULE_MAP::const_iterator MODULE_CITER; |
1012 | +typedef boost::ptr_map<std::string, wxZipEntry> MODULE_MAP; |
1013 | +typedef MODULE_MAP::iterator MODULE_ITER; |
1014 | +typedef MODULE_MAP::const_iterator MODULE_CITER; |
1015 | |
1016 | |
1017 | /** |
1018 | @@ -166,7 +163,7 @@ |
1019 | } |
1020 | } |
1021 | |
1022 | - string fp_name = TO_UTF8( aFootprintName ); |
1023 | + std::string fp_name = TO_UTF8( aFootprintName ); |
1024 | |
1025 | MODULE_CITER it = m_gh_cache->find( fp_name ); |
1026 | |
1027 | @@ -233,7 +230,7 @@ |
1028 | // IsFootprintLibWritable() to determine if calling FootprintSave() is |
1029 | // even legal, so I spend no time on internationalization here: |
1030 | |
1031 | - string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", |
1032 | + std::string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", |
1033 | (const char*) TO_UTF8( aLibraryPath ), PRETTY_DIR ); |
1034 | |
1035 | THROW_IO_ERROR( msg ); |
1036 | @@ -275,7 +272,7 @@ |
1037 | // IsFootprintLibWritable() to determine if calling FootprintSave() is |
1038 | // even legal, so I spend no time on internationalization here: |
1039 | |
1040 | - string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", |
1041 | + std::string msg = StrPrintf( "Github library\n'%s'\nis only writable if you set option '%s' in Library Tables dialog.", |
1042 | (const char*) TO_UTF8( aLibraryPath ), PRETTY_DIR ); |
1043 | |
1044 | THROW_IO_ERROR( msg ); |
1045 | @@ -356,7 +353,7 @@ |
1046 | |
1047 | if( aProperties ) |
1048 | { |
1049 | - string pretty_dir; |
1050 | + std::string pretty_dir; |
1051 | |
1052 | if( aProperties->Value( PRETTY_DIR, &pretty_dir ) ) |
1053 | { |
1054 | @@ -409,7 +406,7 @@ |
1055 | |
1056 | if( fn.GetExt() == kicad_mod ) |
1057 | { |
1058 | - string fp_name = TO_UTF8( fn.GetName() ); // omit extension & path |
1059 | + std::string fp_name = TO_UTF8( fn.GetName() ); // omit extension & path |
1060 | |
1061 | m_gh_cache->insert( fp_name, entry ); |
1062 | } |
1063 | @@ -420,7 +417,7 @@ |
1064 | } |
1065 | |
1066 | |
1067 | -bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, string* aZipURL ) |
1068 | +bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL ) |
1069 | { |
1070 | // e.g. "https://github.com/liftoff-sr/pretty_footprints" |
1071 | //D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );) |
1072 | @@ -460,7 +457,7 @@ |
1073 | |
1074 | void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR ) |
1075 | { |
1076 | - string zip_url; |
1077 | + std::string zip_url; |
1078 | |
1079 | if( !repoURL_zipURL( aRepoURL, &zip_url ) ) |
1080 | { |
1081 | @@ -478,7 +475,7 @@ |
1082 | |
1083 | try |
1084 | { |
1085 | - ostringstream os; |
1086 | + std::ostringstream os; |
1087 | |
1088 | h.open( zip_url ); // only one file, therefore do it synchronously. |
1089 | os << &h; |
1090 | @@ -495,10 +492,8 @@ |
1091 | // https "GET" has faild, report this to API caller. |
1092 | wxString fmt( _( "Cannot GET zip: '%s'\nfor lib-path: '%s'.\nWhat: '%s'" ) ); |
1093 | |
1094 | - string msg = StrPrintf( TO_UTF8( fmt ), |
1095 | - zip_url.c_str(), |
1096 | - TO_UTF8( aRepoURL ), |
1097 | - e.what() ); |
1098 | + std::string msg = StrPrintf( TO_UTF8( fmt ), zip_url.c_str(), |
1099 | + TO_UTF8( aRepoURL ), e.what() ); |
1100 | |
1101 | THROW_IO_ERROR( msg ); |
1102 | } |
1103 | |
1104 | === modified file 'pcbnew/gpcb_plugin.cpp' |
1105 | --- pcbnew/gpcb_plugin.cpp 2013-09-25 19:17:06 +0000 |
1106 | +++ pcbnew/gpcb_plugin.cpp 2013-12-04 08:51:30 +0000 |
1107 | @@ -48,9 +48,6 @@ |
1108 | #include <boost/ptr_container/ptr_map.hpp> |
1109 | #include <memory.h> |
1110 | |
1111 | -using namespace std; |
1112 | - |
1113 | - |
1114 | /** |
1115 | * Definition for enabling and disabling footprint library trace output. See the |
1116 | * wxWidgets documentation on using the WXTRACE environment variable. |
1117 | @@ -118,7 +115,7 @@ |
1118 | wxFileName m_file_name; ///< The the full file name and path of the footprint to cache. |
1119 | bool m_writable; ///< Writability status of the footprint file. |
1120 | wxDateTime m_mod_time; ///< The last file modified time stamp. |
1121 | - auto_ptr< MODULE > m_module; |
1122 | + std::auto_ptr<MODULE> m_module; |
1123 | |
1124 | public: |
1125 | GPCB_FPL_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); |
1126 | @@ -327,13 +324,13 @@ |
1127 | // Old version unit = 1 mil, so conv_unit is 10 or 0.1 |
1128 | #define NEW_GPCB_UNIT_CONV ( 0.01*IU_PER_MILS ) |
1129 | |
1130 | - int paramCnt; |
1131 | - double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 |
1132 | - wxPoint refPos( 0, 0 ); |
1133 | - wxPoint textPos; |
1134 | - wxString msg; |
1135 | - wxArrayString parameters; |
1136 | - auto_ptr< MODULE > module( new MODULE( NULL ) ); |
1137 | + int paramCnt; |
1138 | + double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 |
1139 | + wxPoint refPos( 0, 0 ); |
1140 | + wxPoint textPos; |
1141 | + wxString msg; |
1142 | + wxArrayString parameters; |
1143 | + std::auto_ptr<MODULE> module( new MODULE( NULL ) ); |
1144 | |
1145 | |
1146 | if( aLineReader->ReadLine() == NULL ) |
1147 | |
1148 | === modified file 'pcbnew/kicad_plugin.cpp' |
1149 | --- pcbnew/kicad_plugin.cpp 2013-11-28 16:40:23 +0000 |
1150 | +++ pcbnew/kicad_plugin.cpp 2013-12-04 08:51:30 +0000 |
1151 | @@ -52,9 +52,6 @@ |
1152 | #include <boost/ptr_container/ptr_map.hpp> |
1153 | #include <memory.h> |
1154 | |
1155 | -using namespace std; |
1156 | - |
1157 | - |
1158 | #define FMTIU BOARD_ITEM::FormatInternalUnits |
1159 | |
1160 | /** |
1161 | @@ -78,7 +75,7 @@ |
1162 | wxFileName m_file_name; ///< The the full file name and path of the footprint to cache. |
1163 | bool m_writable; ///< Writability status of the footprint file. |
1164 | wxDateTime m_mod_time; ///< The last file modified time stamp. |
1165 | - auto_ptr< MODULE > m_module; |
1166 | + std::auto_ptr<MODULE> m_module; |
1167 | |
1168 | public: |
1169 | FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); |
1170 | |
1171 | === modified file 'pcbnew/legacy_plugin.cpp' |
1172 | --- pcbnew/legacy_plugin.cpp 2013-11-29 18:29:41 +0000 |
1173 | +++ pcbnew/legacy_plugin.cpp 2013-12-04 08:51:30 +0000 |
1174 | @@ -147,9 +147,6 @@ |
1175 | #endif |
1176 | |
1177 | |
1178 | -using namespace std; // auto_ptr |
1179 | - |
1180 | - |
1181 | static inline const char* ShowVertJustify( EDA_TEXT_VJUSTIFY_T vertical ) |
1182 | { |
1183 | const char* rs; |
1184 | @@ -244,9 +241,9 @@ |
1185 | m_board->SetFileName( aFileName ); |
1186 | |
1187 | // delete on exception, iff I own m_board, according to aAppendToMe |
1188 | - auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board ); |
1189 | + std::auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board ); |
1190 | |
1191 | - FILE_LINE_READER reader( aFileName ); |
1192 | + FILE_LINE_READER reader( aFileName ); |
1193 | |
1194 | m_reader = &reader; // member function accessibility |
1195 | |
1196 | @@ -276,7 +273,7 @@ |
1197 | |
1198 | if( TESTLINE( "$MODULE" ) ) |
1199 | { |
1200 | - auto_ptr<MODULE> module( new MODULE( m_board ) ); |
1201 | + std::auto_ptr<MODULE> module( new MODULE( m_board ) ); |
1202 | |
1203 | FPID fpid; |
1204 | std::string fpName = StrPurge( line + SZ( "$MODULE" ) ); |
1205 | @@ -1149,7 +1146,7 @@ |
1206 | |
1207 | void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) |
1208 | { |
1209 | - auto_ptr<D_PAD> pad( new D_PAD( aModule ) ); |
1210 | + std::auto_ptr<D_PAD> pad( new D_PAD( aModule ) ); |
1211 | char* line; |
1212 | |
1213 | while( ( line = READLINE( m_reader ) ) != NULL ) |
1214 | @@ -1401,7 +1398,7 @@ |
1215 | THROW_IO_ERROR( m_error ); |
1216 | } |
1217 | |
1218 | - auto_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing |
1219 | + std::auto_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing |
1220 | |
1221 | const char* data; |
1222 | |
1223 | @@ -1696,8 +1693,8 @@ |
1224 | $EndDRAWSEGMENT |
1225 | */ |
1226 | |
1227 | - auto_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) ); |
1228 | - char* line; |
1229 | + std::auto_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) ); |
1230 | + char* line; |
1231 | |
1232 | while( ( line = READLINE( m_reader ) ) != NULL ) |
1233 | { |
1234 | @@ -2095,7 +2092,7 @@ |
1235 | // yet since that would bypass duplicate netclass name checking within the BOARD. |
1236 | // store it temporarily in an auto_ptr until successfully inserted into the BOARD |
1237 | // just before returning. |
1238 | - auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) ); |
1239 | + std::auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) ); |
1240 | |
1241 | while( ( line = READLINE( m_reader ) ) != NULL ) |
1242 | { |
1243 | @@ -2182,7 +2179,7 @@ |
1244 | |
1245 | void LEGACY_PLUGIN::loadZONE_CONTAINER() |
1246 | { |
1247 | - auto_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) ); |
1248 | + std::auto_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) ); |
1249 | |
1250 | CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::NO_HATCH; |
1251 | bool sawCorner = false; |
1252 | @@ -2446,8 +2443,8 @@ |
1253 | |
1254 | void LEGACY_PLUGIN::loadDIMENSION() |
1255 | { |
1256 | - auto_ptr<DIMENSION> dim( new DIMENSION( m_board ) ); |
1257 | - char* line; |
1258 | + std::auto_ptr<DIMENSION> dim( new DIMENSION( m_board ) ); |
1259 | + char* line; |
1260 | |
1261 | while( ( line = READLINE( m_reader ) ) != NULL ) |
1262 | { |
1263 | @@ -4031,9 +4028,9 @@ |
1264 | // test first for the $MODULE, even before reading because of INDEX bug. |
1265 | if( TESTLINE( "$MODULE" ) ) |
1266 | { |
1267 | - auto_ptr<MODULE> module( new MODULE( m_owner->m_board ) ); |
1268 | + std::auto_ptr<MODULE> module( new MODULE( m_owner->m_board ) ); |
1269 | |
1270 | - std::string footprintName = StrPurge( line + SZ( "$MODULE" ) ); |
1271 | + std::string footprintName = StrPurge( line + SZ( "$MODULE" ) ); |
1272 | |
1273 | // The footprint names in legacy libraries can contain the '/' and ':' |
1274 | // characters which will cause the FPID parser to choke. |
1275 | |
1276 | === modified file 'pcbnew/pcb_parser.cpp' |
1277 | --- pcbnew/pcb_parser.cpp 2013-09-24 18:45:57 +0000 |
1278 | +++ pcbnew/pcb_parser.cpp 2013-12-04 08:51:30 +0000 |
1279 | @@ -51,9 +51,6 @@ |
1280 | #include <pcb_parser.h> |
1281 | |
1282 | |
1283 | -using namespace std; |
1284 | - |
1285 | - |
1286 | void PCB_PARSER::init() |
1287 | { |
1288 | m_layerIndices.clear(); |
1289 | @@ -263,7 +260,7 @@ |
1290 | |
1291 | T token; |
1292 | |
1293 | - auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); |
1294 | + std::auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) ); |
1295 | |
1296 | NeedSYMBOLorNUMBER(); |
1297 | n3D->m_Shape3DName = FromUTF8(); |
1298 | @@ -1084,7 +1081,7 @@ |
1299 | |
1300 | T token; |
1301 | |
1302 | - auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) ); |
1303 | + std::auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) ); |
1304 | |
1305 | // Read netclass name (can be a name or just a number like track width) |
1306 | NeedSYMBOLorNUMBER(); |
1307 | @@ -1164,7 +1161,7 @@ |
1308 | |
1309 | T token; |
1310 | wxPoint pt; |
1311 | - auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); |
1312 | + std::auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) ); |
1313 | |
1314 | switch( CurTok() ) |
1315 | { |
1316 | @@ -1325,7 +1322,7 @@ |
1317 | |
1318 | T token; |
1319 | |
1320 | - auto_ptr< TEXTE_PCB > text( new TEXTE_PCB( m_board ) ); |
1321 | + std::auto_ptr<TEXTE_PCB> text( new TEXTE_PCB( m_board ) ); |
1322 | NeedSYMBOLorNUMBER(); |
1323 | |
1324 | text->SetText( FromUTF8() ); |
1325 | @@ -1393,7 +1390,7 @@ |
1326 | |
1327 | T token; |
1328 | |
1329 | - auto_ptr< DIMENSION > dimension( new DIMENSION( NULL ) ); |
1330 | + std::auto_ptr<DIMENSION> dimension( new DIMENSION( NULL ) ); |
1331 | |
1332 | dimension->SetValue( parseBoardUnits( "dimension value" ) ); |
1333 | NeedLEFT(); |
1334 | @@ -1545,7 +1542,7 @@ |
1335 | T token; |
1336 | FPID fpid; |
1337 | |
1338 | - auto_ptr< MODULE > module( new MODULE( m_board ) ); |
1339 | + std::auto_ptr<MODULE> module( new MODULE( m_board ) ); |
1340 | |
1341 | module->SetInitialComments( aInitialComments ); |
1342 | |
1343 | @@ -1773,7 +1770,7 @@ |
1344 | |
1345 | T token = NextTok(); |
1346 | |
1347 | - auto_ptr< TEXTE_MODULE > text( new TEXTE_MODULE( NULL ) ); |
1348 | + std::auto_ptr<TEXTE_MODULE> text( new TEXTE_MODULE( NULL ) ); |
1349 | |
1350 | switch( token ) |
1351 | { |
1352 | @@ -1858,7 +1855,7 @@ |
1353 | wxPoint pt; |
1354 | T token; |
1355 | |
1356 | - auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); |
1357 | + std::auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) ); |
1358 | |
1359 | switch( CurTok() ) |
1360 | { |
1361 | @@ -2023,7 +2020,7 @@ |
1362 | |
1363 | wxSize sz; |
1364 | wxPoint pt; |
1365 | - auto_ptr< D_PAD > pad( new D_PAD( NULL ) ); |
1366 | + std::auto_ptr< D_PAD > pad( new D_PAD( NULL ) ); |
1367 | |
1368 | NeedSYMBOLorNUMBER(); |
1369 | pad->SetPadName( FromUTF8() ); |
1370 | @@ -2260,7 +2257,7 @@ |
1371 | wxPoint pt; |
1372 | T token; |
1373 | |
1374 | - auto_ptr< TRACK > track( new TRACK( m_board ) ); |
1375 | + std::auto_ptr< TRACK > track( new TRACK( m_board ) ); |
1376 | |
1377 | for( token = NextTok(); token != T_RIGHT; token = NextTok() ) |
1378 | { |
1379 | @@ -2322,7 +2319,7 @@ |
1380 | wxPoint pt; |
1381 | T token; |
1382 | |
1383 | - auto_ptr< SEGVIA > via( new SEGVIA( m_board ) ); |
1384 | + std::auto_ptr< SEGVIA > via( new SEGVIA( m_board ) ); |
1385 | |
1386 | for( token = NextTok(); token != T_RIGHT; token = NextTok() ) |
1387 | { |
1388 | @@ -2407,7 +2404,7 @@ |
1389 | // bigger scope since each filled_polygon is concatenated in here |
1390 | CPOLYGONS_LIST pts; |
1391 | |
1392 | - auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); |
1393 | + std::auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) ); |
1394 | |
1395 | zone->SetPriority( 0 ); |
1396 | |
1397 | @@ -2721,8 +2718,7 @@ |
1398 | wxPoint pt; |
1399 | T token; |
1400 | |
1401 | - auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); |
1402 | - |
1403 | + std::auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) ); |
1404 | |
1405 | for( token = NextTok(); token != T_RIGHT; token = NextTok() ) |
1406 | { |
1407 | |
1408 | === modified file 'pcbnew/router/pns_line.cpp' |
1409 | --- pcbnew/router/pns_line.cpp 2013-10-14 18:40:36 +0000 |
1410 | +++ pcbnew/router/pns_line.cpp 2013-12-04 08:51:30 +0000 |
1411 | @@ -29,7 +29,6 @@ |
1412 | #include "pns_utils.h" |
1413 | #include "pns_router.h" |
1414 | |
1415 | -using namespace std; |
1416 | using boost::optional; |
1417 | |
1418 | PNS_LINE* PNS_LINE::Clone() const |
1419 | @@ -321,10 +320,10 @@ |
1420 | |
1421 | SHAPE_LINE_CHAIN l_orig( m_line ); |
1422 | SHAPE_LINE_CHAIN l_hull; |
1423 | - vector<bool> outside, on_edge, inside; |
1424 | + std::vector<bool> outside, on_edge, inside; |
1425 | SHAPE_LINE_CHAIN path; |
1426 | |
1427 | - vector<INTERSECTION> isects; |
1428 | + std::vector<INTERSECTION> isects; |
1429 | |
1430 | // don't calculate walkaround for empty lines |
1431 | if( m_line.PointCount() < 2 ) |
1432 | |
1433 | === modified file 'pcbnew/router/pns_line_placer.cpp' |
1434 | --- pcbnew/router/pns_line_placer.cpp 2013-10-14 18:40:36 +0000 |
1435 | +++ pcbnew/router/pns_line_placer.cpp 2013-12-04 08:51:30 +0000 |
1436 | @@ -18,7 +18,6 @@ |
1437 | * with this program. If not, see <http://www.gnu.or/licenses/>. |
1438 | */ |
1439 | |
1440 | -#include <vector> |
1441 | #include <boost/foreach.hpp> |
1442 | #include <boost/optional.hpp> |
1443 | |
1444 | @@ -30,7 +29,6 @@ |
1445 | #include "pns_shove.h" |
1446 | #include "pns_utils.h" |
1447 | |
1448 | -using namespace std; |
1449 | using boost::optional; |
1450 | |
1451 | PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_NODE* aWorld ) |
1452 | @@ -528,7 +526,7 @@ |
1453 | |
1454 | const int TailLookbackSegments = 5; |
1455 | |
1456 | - int threshold = min( tail.PointCount(), TailLookbackSegments + 1 ); |
1457 | + int threshold = std::min( tail.PointCount(), TailLookbackSegments + 1 ); |
1458 | |
1459 | if( tail.SegmentCount() < 3 ) |
1460 | return false; |
1461 | |
1462 | === modified file 'pcbnew/router/pns_node.cpp' |
1463 | --- pcbnew/router/pns_node.cpp 2013-10-14 18:40:36 +0000 |
1464 | +++ pcbnew/router/pns_node.cpp 2013-12-04 08:51:30 +0000 |
1465 | @@ -37,8 +37,6 @@ |
1466 | #include "pns_joint.h" |
1467 | #include "pns_index.h" |
1468 | |
1469 | -using namespace std; |
1470 | - |
1471 | using boost::unordered_set; |
1472 | using boost::unordered_map; |
1473 | |
1474 | @@ -138,7 +136,7 @@ |
1475 | if( isRoot() ) |
1476 | return; |
1477 | |
1478 | - for( vector<PNS_NODE*>::iterator i = m_parent->m_children.begin(); |
1479 | + for( std::vector<PNS_NODE*>::iterator i = m_parent->m_children.begin(); |
1480 | i != m_parent->m_children.end(); ++i ) |
1481 | { |
1482 | if( *i == this ) |
1483 | @@ -284,7 +282,7 @@ |
1484 | VECTOR2I ip_first, ip_last; |
1485 | int dist_max = INT_MIN; |
1486 | |
1487 | - vector<SHAPE_LINE_CHAIN::INTERSECTION> isect_list; |
1488 | + std::vector<SHAPE_LINE_CHAIN::INTERSECTION> isect_list; |
1489 | |
1490 | int clearance = GetClearance( obs.item, &aLine ); |
1491 | |
1492 | @@ -564,7 +562,7 @@ |
1493 | |
1494 | void PNS_NODE::removeLine( PNS_LINE* aLine ) |
1495 | { |
1496 | - vector<PNS_SEGMENT*>* segRefs = aLine->GetLinkedSegments(); |
1497 | + std::vector<PNS_SEGMENT*>* segRefs = aLine->GetLinkedSegments(); |
1498 | |
1499 | if( !segRefs ) |
1500 | return; |
1501 | @@ -700,7 +698,7 @@ |
1502 | } |
1503 | |
1504 | |
1505 | -int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& a, PNS_JOINT& b, vector<PNS_LINE*>& aLines ) |
1506 | +int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& a, PNS_JOINT& b, std::vector<PNS_LINE*>& aLines ) |
1507 | { |
1508 | BOOST_FOREACH( PNS_ITEM* item, a.GetLinkList() ) |
1509 | { |
1510 | @@ -763,7 +761,7 @@ |
1511 | // try to find the joint in this node. |
1512 | JointMap::iterator f = m_joints.find( tag ); |
1513 | |
1514 | - pair<JointMap::iterator, JointMap::iterator> range; |
1515 | + std::pair<JointMap::iterator, JointMap::iterator> range; |
1516 | |
1517 | // not found and we are not root? find in the root and copy results here. |
1518 | if( f == m_joints.end() && !isRoot() ) |
1519 | @@ -895,7 +893,7 @@ |
1520 | printf( "Line: %s, net %d ", l->GetLine().Format().c_str(), l->GetNet() ); |
1521 | |
1522 | |
1523 | - for( vector<PNS_SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) |
1524 | + for( std::vector<PNS_SEGMENT*>::iterator j = seg_refs->begin(); j != seg_refs->end(); ++j ) |
1525 | { |
1526 | printf( "%s ", (*j)->GetSeg().A.Format().c_str() ); |
1527 | |
1528 | @@ -932,7 +930,7 @@ |
1529 | void PNS_NODE::releaseChildren() |
1530 | { |
1531 | // copy the kids as the PNS_NODE destructor erases the item from the parent node. |
1532 | - vector<PNS_NODE*> kids = m_children; |
1533 | + std::vector<PNS_NODE*> kids = m_children; |
1534 | |
1535 | BOOST_FOREACH( PNS_NODE * node, kids ) { |
1536 | node->releaseChildren(); |
1537 | |
1538 | === modified file 'pcbnew/router/pns_optimizer.cpp' |
1539 | --- pcbnew/router/pns_optimizer.cpp 2013-10-14 18:40:36 +0000 |
1540 | +++ pcbnew/router/pns_optimizer.cpp 2013-12-04 08:51:30 +0000 |
1541 | @@ -28,8 +28,6 @@ |
1542 | #include "pns_optimizer.h" |
1543 | #include "pns_utils.h" |
1544 | |
1545 | -using namespace std; |
1546 | - |
1547 | /** |
1548 | * |
1549 | * Cost Estimator Methods |
1550 | @@ -620,8 +618,8 @@ |
1551 | const int ForbiddenAngles = DIRECTION_45::ANG_ACUTE | DIRECTION_45::ANG_RIGHT | |
1552 | DIRECTION_45::ANG_HALF_FULL | DIRECTION_45::ANG_UNDEFINED; |
1553 | |
1554 | - typedef pair<int, SHAPE_LINE_CHAIN> RtVariant; |
1555 | - vector<RtVariant> variants; |
1556 | + typedef std::pair<int, SHAPE_LINE_CHAIN> RtVariant; |
1557 | + std::vector<RtVariant> variants; |
1558 | |
1559 | BreakoutList breakouts = computeBreakouts( aLine->GetWidth(), aPad, true ); |
1560 | |
1561 | @@ -629,7 +627,7 @@ |
1562 | |
1563 | // bool startDiagonal = DIRECTION_45( line.CSegment(0) ).IsDiagonal(); |
1564 | |
1565 | - int p_end = min( aEndVertex, min( 3, line.PointCount() - 1 ) ); |
1566 | + int p_end = std::min( aEndVertex, std::min( 3, line.PointCount() - 1 ) ); |
1567 | |
1568 | for( int p = 1; p <= p_end; p++ ) |
1569 | { |
1570 | |
1571 | === modified file 'pcbnew/router/pns_router.cpp' |
1572 | --- pcbnew/router/pns_router.cpp 2013-10-14 18:40:36 +0000 |
1573 | +++ pcbnew/router/pns_router.cpp 2013-12-04 08:51:30 +0000 |
1574 | @@ -51,8 +51,6 @@ |
1575 | #include <class_track.h> |
1576 | #include <layers_id_colors_and_visibility.h> |
1577 | |
1578 | -using namespace std; |
1579 | - |
1580 | // an ugly singleton for drawing debug items within the router context. |
1581 | // To be fixed sometime in the future. |
1582 | static PNS_ROUTER* theRouter; |
1583 | @@ -89,7 +87,7 @@ |
1584 | } |
1585 | |
1586 | private: |
1587 | - vector<int> m_clearanceCache; |
1588 | + std::vector<int> m_clearanceCache; |
1589 | int m_defaultClearance; |
1590 | }; |
1591 | |
1592 | @@ -232,7 +230,7 @@ |
1593 | |
1594 | void PNS_ROUTER::SyncWorld() |
1595 | { |
1596 | - vector<D_PAD*> pads; |
1597 | + std::vector<D_PAD*> pads; |
1598 | |
1599 | if( !m_board ) |
1600 | { |
1601 | @@ -662,7 +660,7 @@ |
1602 | PNS_NODE* cleaned = aNode->Branch(); |
1603 | PNS_JOINT a, b; |
1604 | |
1605 | - vector<PNS_LINE*> lines; |
1606 | + std::vector<PNS_LINE*> lines; |
1607 | |
1608 | cleaned->FindLineEnds( ourLine, a, b ); |
1609 | cleaned->FindLinesBetweenJoints( a, b, lines ); |
1610 | @@ -699,7 +697,7 @@ |
1611 | if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->GetNet() ) |
1612 | real_end = true; |
1613 | |
1614 | - int last = ( real_end || m_placingVia ) ? l.SegmentCount() : max( 1, l.SegmentCount() - 1 ); |
1615 | + int last = ( real_end || m_placingVia ) ? l.SegmentCount() : std::max( 1, l.SegmentCount() - 1 ); |
1616 | |
1617 | PNS_NODE* latest = m_placer->GetCurrentNode(); |
1618 | |
1619 | @@ -771,7 +769,7 @@ |
1620 | if( m_placer->GetTail().GetCLine().SegmentCount() == 0 ) |
1621 | { |
1622 | m_start_diagonal = !m_start_diagonal; |
1623 | - m_placer->SetInitialDirection( m_start_diagonal ? |
1624 | + m_placer->SetInitialDirection( m_start_diagonal ? |
1625 | DIRECTION_45( DIRECTION_45::NE ) : DIRECTION_45( DIRECTION_45::N ) ); |
1626 | } |
1627 | else |
1628 | |
1629 | === modified file 'pcbnew/router/pns_shove.cpp' |
1630 | --- pcbnew/router/pns_shove.cpp 2013-11-27 08:46:59 +0000 |
1631 | +++ pcbnew/router/pns_shove.cpp 2013-12-04 08:51:30 +0000 |
1632 | @@ -35,8 +35,6 @@ |
1633 | |
1634 | #include <profile.h> |
1635 | |
1636 | -using namespace std; |
1637 | - |
1638 | PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld ) |
1639 | { |
1640 | m_root = aWorld; |
1641 | @@ -280,9 +278,9 @@ |
1642 | |
1643 | PNS_SHOVE::ShoveStatus PNS_SHOVE::ShoveLines( PNS_LINE* aCurrentHead ) |
1644 | { |
1645 | - stack <PNS_LINE*> lineStack; |
1646 | + std::stack<PNS_LINE*> lineStack; |
1647 | PNS_NODE* node, * parent; |
1648 | - PNS_VIA* headVia = NULL; |
1649 | + PNS_VIA* headVia = NULL; |
1650 | bool fail = false; |
1651 | int iter = 0; |
1652 | |
1653 | |
1654 | === modified file 'pcbnew/router/pns_walkaround.cpp' |
1655 | --- pcbnew/router/pns_walkaround.cpp 2013-10-14 18:40:36 +0000 |
1656 | +++ pcbnew/router/pns_walkaround.cpp 2013-12-04 08:51:30 +0000 |
1657 | @@ -18,8 +18,6 @@ |
1658 | * with this program. If not, see <http://www.gnu.or/licenses/>. |
1659 | */ |
1660 | |
1661 | -#include <vector> |
1662 | - |
1663 | #include <boost/foreach.hpp> |
1664 | #include <boost/optional.hpp> |
1665 | |
1666 | @@ -29,8 +27,6 @@ |
1667 | #include "pns_optimizer.h" |
1668 | #include "pns_utils.h" |
1669 | #include "pns_router.h" |
1670 | - |
1671 | -using namespace std; |
1672 | using boost::optional; |
1673 | |
1674 | void PNS_WALKAROUND::start( const PNS_LINE& aInitialPath ) |
1675 | |
1676 | === modified file 'pcbnew/router/router_tool.cpp' |
1677 | --- pcbnew/router/router_tool.cpp 2013-10-15 08:41:00 +0000 |
1678 | +++ pcbnew/router/router_tool.cpp 2013-12-04 08:51:30 +0000 |
1679 | @@ -39,7 +39,6 @@ |
1680 | #include "trace.h" |
1681 | |
1682 | using namespace KIGFX; |
1683 | -using namespace std; |
1684 | using boost::optional; |
1685 | |
1686 | static TOOL_ACTION ACT_AutoEndRoute( "AutoEndRoute", AS_CONTEXT, 'F' ); |
1687 | |
1688 | === modified file 'polygon/SutherlandHodgmanClipPoly.h' |
1689 | --- polygon/SutherlandHodgmanClipPoly.h 2009-02-20 14:31:16 +0000 |
1690 | +++ polygon/SutherlandHodgmanClipPoly.h 2013-12-04 08:51:30 +0000 |
1691 | @@ -31,7 +31,6 @@ |
1692 | #include <vector> |
1693 | #include <functional> |
1694 | |
1695 | -using namespace std; |
1696 | #ifndef _GDIPLUS_H |
1697 | |
1698 | // I designed this with GDI+ in mind. However, this particular code doesn't |
1699 | @@ -80,9 +79,9 @@ |
1700 | |
1701 | #endif // _GDIPLUS_H |
1702 | |
1703 | -typedef vector<PointF> pointVector; |
1704 | -typedef vector<PointF>::iterator pointIterator; |
1705 | -typedef vector<PointF>::const_iterator cpointIterator; |
1706 | +typedef std::vector<PointF> pointVector; |
1707 | +typedef std::vector<PointF>::iterator pointIterator; |
1708 | +typedef std::vector<PointF>::const_iterator cpointIterator; |
1709 | |
1710 | class SutherlandHodgman |
1711 | { |
1712 | @@ -249,10 +248,10 @@ |
1713 | // rectangles, we include the left and top boundaries, but not the right and bottom boundaries. |
1714 | // In other words: a vertex on the left boundary is considered to be inside, but a vertex |
1715 | // on the right boundary is considered to be outside. |
1716 | - typedef BoundaryVert < less<REAL> > BoundaryRight; |
1717 | - typedef BoundaryHor < greater_equal<REAL> > BoundaryTop; |
1718 | - typedef BoundaryVert < greater_equal<REAL> > BoundaryLeft; |
1719 | - typedef BoundaryHor < less<REAL> > BoundaryBottom; |
1720 | + typedef BoundaryVert<std::less<REAL> > BoundaryRight; |
1721 | + typedef BoundaryHor<std::greater_equal<REAL> > BoundaryTop; |
1722 | + typedef BoundaryVert<std::greater_equal<REAL> > BoundaryLeft; |
1723 | + typedef BoundaryHor<std::less<REAL> > BoundaryBottom; |
1724 | |
1725 | // Next typedefs define the four stages. First template parameter is the boundary, |
1726 | // second template parameter is the next stage. |
1727 | |
1728 | === modified file 'polygon/poly2tri/common/shapes.cc' |
1729 | --- polygon/poly2tri/common/shapes.cc 2013-09-13 13:28:20 +0000 |
1730 | +++ polygon/poly2tri/common/shapes.cc 2013-12-04 08:51:30 +0000 |
1731 | @@ -1,4 +1,4 @@ |
1732 | -/* |
1733 | +/* |
1734 | * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors |
1735 | * http://code.google.com/p/poly2tri/ |
1736 | * |
1737 | @@ -96,14 +96,14 @@ |
1738 | } |
1739 | else if( neighbors_[1] == triangle ) |
1740 | { |
1741 | - neighbors_[1] = NULL; |
1742 | + neighbors_[1] = NULL; |
1743 | } |
1744 | else |
1745 | { |
1746 | neighbors_[2] = NULL; |
1747 | } |
1748 | } |
1749 | - |
1750 | + |
1751 | void Triangle::ClearNeighbors() |
1752 | { |
1753 | neighbors_[0] = NULL; |
1754 | @@ -357,10 +357,9 @@ |
1755 | |
1756 | void Triangle::DebugPrint() |
1757 | { |
1758 | - using namespace std; |
1759 | - cout << points_[0]->x << "," << points_[0]->y << " "; |
1760 | - cout << points_[1]->x << "," << points_[1]->y << " "; |
1761 | - cout << points_[2]->x << "," << points_[2]->y << endl; |
1762 | + std::cout << points_[0]->x << "," << points_[0]->y << " "; |
1763 | + std::cout << points_[1]->x << "," << points_[1]->y << " "; |
1764 | + std::cout << points_[2]->x << "," << points_[2]->y << "\n"; |
1765 | } |
1766 | |
1767 | } |
1768 | |
1769 | === modified file 'scripting/kicad.i' |
1770 | --- scripting/kicad.i 2013-11-01 15:29:50 +0000 |
1771 | +++ scripting/kicad.i 2013-12-04 08:51:30 +0000 |
1772 | @@ -63,8 +63,6 @@ |
1773 | #include <cstddef> |
1774 | #include <vector> |
1775 | |
1776 | - using namespace std; |
1777 | - |
1778 | #include <class_title_block.h> |
1779 | #include <class_colors_design_settings.h> |
1780 | #include <class_marker_base.h> |
I wish we had added this text to the coding standards:
******* ******* ******* *****
The project should never use 'using namespace ...' in a header file, but using
it in a *.cpp file is OK, according to the author of the *.cpp file's preference.
If it occurs in a *.cpp file, it must occur after any #include statements.
******* ******* ******* *****
The consequences of that make it impossible not to use std:: for all STL objects which
present themselves in a header file. This is the public API.
The above policy also gives the implementation author the freedom of brevity in a file which is not affecting usage of the API in (client callaing) *.cpp files.
I personally have followed this policy in everything I've contributed, never once put a "using namespace" into a header file. I was not aware that we had strayed from this common sense approach.
So I only like about 25% of this patch, because for my *.cpp files, I really don't care to see them be changed in a way other than I wrote them for something other than a bug. Of course, this is an understatement.
It is general, not limited to me. It is respectful of the original author's wishes, the person who we often call upon to *support* the code when something goes wrong.