]> Dogcows Code - chaz/yoink/blob - src/stlplus/strings/print_int.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / print_int.hpp
1 #ifndef STLPLUS_PRINT_INT
2 #define STLPLUS_PRINT_INT
3 ////////////////////////////////////////////////////////////////////////////////
4
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
9
10 // Print integer types
11
12 // This extends the formatting available from iostream
13
14 ////////////////////////////////////////////////////////////////////////////////
15 #include "strings_fixes.hpp"
16 #include "format_types.hpp"
17 #include <iostream>
18 #include <stdexcept>
19
20 namespace stlplus
21 {
22
23 ////////////////////////////////////////////////////////////////////////////////
24 // Conversions of Integer types to string
25 ////////////////////////////////////////////////////////////////////////////////
26
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
29
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
32
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
37
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
40
41 void print_short(std::ostream& device, short i,
42 unsigned radix = 10,
43 radix_display_t display = radix_c_style_or_hash,
44 unsigned width = 0)
45 throw(std::invalid_argument);
46
47 void print_unsigned_short(std::ostream& device, unsigned short i,
48 unsigned radix = 10,
49 radix_display_t display = radix_c_style_or_hash,
50 unsigned width = 0)
51 throw(std::invalid_argument);
52
53 void print_int(std::ostream& device, int i,
54 unsigned radix = 10,
55 radix_display_t display = radix_c_style_or_hash,
56 unsigned width = 0)
57 throw(std::invalid_argument);
58
59 void print_unsigned(std::ostream& device, unsigned i,
60 unsigned radix = 10,
61 radix_display_t display = radix_c_style_or_hash,
62 unsigned width = 0)
63 throw(std::invalid_argument);
64
65 void print_long(std::ostream& device, long i,
66 unsigned radix = 10,
67 radix_display_t display = radix_c_style_or_hash,
68 unsigned width = 0)
69 throw(std::invalid_argument);
70
71 void print_unsigned_long(std::ostream& device, unsigned long i,
72 unsigned radix = 10,
73 radix_display_t display = radix_c_style_or_hash,
74 unsigned width = 0)
75 throw(std::invalid_argument);
76
77 ////////////////////////////////////////////////////////////////////////////////
78
79 } // end namespace stlplus
80
81 #endif
This page took 0.035149 seconds and 4 git commands to generate.