X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fstlplus%2Fstrings%2Fprint_int.hpp;h=d09ef70c769886068e4f0b6a5ae0b559f827dc3f;hp=4f9729373b9043386b01a96853f137e6242de4a3;hb=5846afb00833cc72fe72422ca896d2387c712cb4;hpb=a97500609dc3c1b11f9786d32bc458eb00de4c36 diff --git a/src/stlplus/strings/print_int.hpp b/src/stlplus/strings/print_int.hpp index 4f97293..d09ef70 100644 --- a/src/stlplus/strings/print_int.hpp +++ b/src/stlplus/strings/print_int.hpp @@ -1,81 +1,81 @@ -#ifndef STLPLUS_PRINT_INT -#define STLPLUS_PRINT_INT -//////////////////////////////////////////////////////////////////////////////// - -// Author: Andy Rushton -// Copyright: (c) Southampton University 1999-2004 -// (c) Andy Rushton 2004-2009 -// License: BSD License, see ../docs/license.html - -// Print integer types - -// This extends the formatting available from iostream - -//////////////////////////////////////////////////////////////////////////////// -#include "strings_fixes.hpp" -#include "format_types.hpp" -#include -#include - -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 - - void print_short(std::ostream& device, short i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - void print_unsigned_short(std::ostream& device, unsigned short i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - void print_int(std::ostream& device, int i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - void print_unsigned(std::ostream& device, unsigned i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - void print_long(std::ostream& device, long i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - void print_unsigned_long(std::ostream& device, unsigned long i, - unsigned radix = 10, - radix_display_t display = radix_c_style_or_hash, - unsigned width = 0) - throw(std::invalid_argument); - - //////////////////////////////////////////////////////////////////////////////// - -} // end namespace stlplus - -#endif +#ifndef STLPLUS_PRINT_INT +#define STLPLUS_PRINT_INT +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004-2009 +// License: BSD License, see ../docs/license.html + +// Print integer types + +// This extends the formatting available from iostream + +//////////////////////////////////////////////////////////////////////////////// +#include "strings_fixes.hpp" +#include "format_types.hpp" +#include +#include + +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 + + void print_short(std::ostream& device, short i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + void print_unsigned_short(std::ostream& device, unsigned short i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + void print_int(std::ostream& device, int i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + void print_unsigned(std::ostream& device, unsigned i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + void print_long(std::ostream& device, long i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + void print_unsigned_long(std::ostream& device, unsigned long i, + unsigned radix = 10, + radix_display_t display = radix_c_style_or_hash, + unsigned width = 0) + throw(std::invalid_argument); + + //////////////////////////////////////////////////////////////////////////////// + +} // end namespace stlplus + +#endif