Commit ee54faba3f8aebb23e3d26308391d22058cf74e2

Authored by knodlseder
1 parent 7a78cd5d

add str() method

include/GTools.hpp
... ... @@ -48,13 +48,14 @@ const double pc2cm = 3.08568025e18;
48 48 std::string strip_whitespace(const std::string& arg);
49 49 std::string strip_chars(const std::string& arg,
50 50 const std::string& chars);
51   -std::string str(const short& value);
52   -std::string str(const unsigned short& value);
53   -std::string str(const int& value);
  51 +std::string str(const unsigned short int& value);
54 52 std::string str(const unsigned int& value);
55   -std::string str(const long& value);
56   -std::string str(const unsigned long& value);
57   -std::string str(const long long& value);
  53 +std::string str(const unsigned long int& value);
  54 +std::string str(const unsigned long long int& value);
  55 +std::string str(const short int& value);
  56 +std::string str(const int& value);
  57 +std::string str(const long int& value);
  58 +std::string str(const long long int& value);
58 59 std::string str(const float& value);
59 60 std::string str(const double& value);
60 61 char* tochar(const std::string& arg);
... ...
src/support/GTools.cpp
... ... @@ -80,11 +80,11 @@ std::string strip_chars(const std::string& arg, const std::string& chars)
80 80  
81 81  
82 82 /***********************************************************************//**
83   - * @brief Convert short integer value into string
  83 + * @brief Convert unsigned short integer value into string
84 84 *
85   - * @param[in] value Short integer to be converted into string.
  85 + * @param[in] value Unsigned short integer to be converted into string.
86 86 ***************************************************************************/
87   -std::string str(const short& value)
  87 +std::string str(const unsigned short int& value)
88 88 {
89 89 std::ostringstream s_value;
90 90 s_value << value;
... ... @@ -93,11 +93,11 @@ std::string str(const short&amp; value)
93 93  
94 94  
95 95 /***********************************************************************//**
96   - * @brief Convert short unsigned integer value into string
  96 + * @brief Convert unsigned integer value into string
97 97 *
98   - * @param[in] value Short unsigned integer to be converted into string.
  98 + * @param[in] value Unsigned integer to be converted into string.
99 99 ***************************************************************************/
100   -std::string str(const unsigned short& value)
  100 +std::string str(const unsigned int& value)
101 101 {
102 102 std::ostringstream s_value;
103 103 s_value << value;
... ... @@ -106,11 +106,11 @@ std::string str(const unsigned short&amp; value)
106 106  
107 107  
108 108 /***********************************************************************//**
109   - * @brief Convert integer value into string
  109 + * @brief Convert unsigned long integer value into string
110 110 *
111   - * @param[in] value Integer to be converted into string.
  111 + * @param[in] value Unsigned long integer to be converted into string.
112 112 ***************************************************************************/
113   -std::string str(const int& value)
  113 +std::string str(const unsigned long int& value)
114 114 {
115 115 std::ostringstream s_value;
116 116 s_value << value;
... ... @@ -119,11 +119,11 @@ std::string str(const int&amp; value)
119 119  
120 120  
121 121 /***********************************************************************//**
122   - * @brief Convert unsigned integer value into string
  122 + * @brief Convert unsigned long long integer value into string
123 123 *
124   - * @param[in] value Unsigned integer to be converted into string.
  124 + * @param[in] value Unsigned long long integer to be converted into string.
125 125 ***************************************************************************/
126   -std::string str(const unsigned int& value)
  126 +std::string str(const unsigned long long int& value)
127 127 {
128 128 std::ostringstream s_value;
129 129 s_value << value;
... ... @@ -132,11 +132,11 @@ std::string str(const unsigned int&amp; value)
132 132  
133 133  
134 134 /***********************************************************************//**
135   - * @brief Convert long integer value into string
  135 + * @brief Convert short integer value into string
136 136 *
137   - * @param[in] value Long integer to be converted into string.
  137 + * @param[in] value Short integer to be converted into string.
138 138 ***************************************************************************/
139   -std::string str(const long& value)
  139 +std::string str(const short int& value)
140 140 {
141 141 std::ostringstream s_value;
142 142 s_value << value;
... ... @@ -145,11 +145,24 @@ std::string str(const long&amp; value)
145 145  
146 146  
147 147 /***********************************************************************//**
148   - * @brief Convert long unsigned integer value into string
  148 + * @brief Convert integer value into string
149 149 *
150   - * @param[in] value Long unsigned integer to be converted into string.
  150 + * @param[in] value Integer to be converted into string.
  151 + ***************************************************************************/
  152 +std::string str(const int& value)
  153 +{
  154 + std::ostringstream s_value;
  155 + s_value << value;
  156 + return s_value.str();
  157 +}
  158 +
  159 +
  160 +/***********************************************************************//**
  161 + * @brief Convert long integer value into string
  162 + *
  163 + * @param[in] value Long integer to be converted into string.
151 164 ***************************************************************************/
152   -std::string str(const unsigned long& value)
  165 +std::string str(const long int& value)
153 166 {
154 167 std::ostringstream s_value;
155 168 s_value << value;
... ... @@ -162,7 +175,7 @@ std::string str(const unsigned long&amp; value)
162 175 *
163 176 * @param[in] value Long long integer to be converted into string.
164 177 ***************************************************************************/
165   -std::string str(const long long& value)
  178 +std::string str(const long long int& value)
166 179 {
167 180 std::ostringstream s_value;
168 181 s_value << value;
... ...