From 521f9e2fc92a8ab2e6aec2823f0ed4c03263884b Mon Sep 17 00:00:00 2001 From: Ralf Gerlich Date: Fri, 8 Aug 2008 12:31:47 +0200 Subject: [PATCH] Removed remaining "using"-declarations from header-files. --- src/Airports/GenAirports/convex_hull.hxx | 4 ---- src/Lib/vpf/tile.hxx | 5 +---- src/Prep/Terra/Geom.h | 6 ++++-- src/Prep/Terra/Map.cc | 1 + src/Prep/Terra/Map.h | 16 +++++++--------- src/Prep/Terra/Mask.cc | 1 + src/Prep/Terra/Mask.h | 4 +--- src/Prep/Terra/Quadedge.h | 4 +++- src/Prep/Terra/Subdivision.h | 4 +++- src/Prep/Terra/Vec2.h | 11 ++++------- src/Prep/Terra/Vec3.h | 10 ++++++---- src/Prep/Terra/cmdline.cc | 6 +++--- src/Prep/Terra/glHacks.h | 10 +++------- src/Prep/Terra/greedy.cc | 3 +++ src/Prep/Terra/terra.h | 12 +++++++----- src/Prep/TerraFit/terrafit.cc | 2 ++ 16 files changed, 49 insertions(+), 50 deletions(-) diff --git a/src/Airports/GenAirports/convex_hull.hxx b/src/Airports/GenAirports/convex_hull.hxx index d0f2045d..de863c34 100644 --- a/src/Airports/GenAirports/convex_hull.hxx +++ b/src/Airports/GenAirports/convex_hull.hxx @@ -28,10 +28,6 @@ #include -#ifdef NEEDNAMESPACESTD -using namespace std; -#endif - #include #include diff --git a/src/Lib/vpf/tile.hxx b/src/Lib/vpf/tile.hxx index db4ca24d..4a61c974 100644 --- a/src/Lib/vpf/tile.hxx +++ b/src/Lib/vpf/tile.hxx @@ -9,9 +9,6 @@ #include -using std::string; - - class VpfTable; @@ -52,7 +49,7 @@ public: * * @return The subdirectory for a tile. */ - virtual string getTileSubdir () const; + virtual std::string getTileSubdir () const; /** diff --git a/src/Prep/Terra/Geom.h b/src/Prep/Terra/Geom.h index 67e26f82..fcf4a7af 100644 --- a/src/Prep/Terra/Geom.h +++ b/src/Prep/Terra/Geom.h @@ -11,6 +11,8 @@ #include #endif +#include + namespace Terra { typedef double real; @@ -172,10 +174,10 @@ public: p[Y] = (c*l.a - a*l.c)/den; } - friend ostream& operator<<(ostream&, const Line&); + friend std::ostream& operator<<(std::ostream&, const Line&); }; -inline ostream& operator<<(ostream &out, const Line& l) +inline std::ostream& operator<<(std::ostream &out, const Line& l) { return out << "Line(a=" << l.a << " b=" << l.b << " c=" << l.c << ")"; } diff --git a/src/Prep/Terra/Map.cc b/src/Prep/Terra/Map.cc index 89403ba1..e76905ed 100644 --- a/src/Prep/Terra/Map.cc +++ b/src/Prep/Terra/Map.cc @@ -5,6 +5,7 @@ namespace Terra { +using std::istream; using std::cerr; using std::endl; diff --git a/src/Prep/Terra/Map.h b/src/Prep/Terra/Map.h index fdbc4d2a..3d21516c 100644 --- a/src/Prep/Terra/Map.h +++ b/src/Prep/Terra/Map.h @@ -4,8 +4,6 @@ #include #include -using std::istream; - #include "Geom.h" namespace Terra { @@ -25,13 +23,13 @@ public: real eval(real i, real j) { return eval((int)i,(int)j); } virtual real eval(int i, int j) = 0; - virtual void rawRead(istream&) = 0; - virtual void textRead(istream&) = 0; + virtual void rawRead(std::istream&) = 0; + virtual void textRead(std::istream&) = 0; virtual void *getBlock() { return NULL; } virtual void findLimits(); }; -extern Map *readPGM(istream&); +extern Map *readPGM(std::istream&); @@ -57,8 +55,8 @@ public: real eval(int i, int j) { return (real)ref(i,j); } void *getBlock() { return data; } - void rawRead(istream&); - void textRead(istream&); + void rawRead(std::istream&); + void textRead(std::istream&); }; typedef DirectMap ByteMap; @@ -79,7 +77,7 @@ DirectMap::DirectMap(int w, int h) } template -void DirectMap::rawRead(istream& in) +void DirectMap::rawRead(std::istream& in) { char *loc = (char *)data; int target = width*height*sizeof(T); @@ -93,7 +91,7 @@ void DirectMap::rawRead(istream& in) } template -void DirectMap::textRead(istream& in) +void DirectMap::textRead(std::istream& in) { for(int j=0;j -using std::istream; - namespace Terra { class ImportMask @@ -50,7 +48,7 @@ inline real& RealMask::ref(int i, int j) return data[j*width + i]; } -extern RealMask *readMask(istream&); +extern RealMask *readMask(std::istream&); }; // namespace Terra diff --git a/src/Prep/Terra/Quadedge.h b/src/Prep/Terra/Quadedge.h index e9091111..6ac8f3f6 100644 --- a/src/Prep/Terra/Quadedge.h +++ b/src/Prep/Terra/Quadedge.h @@ -3,6 +3,8 @@ #include "Geom.h" +#include + namespace Terra { class Triangle; @@ -74,7 +76,7 @@ inline boolean leftOf(const Vec2& x, const Edge *e) } -inline ostream& operator<<(ostream& out, const Edge *e) +inline std::ostream& operator<<(std::ostream& out, const Edge *e) { return out << "{ " << e->Org() << " ---> " << e->Dest() << " }"; } diff --git a/src/Prep/Terra/Subdivision.h b/src/Prep/Terra/Subdivision.h index e6b365b8..effd4b61 100644 --- a/src/Prep/Terra/Subdivision.h +++ b/src/Prep/Terra/Subdivision.h @@ -3,6 +3,8 @@ #include "Quadedge.h" +#include + namespace Terra { class Subdivision; @@ -85,7 +87,7 @@ public: }; -inline ostream& operator<<(ostream& out, Triangle& t) +inline std::ostream& operator<<(std::ostream& out, Triangle& t) { return out << "Triangle("<< t.point1() << " " << t.point2() << " " << t.point3() << ")"; diff --git a/src/Prep/Terra/Vec2.h b/src/Prep/Terra/Vec2.h index 58a3a34c..d57dbdb9 100644 --- a/src/Prep/Terra/Vec2.h +++ b/src/Prep/Terra/Vec2.h @@ -3,9 +3,6 @@ #include -using std::ostream; -using std::istream; - namespace Terra { class Vec2 { @@ -44,8 +41,8 @@ public: inline real operator*(const Vec2& v) const; // Input/Output methods - friend ostream& operator<<(ostream&, const Vec2&); - friend istream& operator>>(istream&, Vec2&); + friend std::ostream& operator<<(std::ostream&, const Vec2&); + friend std::istream& operator>>(std::istream&, Vec2&); // Additional vector methods inline real length(); @@ -160,12 +157,12 @@ inline real Vec2::unitize() return l; } -inline ostream& operator<<(ostream& out, const Vec2& v) +inline std::ostream& operator<<(std::ostream& out, const Vec2& v) { return out << "[" << v[0] << " " << v[1] << "]"; } -inline istream& operator>>(istream& in, Vec2& v) +inline std::istream& operator>>(std::istream& in, Vec2& v) { char c; return in >> c >> v[0] >> v[1] >> c; diff --git a/src/Prep/Terra/Vec3.h b/src/Prep/Terra/Vec3.h index 39ba5c6a..31b6741e 100644 --- a/src/Prep/Terra/Vec3.h +++ b/src/Prep/Terra/Vec3.h @@ -1,6 +1,8 @@ #ifndef VEC3_INCLUDED // -*- C++ -*- #define VEC3_INCLUDED +#include + namespace Terra { class Vec3 { @@ -41,8 +43,8 @@ public: // Input/Output methods - friend ostream& operator<<(ostream&, const Vec3&); - friend istream& operator>>(istream&, Vec3&); + friend std::ostream& operator<<(std::ostream&, const Vec3&); + friend std::istream& operator>>(std::istream&, Vec3&); // Additional vector methods inline real length(); @@ -165,12 +167,12 @@ inline real Vec3::unitize() return l; } -inline ostream& operator<<(ostream& out, const Vec3& v) +inline std::ostream& operator<<(std::ostream& out, const Vec3& v) { return out << "[" << v[0] << " " << v[1] << " " << v[2] << "]"; } -inline istream& operator>>(istream& in, Vec3& v) +inline std::istream& operator>>(std::istream& in, Vec3& v) { char c; return in >> c >> v[0] >> v[1] >> v[2] >> c; diff --git a/src/Prep/Terra/cmdline.cc b/src/Prep/Terra/cmdline.cc index 71a23556..fcaea414 100644 --- a/src/Prep/Terra/cmdline.cc +++ b/src/Prep/Terra/cmdline.cc @@ -27,9 +27,9 @@ char *output_filename = NULL; char *mask_filename = NULL; char *script_filename = NULL; -static char *options = "e:n:p:h:o:m:s:"; +static const char *options = "e:n:p:h:o:m:s:"; -static char *usage_string = +static const char *usage_string = "-e Sets the tolerable error threshold\n" "-n Sets the *minimum* number of points regardless of \n" "-p Sets the maximum number of allowable points\n" @@ -41,7 +41,7 @@ static char *usage_string = "-s Execute preinsertion script from \n" "\n"; -static void usage_error(char *msg = NULL) +static void usage_error(const char *msg = NULL) { if( msg ) cerr << msg << endl; diff --git a/src/Prep/Terra/glHacks.h b/src/Prep/Terra/glHacks.h index da990912..6ab09e9f 100644 --- a/src/Prep/Terra/glHacks.h +++ b/src/Prep/Terra/glHacks.h @@ -7,10 +7,6 @@ #include #include -using std::ostream; -using std::endl; - - /************************************************************************* * * Yes, here it is. A bunch of nice overloaded routines to make it @@ -164,19 +160,19 @@ inline void glToPPM(FILE *out) } #endif -inline ostream& operator<<(ostream& out,const gfxPixel& p) +inline std::ostream& operator<<(std::ostream& out, const gfxPixel& p) { return out << p.channel.r << p.channel.g << p.channel.b; } -inline void glToPPM(ostream& out) +inline void glToPPM(std::ostream& out) { int x,y,w,h; glGetViewport(&x, &y, &w, &h); gfxPixel *data = glSnapshot(x,y,w,h); - out << "P6 " << w <<" "<< h << " 255" << endl; + out << "P6 " << w <<" "<< h << " 255" << std::endl; int i,j; for(j=h-1;j>=0;j--) for(i=0;i + +using std::istream; using std::cerr; using std::endl; diff --git a/src/Prep/Terra/terra.h b/src/Prep/Terra/terra.h index 048555df..01a69528 100644 --- a/src/Prep/Terra/terra.h +++ b/src/Prep/Terra/terra.h @@ -5,6 +5,8 @@ #include "Map.h" #include "Mask.h" +#include + namespace Terra { extern GreedySubdivision *mesh; @@ -23,15 +25,15 @@ extern char *script_filename; extern int goal_not_met(); extern void greedy_insertion(); extern void display_greedy_insertion(void (*callback)()); -extern void scripted_preinsertion(istream&); +extern void scripted_preinsertion(std::istream&); extern void subsample_insertion(int target_width); extern void generate_output(char *filename=NULL, FileFormat format=NULLfile); -extern void output_tin(ostream&); -extern void output_eps(ostream&); -extern void output_obj(ostream&); -extern void output_dem(ostream&); +extern void output_tin(std::ostream&); +extern void output_eps(std::ostream&); +extern void output_obj(std::ostream&); +extern void output_dem(std::ostream&); extern void process_cmdline(int argc, char **argv); diff --git a/src/Prep/TerraFit/terrafit.cc b/src/Prep/TerraFit/terrafit.cc index f21f6f78..3562c37a 100644 --- a/src/Prep/TerraFit/terrafit.cc +++ b/src/Prep/TerraFit/terrafit.cc @@ -46,6 +46,8 @@ #include #include +using std::istream; + /* * Benchmark: Processing 800 individual buckets: * terrafit.cc: 52s 48s 48s