MikroCAD SDK Library
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DataConvert.h
Go to the documentation of this file.
1 /**
2 * @file DataConvert.h
3 * @brief Class for converting between strings and numbers
4 *
5 * @author LMI Technologies
6 */
7 
8 #ifndef _DataConvert_h
9 #define _DataConvert_h
10 
11 #include <string>
12 
13 using namespace std;
14 
15 /**
16 Class for data conversations
17 */
19 {
20 public:
21 
22  /**
23  wstring -> long conversion
24 
25  @param stValue Value as wstring
26  @param lValue Output value as long
27  @return Success
28  */
29  static bool StringToLong(wstring stValue, long& lValue);
30 
31  /**
32  string -> long conversion
33 
34  @param stValue Value as string
35  @param lValue Output value as long
36  @return Success
37  */
38  static bool StringToLong(string stValue, long& lValue);
39 
40  /**
41  wstring -> unsigned long conversion
42 
43  @param stValue Value as wstring
44  @param lValue Output value as unsigned long
45  @return Success
46  */
47  static bool StringToDWord(wstring stValue, unsigned long& lValue);
48 
49  /**
50  string -> unsigned long conversion
51 
52  @param stValue Value as string
53  @param dwValue Output value as unsigned long
54  @return Success
55  */
56  static bool StringToDWord(string stValue, unsigned long& dwValue);
57 
58  /**
59  wstring -> double conversion
60 
61  @param stValue Value as wstring
62  @param dValue Output value as double
63  @return Success
64  */
65  static bool StringToDouble(wstring stValue, double& dValue);
66 
67  /**
68  string -> double conversion
69 
70  @param stValue Value as string
71  @param dValue Output value as double
72  @return Success
73  */
74  static bool StringToDouble(string stValue, double& dValue);
75 
76  /**
77  long -> wstring conversion
78 
79  @param lValue Value as long
80  @param lSize Length, if greater than zero filled with leading zeros
81  @return Value as wstring
82  */
83  static wstring LongToWString(long lValue, long lSize = -1);
84 
85  /**
86  long -> string conversion
87 
88  @param lValue Value as long
89  @param lSize Length, if greater than zero filled with leading zeros
90  @return Value as string
91  */
92  static string LongToString(long lValue, long lSize = -1);
93 
94  /**
95  unsigned long -> wstring conversion
96 
97  @param dwValue Value as unsigned long
98  @param lSize Length, if greater than zero filled with leading zeros
99  @return Value as wstring
100  */
101  static wstring DWordToWString(unsigned long dwValue, long lSize = -1);
102 
103  /**
104  unsigned long -> string conversion
105 
106  @param dwValue Value as unsigned long
107  @param lSize Length, if greater than zero filled with leading zeros
108  @return Value as string
109  */
110  static string DWordToString(unsigned long dwValue, long lSize = -1);
111 
112  /**
113  double -> wstring conversion
114 
115  @param dValue Value as double
116  @param stFormat Format-String
117  @return Value as wstring
118  */
119  static wstring DoubleToWString(double dValue, wstring stFormat = L"%g");
120 
121  /**
122  double -> string conversion
123 
124  @param dValue Value as double
125  @param stFormat Format-String
126  @return Value as string
127  */
128  static string DoubleToString(double dValue, string stFormat = "%g");
129 };
130 
131 #endif // _DataConvert_h
Class for data conversations.
Definition: DataConvert.h:18