diff --git a/pub/trivia/file_ops.hpp b/pub/trivia/file_ops.hpp index fdb50586f4fbe69f4033d7d758c5005b6da7f6d9..dba3b470edc11a4f9a06d008559164c482906c74 100644 --- a/pub/trivia/file_ops.hpp +++ b/pub/trivia/file_ops.hpp @@ -7,19 +7,19 @@ namespace triv { - using namespace std; - // Improved libc calls: - void system( string cmd, bool debug=false ); - string system_read( string cmd, bool debug=false ); + void system( std::string cmd, bool debug=false ); + std::string system_read( std::string cmd, bool debug=false ); // File names, globbing: - bool file_exists( const string& fname ); - void fname_divide( const string& fname, string *fdir, string *fshort, string *fext); - void glob_file_list( const string& pattern, const string& extension, vector<string> *fnames ); - string wordexp_unique( const string& s ); - string next_tmp_file( const string& path_format ); + bool file_exists( const std::string& fname ); + void fname_divide( const std::string& fname, std::string *fdir, + std::string *fshort, std::string *fext); + void glob_file_list( const std::string& pattern, const std::string& extension, + std::vector<std::string> *fnames ); + std::string wordexp_unique( const std::string& s ); + std::string next_tmp_file( const std::string& path_format ); // File read: - bool freadln( FILE *fd, string *s ); + bool freadln( FILE *fd, std::string *s ); } diff --git a/pub/trivia/string_ops.hpp b/pub/trivia/string_ops.hpp index e83e4235f281d77647a26b553ce289f16f18b33d..534b5a5fa990c4d066a6df33e4bf782acde26369 100644 --- a/pub/trivia/string_ops.hpp +++ b/pub/trivia/string_ops.hpp @@ -1,21 +1,17 @@ -//***************************************************************************// -//* libtrivia: various little routines for C++ *// -//* string_ops: string operations *// -//* (C) Joachim Wuttke 2001, 2012- *// -//* http://apps.jcns.fz-juelich.de *// -//***************************************************************************// +//************************************************************************************************** +//* libtrivia: various little routines for C++ +//* string_ops: string operations +//* (C) Joachim Wuttke 2001, 2012- +//* http://apps.jcns.fz-juelich.de +//************************************************************************************************** namespace triv { - using namespace std; - bool str2vec( string inp, vector<double> *V, - size_t nmax=0, bool force=true ); - void string_extract_word( const string& in, - string *out1, string *out2 ); - void string_extract_line( const string& in, string *out1, - string *out2 ); - void split( const string& in, vector<string>& out, - const string& delimiters = " \t" ); - string strip( const string& str, const char* sepSet=" \n" ); + bool str2vec( std::string inp, std::vector<double> *V, size_t nmax=0, bool force=true ); + void string_extract_word( const std::string& in, std::string *out1, std::string *out2 ); + void string_extract_line( const std::string& in, std::string *out1, std::string *out2 ); + void split( const std::string& in, std::vector<std::string>& out, + const std::string& delimiters = " \t" ); + std::string strip( const std::string& str, const char* sepSet=" \n" ); } diff --git a/pub/trivia/vector_ops.hpp b/pub/trivia/vector_ops.hpp index 48e1b607891e878abae3e8a2b05f48aea3b60c98..2bde027d9a26a9de6021fb4e0a4981c9c636413f 100644 --- a/pub/trivia/vector_ops.hpp +++ b/pub/trivia/vector_ops.hpp @@ -1,24 +1,22 @@ -//***************************************************************************// -//* libtrivia: various little routines for C++ *// -//* vector_ops: vector operations *// -//* (C) Joachim Wuttke 2001, 2012- *// -//* http://apps.jcns.fz-juelich.de *// -//***************************************************************************// +//************************************************************************************************** +//* libtrivia: various little routines for C++ +//* vector_ops: vector operations +//* (C) Joachim Wuttke 2001, 2012- +//* http://apps.jcns.fz-juelich.de +//************************************************************************************************** namespace triv { - using namespace std; + void insert_in_sorted( std::vector<double> *V, double val ); + void make_unique( std::vector<double> *V, double tolabs=1e-100, double tolrel=1e-10 ); + bool is_ascending( const std::vector<double>& V ); + bool is_equidist( double *step, const std::vector<double>& V ); + std::vector<size_t> sorted_indices( std::vector<double> const& V ); - void insert_in_sorted( vector<double> *V, double val ); - void make_unique( vector<double> *V, double tolabs=1e-100, double tolrel=1e-10 ); - bool is_ascending( const vector<double>& V ); - bool is_equidist( double *step, const vector<double>& V ); - vector<size_t> sorted_indices( vector<double> const& V ); - - void increment_indices( vector<int>& v, int incr, int siz ); - string indices_to_s( const vector<int>& v ); + void increment_indices( std::vector<int>& v, int incr, int siz ); + std::string indices_to_s( const std::vector<int>& v ); template<class A> - bool contains( const vector<A>& v, const A e ) + bool contains( const std::vector<A>& v, const A e ) { return std::find( v.begin(), v.end(), e ) != v.end(); } } diff --git a/pub/trivia/yaml_out.hpp b/pub/trivia/yaml_out.hpp index e34902c4e555d51a0774c1f40abb3fd75c6923cc..5fdb4df426a94ada6bac05ee1123d0daf2307800 100644 --- a/pub/trivia/yaml_out.hpp +++ b/pub/trivia/yaml_out.hpp @@ -7,7 +7,5 @@ namespace triv { - using namespace std; - - string yaml( const string ); + std::string yaml( const std::string ); }