diff --git a/mrw/string.hpp b/mrw/string.hpp index fc5d63b..9657d5e 100644 --- a/mrw/string.hpp +++ b/mrw/string.hpp @@ -9,6 +9,9 @@ @license LGPL, see file COPYING $Log$ + Revision 1.2 2004/12/16 13:09:47 marc + inlines forgotten + Revision 1.1 2004/10/07 09:31:30 marc new feature @@ -103,7 +106,8 @@ namespace mrw { @pre T must support operator<< to a stream */ - template std::string string(const T& o) throw(std::bad_exception) { + template std::string string(const T& o) + throw(std::bad_exception) { std::stringstream ss; ss< @pre T must support operator<< to a stream */ -template std::string& operator<<(std::string& s, const T& o) throw(std::bad_exception) { +template std::string& operator<<(std::string& s, const T& o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -168,7 +173,8 @@ template std::string& operator<<(std::string& s, const T& o) throw( @pre #include @pre T must support operator>> from a stream */ -template std::string& operator>>(std::string& s, T& o) throw(std::bad_exception) { +template std::string& operator>>(std::string& s, T& o) + throw(std::bad_exception) { std::stringstream ss(s); ss>>o; return (s=ss.tellg()>0?s.substr(ss.tellg()):""); @@ -185,7 +191,8 @@ template std::string& operator>>(std::string& s, T& o) throw(std::b @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, unsigned short o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, unsigned short o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -200,7 +207,8 @@ std::string operator+(const std::string& s, unsigned short o) throw(std::bad_exc @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(unsigned short o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(unsigned short o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -215,7 +223,8 @@ std::string operator+(unsigned short o, const std::string& s) throw(std::bad_exc @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, unsigned int o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, unsigned int o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -230,7 +239,8 @@ std::string operator+(const std::string& s, unsigned int o) throw(std::bad_excep @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(unsigned int o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(unsigned int o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -245,7 +255,8 @@ std::string operator+(unsigned int o, const std::string& s) throw(std::bad_excep @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, unsigned long o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, unsigned long o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -260,7 +271,8 @@ std::string operator+(const std::string& s, unsigned long o) throw(std::bad_exce @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(unsigned long o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(unsigned long o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -275,7 +287,8 @@ std::string operator+(unsigned long o, const std::string& s) throw(std::bad_exce @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, signed short o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, signed short o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -290,7 +303,8 @@ std::string operator+(const std::string& s, signed short o) throw(std::bad_excep @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(signed short o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(signed short o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -305,7 +319,8 @@ std::string operator+(signed short o, const std::string& s) throw(std::bad_excep @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, signed int o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, signed int o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -320,7 +335,8 @@ std::string operator+(const std::string& s, signed int o) throw(std::bad_excepti @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(signed int o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(signed int o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -335,7 +351,8 @@ std::string operator+(signed int o, const std::string& s) throw(std::bad_excepti @param o the value to append to @c s @pre #include */ -std::string operator+(const std::string& s, signed long o) throw(std::bad_exception) { +inline std::string operator+(const std::string& s, signed long o) + throw(std::bad_exception) { return s+mrw::string(o); } @@ -350,7 +367,8 @@ std::string operator+(const std::string& s, signed long o) throw(std::bad_except @param o the value to prepend in front of @c s @pre #include */ -std::string operator+(signed long o, const std::string& s) throw(std::bad_exception) { +inline std::string operator+(signed long o, const std::string& s) + throw(std::bad_exception) { return mrw::string(o)+s; } @@ -366,7 +384,8 @@ std::string operator+(signed long o, const std::string& s) throw(std::bad_except @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, unsigned short o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, unsigned short o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -381,7 +400,8 @@ std::string& operator+=(std::string& s, unsigned short o) throw(std::bad_excepti @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, unsigned int o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, unsigned int o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -396,7 +416,8 @@ std::string& operator+=(std::string& s, unsigned int o) throw(std::bad_exception @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, unsigned long o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, unsigned long o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -411,7 +432,8 @@ std::string& operator+=(std::string& s, unsigned long o) throw(std::bad_exceptio @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, signed short o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, signed short o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -426,7 +448,8 @@ std::string& operator+=(std::string& s, signed short o) throw(std::bad_exception @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, signed int o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, signed int o) + throw(std::bad_exception) { return s+=mrw::string(o); } @@ -441,7 +464,8 @@ std::string& operator+=(std::string& s, signed int o) throw(std::bad_exception) @param o the value to append to @c s @pre #include */ -std::string& operator+=(std::string& s, signed long o) throw(std::bad_exception) { +inline std::string& operator+=(std::string& s, signed long o) + throw(std::bad_exception) { return s+=mrw::string(o); }