Subversion Repositories HomeAutomation

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * convert.h
  3.  *
  4.  *  Created on: Aug 04, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #ifndef CONVERT_H_
  9. #define CONVERT_H_
  10.  
  11. #include <string>
  12. #include <boost/algorithm/string/case_conv.hpp>
  13. #include "types.h"
  14. #include <fstream>
  15. #include <sstream>
  16. #include <cmath>
  17.  
  18. namespace atom {
  19. namespace convert {
  20.  
  21. using namespace std;
  22. using namespace boost::algorithm;
  23.  
  24. bool string2bool(const string s);
  25. int string2int(const string s);
  26. string int2string(int i);
  27. string uint2string(unsigned int i);
  28. unsigned int string2uint(const string s);
  29. float string2float(const string s);
  30. string float2string(float f);
  31. string bytes2string(byte_list bytes);
  32. unsigned int hex2uint(string hex);
  33. string hex2bin(string hex);
  34. string bin2hex(string bin);
  35. float bin2float(string bin);
  36. string float2bin(float num, unsigned int length);
  37. unsigned int bin2uint(string bin);
  38. string uint2bin(unsigned int num, unsigned int length);
  39. string uint2hex(unsigned int num, unsigned int length);
  40. string bin_invert(string bin);
  41.  
  42. }
  43. }
  44.  
  45. #endif // CONVERT_H_
  46.