diff options
author | David Kastrup <dak@gnu.org> | 2015-08-23 21:58:47 +0200 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2015-08-23 21:58:47 +0200 |
commit | 207f71b8b2ab9ca550e841615bedce393e652ca6 (patch) | |
tree | fad2f34c702e46aa1ab99831d7ce199ca648b6d6 /flower | |
parent | c8d62eca2d025e1fdce22f478f87c10f414d4b9d (diff) |
Revert "Issue 4550 (2/2) Avoid "using namespace std;" in included files"
This reverts commit 59a6d1a06432fc0ca88c3023c646182f389ec1b5.
Diffstat (limited to 'flower')
42 files changed, 172 insertions, 147 deletions
diff --git a/flower/file-cookie.cc b/flower/file-cookie.cc index 36871d705d..762acb1c06 100644 --- a/flower/file-cookie.cc +++ b/flower/file-cookie.cc @@ -1,6 +1,7 @@ #include <cassert> #include <cstdio> +using namespace std; #include "memory-stream.hh" diff --git a/flower/file-name.cc b/flower/file-name.cc index 24db2021b0..71b3bf27b5 100644 --- a/flower/file-name.cc +++ b/flower/file-name.cc @@ -25,6 +25,7 @@ #include <unistd.h> #include <limits.h> +using namespace std; #include "config.hh" diff --git a/flower/getopt-long.cc b/flower/getopt-long.cc index 658faed921..49f7c8831d 100644 --- a/flower/getopt-long.cc +++ b/flower/getopt-long.cc @@ -318,7 +318,7 @@ Long_option_init::table_string (Long_option_init *l) size_t wid = 0; for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++) - wid = std::max (wid, l[i].str_for_help ().length ()); + wid = max (wid, l[i].str_for_help ().length ()); for (int i = 0; l[i].shortname_char_ || l[i].longname_str0_; i++) { diff --git a/flower/include/cpu-timer.hh b/flower/include/cpu-timer.hh index e77cc1f2a6..3c492eeef9 100644 --- a/flower/include/cpu-timer.hh +++ b/flower/include/cpu-timer.hh @@ -21,6 +21,7 @@ #define CPU_TIMER_HH #include <ctime> +using namespace std; #include "real.hh" diff --git a/flower/include/direction.hh b/flower/include/direction.hh index dff5467497..0d36c0f7c7 100644 --- a/flower/include/direction.hh +++ b/flower/include/direction.hh @@ -71,9 +71,9 @@ operator - (Direction d) template<class T> T minmax (Direction d, T a, T b) { if (d == UP) - return std::max (a, b); + return max (a, b); else - return std::min (a, b); + return min (a, b); } #endif // DIRECTION_HH diff --git a/flower/include/file-cookie.hh b/flower/include/file-cookie.hh index d55a918c87..6bdb236699 100644 --- a/flower/include/file-cookie.hh +++ b/flower/include/file-cookie.hh @@ -5,6 +5,7 @@ extern "C" { #include <unistd.h> #include <cstdio> + using namespace std; #if (! defined (__off64_t) && ! defined (__off64_t_defined)) || ! defined (__cplusplus) #define off64_t unsigned long long diff --git a/flower/include/file-name.hh b/flower/include/file-name.hh index 6f05a03635..6f2da75093 100644 --- a/flower/include/file-name.hh +++ b/flower/include/file-name.hh @@ -29,18 +29,18 @@ std::string get_working_directory (); class File_name { public: - std::string root_; - std::string dir_; - std::string base_; - std::string ext_; + string root_; + string dir_; + string base_; + string ext_; - File_name (std::string = ""); + File_name (string = ""); bool is_absolute () const; - std::string to_string () const; + string to_string () const; File_name canonicalized () const; - std::string dir_part () const; - std::string file_part () const; + string dir_part () const; + string file_part () const; }; #endif /* FILE_NAME */ diff --git a/flower/include/file-path.hh b/flower/include/file-path.hh index c3597934d9..1c039cf4ab 100644 --- a/flower/include/file-path.hh +++ b/flower/include/file-path.hh @@ -34,20 +34,20 @@ class File_path { - std::vector<std::string> dirs_; + vector<string> dirs_; public: - std::vector<std::string> directories () const; - std::string find (const std::string &name) const; - std::string find (const std::string &name, char const *extensions[]); - std::string to_string () const; - bool try_append (std::string str); - void append (const std::string&); - void parse_path (const std::string&); - void prepend (const std::string&); + vector<string> directories () const; + string find (const string &name) const; + string find (const string &name, char const *extensions[]); + string to_string () const; + bool try_append (string str); + void append (const string&); + void parse_path (const string&); + void prepend (const string&); }; -bool is_file (const std::string &file_name); -bool is_dir (std::string file_name); +bool is_file (const string &file_name); +bool is_dir (string file_name); #endif /* FILE_PATH */ diff --git a/flower/include/flower-proto.hh b/flower/include/flower-proto.hh index 1ba3760f2e..33e587d000 100644 --- a/flower/include/flower-proto.hh +++ b/flower/include/flower-proto.hh @@ -27,6 +27,7 @@ typedef long long I64; class String_convert; #include "real.hh" +using namespace std; template<class T> struct Interval_t; template<class T> struct PQueue; diff --git a/flower/include/getopt-long.hh b/flower/include/getopt-long.hh index 2e13188a60..52c819822c 100644 --- a/flower/include/getopt-long.hh +++ b/flower/include/getopt-long.hh @@ -20,12 +20,12 @@ struct Long_option_init char const *help_str0_; - std::string to_string () const; - std::string str_for_help () const; + string to_string () const; + string str_for_help () const; // NO constructor! static int compare (Long_option_init const &, Long_option_init const &); - static std::string table_string (Long_option_init *); + static string table_string (Long_option_init *); }; /** C++ for version of long_getopt. For processing GNU style command diff --git a/flower/include/international.hh b/flower/include/international.hh index 90495578cd..f2f48996de 100644 --- a/flower/include/international.hh +++ b/flower/include/international.hh @@ -35,19 +35,19 @@ /** Internationalisation: _ ("to be translated") gets "translated" by GNU gettext */ -std::string _ (char const *ch); +string _ (char const *ch); /** Internationalisation: _f ("Usage: %s [FILE]", "lilypond") gets "translated" by GNU gettext */ -std::string _f (char const *format, ...) +string _f (char const *format, ...) __attribute__ ((format (printf, 1, 2))); -std::string _f (char const *format, const std::string &s, const std::string &s2 = "", const std::string &s3 = ""); +string _f (char const *format, const string &s, const string &s2 = "", const string &s3 = ""); /** va_list version of _f */ -std::string v_f (char const *format, va_list args); +string v_f (char const *format, va_list args); #endif // INTERNATIONAL_HH diff --git a/flower/include/interval-set.hh b/flower/include/interval-set.hh index 610866be32..84f6debb30 100644 --- a/flower/include/interval-set.hh +++ b/flower/include/interval-set.hh @@ -28,15 +28,15 @@ class Interval_set public: Interval_set (); - static Interval_set interval_union (std::vector<Interval>); + static Interval_set interval_union (vector<Interval>); - std::vector<Interval> const &intervals () const { return intervals_; } - std::vector<Interval>::const_iterator upper_bound (Real x) const; + vector<Interval> const &intervals () const { return intervals_; } + vector<Interval>::const_iterator upper_bound (Real x) const; Real nearest_point (Real x, Direction dir = CENTER) const; Interval_set complement () const; private: - std::vector<Interval> intervals_; + vector<Interval> intervals_; }; #endif /* INTERVAL_SET_HH */ diff --git a/flower/include/interval.hh b/flower/include/interval.hh index c4beb9bb99..88cd01f89f 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -35,7 +35,7 @@ struct Interval_t : public Drul_array<T> using Drul_array<T>::at; static T infinity (); - static std::string T_to_string (T arg); + static string T_to_string (T arg); T center () const; void translate (T t) { @@ -65,8 +65,8 @@ struct Interval_t : public Drul_array<T> void intersect (Interval_t<T> h); void add_point (T p) { - at (LEFT) = std::min (at (LEFT), p); - at (RIGHT) = std::max (at (RIGHT), p); + at (LEFT) = min (at (LEFT), p); + at (RIGHT) = max (at (RIGHT), p); } T length () const; @@ -120,7 +120,7 @@ struct Interval_t : public Drul_array<T> } Real linear_combination (Real x) const; - std::string to_string () const; + string to_string () const; bool contains (T r) const; void negate () diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index f0973b8b09..72be6e81e9 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -27,6 +27,7 @@ // MacOS 10.3 problems: // #include <cmath> +using namespace std; template<class T> int @@ -102,8 +103,8 @@ template<class T> void Interval_t<T>::unite (Interval_t<T> h) { - at (LEFT) = std::min (h.at (LEFT), at (LEFT)); - at (RIGHT) = std::max (h.at (RIGHT), at (RIGHT)); + at (LEFT) = min (h.at (LEFT), at (LEFT)); + at (RIGHT) = max (h.at (RIGHT), at (RIGHT)); } /* Unites h and this interval, but in such a way @@ -135,20 +136,20 @@ template<class T> void Interval_t<T>::intersect (Interval_t<T> h) { - at (LEFT) = std::max (h.at (LEFT), at (LEFT)); - at (RIGHT) = std::min (h.at (RIGHT), at (RIGHT)); + at (LEFT) = max (h.at (LEFT), at (LEFT)); + at (RIGHT) = min (h.at (RIGHT), at (RIGHT)); } template<class T> -std::string +string Interval_t<T>::to_string () const { if (is_empty ()) return "[empty]"; - std::string s ("["); + string s ("["); - return (s + T_to_string (at (LEFT)) + std::string (",") - + T_to_string (at (RIGHT)) + std::string ("]")); + return (s + T_to_string (at (LEFT)) + string (",") + + T_to_string (at (RIGHT)) + string ("]")); } template<class T> diff --git a/flower/include/libc-extension.hh b/flower/include/libc-extension.hh index 974b5521ab..04056e6c49 100644 --- a/flower/include/libc-extension.hh +++ b/flower/include/libc-extension.hh @@ -22,6 +22,7 @@ #include <cstddef> #include <cstdarg> +using namespace std; #include "config.hh" diff --git a/flower/include/matrix.hh b/flower/include/matrix.hh index 6b2e61c359..a6c13f837c 100644 --- a/flower/include/matrix.hh +++ b/flower/include/matrix.hh @@ -57,7 +57,7 @@ public: data_.resize (rows * columns, t); else { - std::vector<T, A> new_data; + vector<T, A> new_data; new_data.resize (rows * columns, t); vsize cur_cols = rank_ ? data_.size () / rank_ : 0; @@ -70,7 +70,7 @@ public: } private: - std::vector<T, A> data_; + vector<T, A> data_; vsize rank_; }; diff --git a/flower/include/memory-stream.hh b/flower/include/memory-stream.hh index 3a355e9337..2cce5986b5 100644 --- a/flower/include/memory-stream.hh +++ b/flower/include/memory-stream.hh @@ -22,6 +22,7 @@ #include <cstdio> #include <unistd.h> +using namespace std; #include "libc-extension.hh" #include "file-cookie.hh" diff --git a/flower/include/offset.hh b/flower/include/offset.hh index b34964c9e8..8f395398b7 100644 --- a/flower/include/offset.hh +++ b/flower/include/offset.hh @@ -101,7 +101,7 @@ public: coordinate_a_[X_AXIS] = coordinate_a_[Y_AXIS] = 0.0; } - std::string to_string () const; + string to_string () const; Offset &mirror (Axis a) { diff --git a/flower/include/parray.hh b/flower/include/parray.hh index 471b9f5858..9ef9ddb217 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -22,9 +22,10 @@ #include "std-vector.hh" +using namespace std; template<class T> -class Link_array : public std::vector<T *> +class Link_array : public vector<T *> { }; diff --git a/flower/include/polynomial.hh b/flower/include/polynomial.hh index 379609bcaf..f80b53c2ee 100644 --- a/flower/include/polynomial.hh +++ b/flower/include/polynomial.hh @@ -36,7 +36,7 @@ struct Polynomial ssize_t degree ()const; /// coefficients - std::vector<Real> coefs_; + vector<Real> coefs_; // leading coef Real &lc (); @@ -46,8 +46,8 @@ struct Polynomial void print () const; Real eval (Real) const; Real minmax (Real, Real, bool) const; - void print_sols (std::vector<Real>) const; - void check_sols (std::vector<Real>) const; + void print_sols (vector<Real>) const; + void check_sols (vector<Real>) const; void check_sol (Real x) const; static Polynomial multiply (const Polynomial &p1, const Polynomial &p2); static Polynomial power (int exponent, const Polynomial &src); @@ -73,11 +73,11 @@ struct Polynomial void debug_clean (); - std::vector<Real> solve_quadric ()const; - std::vector<Real> solve_cubic ()const; - std::vector<Real> solve_linear ()const; + vector<Real> solve_quadric ()const; + vector<Real> solve_cubic ()const; + vector<Real> solve_linear ()const; - std::vector<Real> solve () const; + vector<Real> solve () const; }; IMPLEMENT_ARITHMETIC_OPERATOR (Polynomial, -); diff --git a/flower/include/pqueue.hh b/flower/include/pqueue.hh index 923773f500..6f1ebc53b6 100644 --- a/flower/include/pqueue.hh +++ b/flower/include/pqueue.hh @@ -45,7 +45,7 @@ int compare (PQueue_ent<K, T> const &e1, PQueue_ent<K, T> const &e2) template<class T> class PQueue { - std::vector<T> heap_array_; + vector<T> heap_array_; T &elt (vsize i) { return heap_array_[i - 1]; diff --git a/flower/include/rational.hh b/flower/include/rational.hh index d8051c922a..f829e531ec 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -86,7 +86,7 @@ public: Rational &operator %= (Rational); static int compare (Rational const &, Rational const &); int sign () const; - std::string to_string () const; + string to_string () const; }; #include "arithmetic-operator.hh" diff --git a/flower/include/real.hh b/flower/include/real.hh index 0b0cf59419..d7208b4e56 100644 --- a/flower/include/real.hh +++ b/flower/include/real.hh @@ -23,6 +23,7 @@ #include <algorithm> #include <climits> #include <cmath> +using namespace std; typedef double Real; extern const Real infinity_f; diff --git a/flower/include/std-string.hh b/flower/include/std-string.hh index 2e2908f7a2..bdb85795ab 100644 --- a/flower/include/std-string.hh +++ b/flower/include/std-string.hh @@ -33,24 +33,25 @@ #include <string> +using namespace std; typedef size_t ssize; #define NPOS std::string::npos -std::string to_string (const std::string&); -std::string to_string (char c, int n = 1); -std::string to_string (int i, char const *format = 0); -std::string to_string (double f, char const *format = 0); -std::string to_string (long); -std::string to_string (long unsigned); -std::string to_string (I64, char const *format = 0); -std::string to_string (unsigned); -std::string to_string (bool b); -std::string to_string (char const *format, ...) +string to_string (const string&); +string to_string (char c, int n = 1); +string to_string (int i, char const *format = 0); +string to_string (double f, char const *format = 0); +string to_string (long); +string to_string (long unsigned); +string to_string (I64, char const *format = 0); +string to_string (unsigned); +string to_string (bool b); +string to_string (char const *format, ...) __attribute__ ((format (printf, 1, 2))); -std::string &replace_all (std::string *str, std::string const &find, std::string const &replace); -std::string &replace_all (std::string *str, char find, char replace); -char *string_copy (const std::string &s); +string &replace_all (string *str, string const &find, string const &replace); +string &replace_all (string *str, char find, char replace); +char *string_copy (const string &s); #endif /* STD_STRING_HH */ diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index 7b50f27b4b..fae955854b 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -36,6 +36,7 @@ #include <cassert> #include <string> +using namespace std; template<typename T> int default_compare (T const &a, T const &b) @@ -85,19 +86,19 @@ public: typedef typename __flower_vector<T>::iterator iterator; typedef typename __flower_vector<T>::const_iterator const_iterator; - std::vector<T, A> () : __flower_vector<T, A> () + vector<T, A> () : __flower_vector<T, A> () { } - std::vector<T, A> (size_t n) : __flower_vector<T, A> (n) + vector<T, A> (size_t n) : __flower_vector<T, A> (n) { } - std::vector<T, A> (std::vector<T, A> const &v) : __flower_vector<T, A> (v) + vector<T, A> (vector<T, A> const &v) : __flower_vector<T, A> (v) { } - std::vector<T, A> (const_iterator b, const_iterator e) : __flower_vector<T, A> (b, e) + vector<T, A> (const_iterator b, const_iterator e) : __flower_vector<T, A> (b, e) { } @@ -120,7 +121,7 @@ public: template<typename T> T const & -boundary (std::vector<T> const &v, int dir, vsize i) +boundary (vector<T> const &v, int dir, vsize i) { assert (dir); return v[dir == -1 ? i : v.size () - 1 - i]; @@ -128,7 +129,7 @@ boundary (std::vector<T> const &v, int dir, vsize i) template<typename T> T & -boundary (std::vector<T> &v, int dir, vsize i) +boundary (vector<T> &v, int dir, vsize i) { assert (dir); return v[dir == -1 ? i : v.size () - 1 - i]; @@ -136,35 +137,35 @@ boundary (std::vector<T> &v, int dir, vsize i) template<typename T> T const & -back (std::vector<T> const &v, vsize i) +back (vector<T> const &v, vsize i) { return v[v.size () - i - 1]; } template<typename T> T & -back (std::vector<T> &v, vsize i) +back (vector<T> &v, vsize i) { return v[v.size () - i - 1]; } template<typename T> void -concat (std::vector<T> &v, std::vector<T> const &w) +concat (vector<T> &v, vector<T> const &w) { v.insert (v.end (), w.begin (), w.end ()); } template<typename T, typename Compare> vsize -lower_bound (std::vector<T> const &v, +lower_bound (vector<T> const &v, T const &key, Compare less, vsize b = 0, vsize e = VPOS) { if (e == VPOS) e = v.size (); - typename std::vector<T>::const_iterator i = lower_bound (v.begin () + b, + typename vector<T>::const_iterator i = lower_bound (v.begin () + b, v.begin () + e, key, less); @@ -174,7 +175,7 @@ lower_bound (std::vector<T> const &v, template<typename T, typename Compare> vsize -upper_bound (std::vector<T> const &v, +upper_bound (vector<T> const &v, T const &key, Compare less, vsize b = 0, vsize e = VPOS) @@ -182,7 +183,7 @@ upper_bound (std::vector<T> const &v, if (e == VPOS) e = v.size (); - typename std::vector<T>::const_iterator i = upper_bound (v.begin () + b, + typename vector<T>::const_iterator i = upper_bound (v.begin () + b, v.begin () + e, key, less); @@ -192,7 +193,7 @@ upper_bound (std::vector<T> const &v, template<typename T, typename Compare> vsize -binary_search (std::vector<T> const &v, +binary_search (vector<T> const &v, T const &key, Compare less, vsize b = 0, vsize e = VPOS) @@ -206,7 +207,7 @@ binary_search (std::vector<T> const &v, template<typename T, typename Compare> void -vector_sort (std::vector<T> &v, +vector_sort (vector<T> &v, Compare less, vsize b = 0, vsize e = VPOS) { @@ -218,28 +219,28 @@ vector_sort (std::vector<T> &v, template<typename T> void -reverse (std::vector<T> &v) +reverse (vector<T> &v) { - // CHECKME: for a simple vector, like std::vector<int>, this should + // CHECKME: for a simple vector, like vector<int>, this should // expand to memrev. reverse (v.begin (), v.end ()); } template<typename T> void -uniq (std::vector<T> &v) +uniq (vector<T> &v) { v.erase (unique (v.begin (), v.end ()), v.end ()); } template<typename T> -typename std::vector<T>::const_iterator -find (std::vector<T> const &v, T const &key) +typename vector<T>::const_iterator +find (vector<T> const &v, T const &key) { return find (v.begin (), v.end (), key); } -template<typename T> struct del : public std::unary_function<T, void> +template<typename T> struct del : public unary_function<T, void> { void operator () (T x) { @@ -250,15 +251,15 @@ template<typename T> struct del : public std::unary_function<T, void> template<typename T> void -junk_pointers (std::vector<T> &v) +junk_pointers (vector<T> &v) { // Hmm. for_each (v.begin (), v.end (), del<T> ()); v.clear (); } -std::vector<std::string> string_split (std::string str, char c); -std::string string_join (std::vector<std::string> const &strs, const std::string &infix); +vector<string> string_split (string str, char c); +string string_join (vector<string> const &strs, const string &infix); #define iterof(i,s) typeof((s).begin()) i((s).begin()) diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index f8984de0cc..8e1695bd5c 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -1,51 +1,52 @@ /* PROJECT: FlowerSoft C++ library - FILE : std::string-convert.hh + FILE : string-convert.hh */ #ifndef STRING_CONVERT_HH #define STRING_CONVERT_HH #include <cstdarg> +using namespace std; #include "flower-proto.hh" #include "std-string.hh" -/** The functor string_convert handles all conversions to/from std::string +/** The functor string_convert handles all conversions to/from string (some time, anyway). The class is quite empty from data view. */ class String_convert { - static int hex2bin (std::string hex_string, std::string &bin_string_r); + static int hex2bin (string hex_string, string &bin_string_r); static int hex2nibble (Byte byte); static Byte nibble2hex_byte (Byte byte); public: - static std::string pad_to (const std::string &s, size_t length); - static std::string bool_string (bool b); - static std::string bin2hex (Byte bin_char); - static std::string bin2hex (const std::string &bin_string); - static int bin2int (const std::string &bin_string); - static unsigned bin2unsigned (const std::string &bin_string); - static std::string char_string (char c, int n); - static int dec2int (const std::string &dec_string); - static double dec2double (const std::string &dec_string); - static std::string double_string (double f, char const *fmt = 0); - static std::string form_string (char const *format, ...) __attribute__ ((format (printf, 1, 2))); - static std::string vform_string (char const *format, va_list args); - static std::string hex2bin (const std::string &str); - static std::string int_string (int i, char const *fmt = 0); - static std::string unsigned_string (unsigned); - static std::string unsigned_long_string (unsigned long); - static std::string long_string (long); - static std::string int2hex (int i, size_t length_i, char ch); - static std::string unsigned2hex (unsigned u, size_t length, char ch); - static std::string int2dec (int i, size_t length_i, char ch); - static std::string rational_string (Rational); - static std::string pointer_string (void const *); - static std::string precision_string (double x, int n); - static std::string i64_string (I64, char const *fmt = 0); - static std::string to_lower (std::string s); - static std::string to_upper (std::string s); - static std::string reverse (std::string s); + static string pad_to (const string &s, size_t length); + static string bool_string (bool b); + static string bin2hex (Byte bin_char); + static string bin2hex (const string &bin_string); + static int bin2int (const string &bin_string); + static unsigned bin2unsigned (const string &bin_string); + static string char_string (char c, int n); + static int dec2int (const string &dec_string); + static double dec2double (const string &dec_string); + static string double_string (double f, char const *fmt = 0); + static string form_string (char const *format, ...) __attribute__ ((format (printf, 1, 2))); + static string vform_string (char const *format, va_list args); + static string hex2bin (const string &str); + static string int_string (int i, char const *fmt = 0); + static string unsigned_string (unsigned); + static string unsigned_long_string (unsigned long); + static string long_string (long); + static string int2hex (int i, size_t length_i, char ch); + static string unsigned2hex (unsigned u, size_t length, char ch); + static string int2dec (int i, size_t length_i, char ch); + static string rational_string (Rational); + static string pointer_string (void const *); + static string precision_string (double x, int n); + static string i64_string (I64, char const *fmt = 0); + static string to_lower (string s); + static string to_upper (string s); + static string reverse (string s); }; #endif // __STRING_CONVERT_HH // diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index 5a907b2cf7..dc91d7b669 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -21,6 +21,7 @@ #define VIRTUAL_METHODS_HH #include <typeinfo> +using namespace std; /* Virtual copy constructor. Make up for C++'s lack of a standard diff --git a/flower/include/warn.hh b/flower/include/warn.hh index dcc6f0ee24..f52d3818cc 100644 --- a/flower/include/warn.hh +++ b/flower/include/warn.hh @@ -44,25 +44,25 @@ extern int loglevel; extern bool warning_as_error; /* output messages, in decreasing order of importance */ -void error (std::string s, const std::string &location = ""); // Fatal error, exits lilypond! -void programming_error (const std::string &s, const std::string &location = ""); -void non_fatal_error (const std::string&, const std::string &location = ""); -void warning (const std::string &s, const std::string &location = ""); -void basic_progress (const std::string &s, const std::string &location = ""); +void error (string s, const string &location = ""); // Fatal error, exits lilypond! +void programming_error (const string &s, const string &location = ""); +void non_fatal_error (const string&, const string &location = ""); +void warning (const string &s, const string &location = ""); +void basic_progress (const string &s, const string &location = ""); /* progress_indication does by default *NOT* start on a new line */ -void progress_indication (const std::string &s, bool newline = false, const std::string &location = ""); -void message (const std::string &s, bool newline = true, const std::string &location = ""); -void debug_output (const std::string &s, bool newline = true, const std::string &location = ""); +void progress_indication (const string &s, bool newline = false, const string &location = ""); +void message (const string &s, bool newline = true, const string &location = ""); +void debug_output (const string &s, bool newline = true, const string &location = ""); /* Helper functions that always print out the message. Callers should ensure that the loglevel is obeyed */ -void print_message (int level, const std::string &location, std::string s, bool newline = true); +void print_message (int level, const string &location, string s, bool newline = true); bool is_loglevel (int level); void set_loglevel (int level); -void set_loglevel (std::string level); +void set_loglevel (string level); -void expect_warning (const std::string &msg); +void expect_warning (const string &msg); void check_expected_warnings (); #endif /* WARN_HH */ diff --git a/flower/interval-set.cc b/flower/interval-set.cc index fca942b966..acc282bbdb 100644 --- a/flower/interval-set.cc +++ b/flower/interval-set.cc @@ -58,7 +58,7 @@ Interval_set::interval_union (vector<Interval> ivs) if (last[RIGHT] >= iv[LEFT]) // overlapping intervals: merge them - last[RIGHT] = std::max (last[RIGHT], iv[RIGHT]); + last[RIGHT] = max (last[RIGHT], iv[RIGHT]); else if (!iv.is_empty ()) ret.intervals_.push_back (iv); } diff --git a/flower/libc-extension.cc b/flower/libc-extension.cc index 2e4b58407f..1b8060cde2 100644 --- a/flower/libc-extension.cc +++ b/flower/libc-extension.cc @@ -24,6 +24,7 @@ #include <cctype> #include <cassert> +using namespace std; #include "libc-extension.hh" diff --git a/flower/memory-stream.cc b/flower/memory-stream.cc index cc4608c383..511657f5fc 100644 --- a/flower/memory-stream.cc +++ b/flower/memory-stream.cc @@ -20,6 +20,7 @@ #include <cassert> #include <cstring> #include <cstdlib> +using namespace std; #include "memory-stream.hh" diff --git a/flower/polynomial.cc b/flower/polynomial.cc index ad218b29bb..a3f679cd60 100644 --- a/flower/polynomial.cc +++ b/flower/polynomial.cc @@ -23,6 +23,7 @@ #include <cmath> +using namespace std; using std::vector; /* @@ -82,7 +83,7 @@ Polynomial::minmax (Real l, Real r, bool ret_max) const for (vsize i = 0; i < maxmins.size (); i++) if (maxmins[i] >= l && maxmins[i] <= r) sols.push_back (eval (maxmins[i])); - vector_sort (sols, std::less<Real> ()); + vector_sort (sols, less<Real> ()); return ret_max ? sols.back () : sols[0]; } diff --git a/flower/rational.cc b/flower/rational.cc index 4214237f35..e93f65112e 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -22,6 +22,7 @@ #include <cmath> #include <cassert> #include <cstdlib> +using namespace std; #include "string-convert.hh" #include "libc-extension.hh" diff --git a/flower/real.cc b/flower/real.cc index e81577c05f..20d8069669 100644 --- a/flower/real.cc +++ b/flower/real.cc @@ -1,6 +1,7 @@ #include "real.hh" #include <cmath> +using namespace std; #ifdef INFINITY const Real infinity_f = INFINITY; diff --git a/flower/std-string.cc b/flower/std-string.cc index 5dc5a3dce8..b03d3cca59 100644 --- a/flower/std-string.cc +++ b/flower/std-string.cc @@ -33,7 +33,7 @@ to_string (const string &s) string to_string (char c, int n) { - return string (std::max (n, 0), c); + return string (max (n, 0), c); } string diff --git a/flower/string-convert.cc b/flower/string-convert.cc index cbbde1e9d6..13788a4a84 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -8,6 +8,7 @@ #include <cstring> #include <cstdio> +using namespace std; #include "libc-extension.hh" #include "rational.hh" @@ -298,7 +299,7 @@ String_convert::pointer_string (void const *l) string String_convert::precision_string (double x, int n) { - string format = "%." + ::to_string (std::max (0, n - 1)) + "e"; + string format = "%." + ::to_string (max (0, n - 1)) + "e"; string str = double_string (abs (x), format.c_str ()); int exp = dec2int (str.substr (str.length () - 3)); @@ -353,7 +354,7 @@ String_convert::unsigned_long_string (unsigned long ul) string String_convert::pad_to (const string &s, size_t n) { - return s + string (std::max (int (n - s.length ()), 0), ' '); + return s + string (max (int (n - s.length ()), 0), ' '); } string diff --git a/flower/test-file-name.cc b/flower/test-file-name.cc index 04aa6afdb5..04ee34b51f 100644 --- a/flower/test-file-name.cc +++ b/flower/test-file-name.cc @@ -2,6 +2,7 @@ #include "yaffut-parameters.hh" +using namespace std; using std::string; string slashify (string file_name); diff --git a/flower/test-file-path.cc b/flower/test-file-path.cc index fa23bddedd..e55309a3f7 100644 --- a/flower/test-file-path.cc +++ b/flower/test-file-path.cc @@ -15,7 +15,7 @@ TEST (File_path, Find) char cwd[PATH_MAX]; if (!getcwd (cwd, PATH_MAX)) { - std::cerr << "Could not get current work directory\n"; + cerr << "Could not get current work directory\n"; exit (1); } string ly_dir = string (getenv ("top-src-dir")) + "/ly"; diff --git a/flower/test-interval-set.cc b/flower/test-interval-set.cc index d78bbdfdf6..6d8d3823d3 100644 --- a/flower/test-interval-set.cc +++ b/flower/test-interval-set.cc @@ -21,6 +21,7 @@ #include "yaffut.hh" +using namespace std; using std::vector; FUNC (interval_set_union) diff --git a/flower/test-std.cc b/flower/test-std.cc index 667afc124a..711e9237b6 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -6,6 +6,7 @@ #define YAFFUT_MAIN #include "yaffut.hh" +using namespace std; using std::vector; template<typename T> @@ -13,8 +14,8 @@ void print (vector<T> v) { for (vsize i = 0; i < v.size (); i++) - std::cout << "v[" << i << "] = " << v[i] << std::endl; - std::cout << std::endl; + cout << "v[" << i << "] = " << v[i] << endl; + cout << endl; } FUNC (vector_erase) @@ -63,7 +64,7 @@ FUNC (vector_sorting) v.sort (default_compare); #else //sort (v.begin (), v.end ()); - vector_sort (v, std::less<int> ()); + vector_sort (v, less<int> ()); #endif EQUAL (v[0], 0); EQUAL (v[1], 1); @@ -136,7 +137,7 @@ FUNC (parray_uniq) v.push_back (0); v.push_back (1); v.push_back (0); - vector_sort (v, std::less<int> ()); + vector_sort (v, less<int> ()); uniq (v); EQUAL (v.size (), vsize (2)); } @@ -147,6 +148,6 @@ FUNC (vector_search) v.push_back (0); v.push_back (1); v.push_back (2); - vsize i = binary_search (v, 1, std::less<int> ()); + vsize i = binary_search (v, 1, less<int> ()); EQUAL (i, vsize (1)); } diff --git a/flower/test-string.cc b/flower/test-string.cc index 1ab747d9bb..f5524bba74 100644 --- a/flower/test-string.cc +++ b/flower/test-string.cc @@ -5,6 +5,7 @@ #include "yaffut.hh" +using namespace std; using std::string; using std::vector; diff --git a/flower/warn.cc b/flower/warn.cc index 39723ae8a3..422dea8027 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -25,6 +25,7 @@ #include "std-vector.hh" #include "international.hh" +using namespace std; using std::string; using std::vector; |