diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-25 13:24:11 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-25 13:24:11 (GMT) |
commit | 567df9318fff6d1bb570191c33ea68cd6ef88bee (patch) | |
tree | 72e310c422cea117abe859a6bddf0b613a2db589 /src/uscxml/Convenience.h | |
parent | be3c180fec71866a91b5f9297708d581bc1d6435 (diff) | |
download | uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.zip uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.tar.gz uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.tar.bz2 |
More work on IMInvoker, renamed Blob attributes and some XPath datamodel fixes
Diffstat (limited to 'src/uscxml/Convenience.h')
-rw-r--r-- | src/uscxml/Convenience.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/uscxml/Convenience.h b/src/uscxml/Convenience.h new file mode 100644 index 0000000..ad45e2c --- /dev/null +++ b/src/uscxml/Convenience.h @@ -0,0 +1,33 @@ +#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); + } + +} + + +#endif /* end of include guard: CONVENIENCE_H_LU7GZ6CB */ |