]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/strings/print_int.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / print_int.hpp
diff --git a/src/stlplus/strings/print_int.hpp b/src/stlplus/strings/print_int.hpp
new file mode 100644 (file)
index 0000000..4f97293
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef STLPLUS_PRINT_INT\r
+#define STLPLUS_PRINT_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
+//   Print integer types\r
+\r
+//   This extends the formatting available from iostream\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "strings_fixes.hpp"\r
+#include "format_types.hpp"\r
+#include <iostream>\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
+  void print_short(std::ostream& device, 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
+  void print_unsigned_short(std::ostream& device, 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
+  void print_int(std::ostream& device, 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
+  void print_unsigned(std::ostream& device, 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
+  void print_long(std::ostream& device, 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
+  void print_unsigned_long(std::ostream& device, 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
+\r
+} // end namespace stlplus\r
+\r
+#endif\r
This page took 0.025005 seconds and 4 git commands to generate.