| 1 |
< |
/* |
| 1 |
> |
/* |
| 2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
| 3 |
|
* |
| 4 |
|
* The University of Notre Dame grants you ("Licensee") a |
| 55 |
|
|
| 56 |
|
namespace oopse { |
| 57 |
|
|
| 58 |
– |
|
| 58 |
|
/** |
| 59 |
|
* Converts a string to UPPER CASE |
| 60 |
|
* @param S |
| 109 |
|
* @param v data to be converted |
| 110 |
|
* @return a string |
| 111 |
|
*/ |
| 112 |
< |
template<typename T> |
| 113 |
< |
std::string toString(const T& v) { |
| 114 |
< |
std::ostringstream oss; |
| 115 |
< |
T result; |
| 116 |
< |
|
| 118 |
< |
oss << v; |
| 119 |
< |
return oss.str(); |
| 112 |
> |
template<typename T> |
| 113 |
> |
std::string toString(const T& v) { |
| 114 |
> |
std::ostringstream oss; |
| 115 |
> |
if (!oss << v) { |
| 116 |
> |
std::cerr << "toString Error" << std::endl; |
| 117 |
|
} |
| 118 |
+ |
return oss.str(); |
| 119 |
+ |
} |
| 120 |
+ |
|
| 121 |
+ |
template<typename T> |
| 122 |
+ |
T lexi_cast(const std::string& str) { |
| 123 |
+ |
T result; |
| 124 |
+ |
std::istringstream iss(str); |
| 125 |
+ |
if (!(iss >> result)) { |
| 126 |
+ |
std::cerr << "lexi_cast Error" << std::endl; |
| 127 |
+ |
} |
| 128 |
+ |
return result; |
| 129 |
+ |
} |
| 130 |
+ |
|
| 131 |
+ |
std::string OOPSE_itoa(int value, unsigned int base); |
| 132 |
+ |
|
| 133 |
+ |
/**@todo need implementation */ |
| 134 |
+ |
std::string getPrefix(const std::string& str); |
| 135 |
+ |
|
| 136 |
+ |
/**@todo need implementation */ |
| 137 |
+ |
std::string getSuffix(const std::string& str); |
| 138 |
+ |
|
| 139 |
+ |
|
| 140 |
|
|
| 141 |
< |
/**@todo need implementation */ |
| 142 |
< |
std::string getPrefix(const std::string& str); |
| 124 |
< |
|
| 125 |
< |
/**@todo need implementation */ |
| 126 |
< |
std::string getSuffix(const std::string& str); |
| 127 |
< |
|
| 128 |
< |
} |
| 129 |
< |
|
| 141 |
> |
|
| 142 |
> |
} |
| 143 |
|
#endif |