]> Dogcows Code - chaz/yoink/blob - src/stlplus/strings/format_types.hpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / format_types.hpp
1 #ifndef STLPLUS_FORMAT_TYPES
2 #define STLPLUS_FORMAT_TYPES
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 // A Set of enumerations controlling the string formatting of numbers.
11
12 ////////////////////////////////////////////////////////////////////////////////
13
14 ////////////////////////////////////////////////////////////////////////////////
15 // Integer radix display representations:
16 // There are three ways in which the radix is represented:
17 // - none - the number is just printed as a number (e.g. 12345). Can be confusing for non-decimal radix
18 // - C style - for binary, octal and hex, the C-style prefices 0b, 0 and 0x are used
19 // note that this is an unsigned representation
20 // - Hash style - in the form radix#value - the value may be signed, e.g. 10#-9
21
22 enum radix_display_t
23 {
24 radix_none, // just print the number with no radix indicated
25 radix_hash_style, // none for decimal, hash style for all others
26 radix_hash_style_all, // hash style for all radices including decimal
27 radix_c_style, // C style for hex and octal, none for others
28 radix_c_style_or_hash // C style for hex and octal, none for decimal, hash style for others
29 };
30
31 ////////////////////////////////////////////////////////////////////////////////
32 // Floating-point display representations:
33 // There are three formats for the printout:
34 // - fixed - formatted as a fixed-point number, so no mantissa is printed (equivalent to %f in printf)
35 // - floating - formatted as a normalised floating-point number (equivalent to %e in printf)
36 // - mixed - formatted as fixed-point if appropriate, otherwise the floating format (equivalent to %g in printf)
37
38 enum real_display_t
39 {
40 display_fixed, // %f
41 display_floating, // %e
42 display_mixed // %g
43 };
44
45 ////////////////////////////////////////////////////////////////////////////////
46 // Alignment:
47 // There are three field alignments:
48 // - left aligned - the value is to the left of the field which is padded to the right with spaces
49 // - right aligned - the value is to the right of the field which is padded to the left with spaces
50 // - centred - the value is in the centre of the field and spaces added to both left and right
51
52 enum alignment_t
53 {
54 align_left,
55 align_right,
56 align_centre
57 };
58
59 ////////////////////////////////////////////////////////////////////////////////
60 #endif
This page took 0.036712 seconds and 4 git commands to generate.