]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/strings/string_int.hpp
cleanup stlplus files
[chaz/yoink] / src / stlplus / strings / string_int.hpp
index a45b9821e045de285e6be5329dd37760bbf2f442..af790986780e2ec06bb37de72ac215f7130247ee 100644 (file)
-#ifndef STLPLUS_STRING_INT\r
-#define STLPLUS_STRING_INT\r
-////////////////////////////////////////////////////////////////////////////////\r
-\r
-//   Author:    Andy Rushton\r
-//   Copyright: (c) Southampton University 1999-2004\r
-//              (c) Andy Rushton           2004-2009\r
-//   License:   BSD License, see ../docs/license.html\r
-\r
-//   Convert integer types to/from string\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-#include "strings_fixes.hpp"\r
-#include "format_types.hpp"\r
-#include <string>\r
-#include <stdexcept>\r
-\r
-namespace stlplus\r
-{\r
-\r
-  ////////////////////////////////////////////////////////////////////////////////\r
-  // Conversions of Integer types to string\r
-  ////////////////////////////////////////////////////////////////////////////////\r
-\r
-  // The radix (i.e. base) for these conversions can be any value from base 2 to base 36\r
-  // specifying any other radix causes std::invalid_argument to be thrown\r
-\r
-  // The way in which the radix is displayed is defined in radix_types.hpp\r
-  // If any other value is used, std::invalid_argument is thrown\r
-\r
-  // The width argument specifies the number of numerical digits to use in the result\r
-  // This is a minimum - if the value requires more digits then it will be wider than the width argument\r
-  // However, if it is smaller, then it will be extended to the specified width\r
-  // Then, the radix display prefix is added to this width\r
-\r
-  // For example, using the hash representation of 0 in hex with width=4 gives:\r
-  // 16#0000 - so there's 4 digits in the number part\r
-\r
-  std::string short_to_string(short i,\r
-                              unsigned radix = 10,\r
-                              radix_display_t display = radix_c_style_or_hash,\r
-                              unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  std::string unsigned_short_to_string(unsigned short i,\r
-                                       unsigned radix = 10,\r
-                                       radix_display_t display = radix_c_style_or_hash,\r
-                                       unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  std::string int_to_string(int i,\r
-                            unsigned radix = 10,\r
-                            radix_display_t display = radix_c_style_or_hash,\r
-                            unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  std::string unsigned_to_string(unsigned i,\r
-                                 unsigned radix = 10,\r
-                                 radix_display_t display = radix_c_style_or_hash,\r
-                                 unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  std::string long_to_string(long i,\r
-                             unsigned radix = 10,\r
-                             radix_display_t display = radix_c_style_or_hash,\r
-                             unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  std::string unsigned_long_to_string(unsigned long i,\r
-                                      unsigned radix = 10,\r
-                                      radix_display_t display = radix_c_style_or_hash,\r
-                                      unsigned width = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  ////////////////////////////////////////////////////////////////////////////////\r
-  // Convert a string to an integer type\r
-  ////////////////////////////////////////////////////////////////////////////////\r
-  // supports all the formats described above for the reverse conversion\r
-  // If the radix is set to zero, the conversions deduce the radix from the string representation\r
-  // So,\r
-  //   0b prefix is binary,\r
-  //   0 prefix is octal,\r
-  //   0x is hex\r
-  //   <base># prefix is my hash format\r
-  // The radix must be either zero as explained above, or in the range 2 to 16\r
-  // A non-zero radix should be used when the string value has no radix information and is non-decimal\r
-  // e.g. the hex value FEDCBA has no indication that it is hex, so specify radix 16\r
-  // Any other value of radix will cause std::invalid_argument to be thrown\r
-\r
-  short string_to_short(const std::string& value,\r
-                        unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  unsigned short string_to_unsigned_short(const std::string& value,\r
-                                          unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  int string_to_int(const std::string& value,\r
-                    unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  unsigned string_to_unsigned(const std::string& value,\r
-                              unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  long string_to_long(const std::string& value,\r
-                      unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  unsigned long string_to_unsigned_long(const std::string& value,\r
-                                        unsigned radix = 0)\r
-    throw(std::invalid_argument);\r
-\r
-  ////////////////////////////////////////////////////////////////////////////////\r
-\r
-} // end namespace stlplus\r
-\r
-#endif\r
+#ifndef STLPLUS_STRING_INT
+#define STLPLUS_STRING_INT
+////////////////////////////////////////////////////////////////////////////////
+
+//   Author:    Andy Rushton
+//   Copyright: (c) Southampton University 1999-2004
+//              (c) Andy Rushton           2004-2009
+//   License:   BSD License, see ../docs/license.html
+
+//   Convert integer types to/from string
+
+////////////////////////////////////////////////////////////////////////////////
+#include "strings_fixes.hpp"
+#include "format_types.hpp"
+#include <string>
+#include <stdexcept>
+
+namespace stlplus
+{
+
+  ////////////////////////////////////////////////////////////////////////////////
+  // Conversions of Integer types to string
+  ////////////////////////////////////////////////////////////////////////////////
+
+  // The radix (i.e. base) for these conversions can be any value from base 2 to base 36
+  // specifying any other radix causes std::invalid_argument to be thrown
+
+  // The way in which the radix is displayed is defined in radix_types.hpp
+  // If any other value is used, std::invalid_argument is thrown
+
+  // The width argument specifies the number of numerical digits to use in the result
+  // This is a minimum - if the value requires more digits then it will be wider than the width argument
+  // However, if it is smaller, then it will be extended to the specified width
+  // Then, the radix display prefix is added to this width
+
+  // For example, using the hash representation of 0 in hex with width=4 gives:
+  // 16#0000 - so there's 4 digits in the number part
+
+  std::string short_to_string(short i,
+                              unsigned radix = 10,
+                              radix_display_t display = radix_c_style_or_hash,
+                              unsigned width = 0)
+    throw(std::invalid_argument);
+
+  std::string unsigned_short_to_string(unsigned short i,
+                                       unsigned radix = 10,
+                                       radix_display_t display = radix_c_style_or_hash,
+                                       unsigned width = 0)
+    throw(std::invalid_argument);
+
+  std::string int_to_string(int i,
+                            unsigned radix = 10,
+                            radix_display_t display = radix_c_style_or_hash,
+                            unsigned width = 0)
+    throw(std::invalid_argument);
+
+  std::string unsigned_to_string(unsigned i,
+                                 unsigned radix = 10,
+                                 radix_display_t display = radix_c_style_or_hash,
+                                 unsigned width = 0)
+    throw(std::invalid_argument);
+
+  std::string long_to_string(long i,
+                             unsigned radix = 10,
+                             radix_display_t display = radix_c_style_or_hash,
+                             unsigned width = 0)
+    throw(std::invalid_argument);
+
+  std::string unsigned_long_to_string(unsigned long i,
+                                      unsigned radix = 10,
+                                      radix_display_t display = radix_c_style_or_hash,
+                                      unsigned width = 0)
+    throw(std::invalid_argument);
+
+  ////////////////////////////////////////////////////////////////////////////////
+  // Convert a string to an integer type
+  ////////////////////////////////////////////////////////////////////////////////
+  // supports all the formats described above for the reverse conversion
+  // If the radix is set to zero, the conversions deduce the radix from the string representation
+  // So,
+  //   0b prefix is binary,
+  //   0 prefix is octal,
+  //   0x is hex
+  //   <base># prefix is my hash format
+  // The radix must be either zero as explained above, or in the range 2 to 16
+  // A non-zero radix should be used when the string value has no radix information and is non-decimal
+  // e.g. the hex value FEDCBA has no indication that it is hex, so specify radix 16
+  // Any other value of radix will cause std::invalid_argument to be thrown
+
+  short string_to_short(const std::string& value,
+                        unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  unsigned short string_to_unsigned_short(const std::string& value,
+                                          unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  int string_to_int(const std::string& value,
+                    unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  unsigned string_to_unsigned(const std::string& value,
+                              unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  long string_to_long(const std::string& value,
+                      unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  unsigned long string_to_unsigned_long(const std::string& value,
+                                        unsigned radix = 0)
+    throw(std::invalid_argument);
+
+  ////////////////////////////////////////////////////////////////////////////////
+
+} // end namespace stlplus
+
+#endif
This page took 0.027318 seconds and 4 git commands to generate.