diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-16 18:35:17 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-16 18:35:17 (GMT) |
commit | 60c543c1d8c6699cc96829f15b16ecc60ac0b410 (patch) | |
tree | f0087f620d45246acf0268da539cb815796d88c0 /src/uscxml/Convenience.h | |
parent | 4d186e24e44fe07f04708c2dc38387534c02c7fd (diff) | |
download | uscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.zip uscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.tar.gz uscxml-60c543c1d8c6699cc96829f15b16ecc60ac0b410.tar.bz2 |
Added license information and bug fixes
Diffstat (limited to 'src/uscxml/Convenience.h')
-rw-r--r-- | src/uscxml/Convenience.h | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/src/uscxml/Convenience.h b/src/uscxml/Convenience.h index ad45e2c..b2b437c 100644 --- a/src/uscxml/Convenience.h +++ b/src/uscxml/Convenience.h @@ -1,32 +1,51 @@ +/** + * @file + * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + #ifndef CONVENIENCE_H_LU7GZ6CB #define CONVENIENCE_H_LU7GZ6CB namespace uscxml { - inline bool isnan(double x) { - return x != x; - } - - // see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c - template <typename T> std::string toStr(T tmp) { - std::ostringstream out; - out.precision(std::numeric_limits<double>::digits10 + 1); - out << tmp; - return out.str(); - } - - template <typename T> T strTo(std::string tmp) { - T output; - std::istringstream in(tmp); - in >> output; - return output; - } - - inline bool isNumeric( const char* pszInput, int nNumberBase) { - std::string base = ".-0123456789ABCDEF"; - std::string input = pszInput; - return (input.find_first_not_of(base.substr(0, nNumberBase + 2)) == std::string::npos); - } - +inline bool isnan(double x) { + return x != x; +} + +// see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c +template <typename T> std::string toStr(T tmp) { + std::ostringstream out; + out.precision(std::numeric_limits<double>::digits10 + 1); + out << tmp; + return out.str(); +} + +template <typename T> T strTo(std::string tmp) { + T output; + std::istringstream in(tmp); + in >> output; + return output; +} + +inline bool isNumeric( const char* pszInput, int nNumberBase) { + std::string base = ".-0123456789ABCDEF"; + std::string input = pszInput; + return (input.find_first_not_of(base.substr(0, nNumberBase + 2)) == std::string::npos); +} + } |