]>
Dogcows Code - chaz/yoink/blob - src/stlplus/strings/print_int.hpp
1 #ifndef STLPLUS_PRINT_INT
2 #define STLPLUS_PRINT_INT
3 ////////////////////////////////////////////////////////////////////////////////
5 // Author: Andy Rushton
6 // Copyright: (c) Southampton University 1999-2004
7 // (c) Andy Rushton 2004-2009
8 // License: BSD License, see ../docs/license.html
10 // Print integer types
12 // This extends the formatting available from iostream
14 ////////////////////////////////////////////////////////////////////////////////
15 #include "strings_fixes.hpp"
16 #include "format_types.hpp"
23 ////////////////////////////////////////////////////////////////////////////////
24 // Conversions of Integer types to string
25 ////////////////////////////////////////////////////////////////////////////////
27 // The radix (i.e. base) for these conversions can be any value from base 2 to base 36
28 // specifying any other radix causes std::invalid_argument to be thrown
30 // The way in which the radix is displayed is defined in radix_types.hpp
31 // If any other value is used, std::invalid_argument is thrown
33 // The width argument specifies the number of numerical digits to use in the result
34 // This is a minimum - if the value requires more digits then it will be wider than the width argument
35 // However, if it is smaller, then it will be extended to the specified width
36 // Then, the radix display prefix is added to this width
38 // For example, using the hash representation of 0 in hex with width=4 gives:
39 // 16#0000 - so there's 4 digits in the number part
41 void print_short(std::ostream
& device
, short i
,
43 radix_display_t display
= radix_c_style_or_hash
,
45 throw(std::invalid_argument
);
47 void print_unsigned_short(std::ostream
& device
, unsigned short i
,
49 radix_display_t display
= radix_c_style_or_hash
,
51 throw(std::invalid_argument
);
53 void print_int(std::ostream
& device
, int i
,
55 radix_display_t display
= radix_c_style_or_hash
,
57 throw(std::invalid_argument
);
59 void print_unsigned(std::ostream
& device
, unsigned i
,
61 radix_display_t display
= radix_c_style_or_hash
,
63 throw(std::invalid_argument
);
65 void print_long(std::ostream
& device
, long i
,
67 radix_display_t display
= radix_c_style_or_hash
,
69 throw(std::invalid_argument
);
71 void print_unsigned_long(std::ostream
& device
, unsigned long i
,
73 radix_display_t display
= radix_c_style_or_hash
,
75 throw(std::invalid_argument
);
77 ////////////////////////////////////////////////////////////////////////////////
79 } // end namespace stlplus
This page took 0.035297 seconds and 4 git commands to generate.