Convenience.h
Go to the documentation of this file.
1 
20 #ifndef CONVENIENCE_H_LU7GZ6CB
21 #define CONVENIENCE_H_LU7GZ6CB
22 
23 #include "uscxml/Common.h"
24 #include <string>
25 #include <limits>
26 #include <sstream>
27 
28 namespace uscxml {
29 inline bool isnan(double x);
30 
31 // see http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c
32 template <typename T> std::string toStr(T tmp) {
33  std::ostringstream outSS;
34  outSS.precision(std::numeric_limits<double>::digits10 + 1);
35  outSS << tmp;
36  return outSS.str();
37 }
38 
39 template <typename T> T strTo(std::string tmp) {
40  T output;
41  std::istringstream in(tmp);
42  in >> output;
43  return output;
44 }
45 
46 class USCXML_API NumAttr {
47 public:
48  NumAttr(const std::string& str);
49  std::string value;
50  std::string unit;
51 };
52 
53 bool isNumeric(const char* pszInput, int nNumberBase);
54 bool isInteger( const char* pszInput, int nNumberBase);
55 bool iequals(const std::string& a, const std::string& b);
56 bool equals(const std::string& a, const std::string& b);
57 bool stringIsTrue(const std::string& value);
58 bool envVarIsTrue(const char* name);
59 bool envVarIEquals(const char* name, const char* value);
60 
61 std::string escape(const std::string& a);
62 std::string unescape(const std::string& a);
63 
64 }
65 #endif /* end of include guard: CONVENIENCE_H_LU7GZ6CB */
Definition: Breakpoint.cpp:26
Definition: Convenience.h:46