CBMC
format_spec.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
10
#ifndef CPROVER_UTIL_FORMAT_SPEC_H
11
#define CPROVER_UTIL_FORMAT_SPEC_H
12
13
// this mimics the 'printf' format string for a single 'directive'
14
15
class
format_spect
16
{
17
public
:
18
unsigned
min_width
;
19
unsigned
precision
;
20
bool
zero_padding
;
21
22
// 'printf' equivalents:
23
// fF: DECIMAL
24
// eE: SCIENTIFIC
25
// gG: AUTOMATIC
26
27
enum class
stylet
{
DECIMAL
,
SCIENTIFIC
,
AUTOMATIC
};
28
stylet
style
;
29
30
format_spect
():
31
min_width
(0),
32
precision
(6),
33
zero_padding
(false),
34
style
(
stylet
::AUTOMATIC)
35
{
36
}
37
38
explicit
format_spect
(
stylet
_style):
39
min_width
(0),
40
precision
(6),
41
zero_padding
(false),
42
style
(_style)
43
{
44
}
45
46
static
format_spect
scientific
()
47
{
48
return
format_spect
(
stylet::SCIENTIFIC
);
49
}
50
51
static
format_spect
automatic
()
52
{
53
return
format_spect
(
stylet::AUTOMATIC
);
54
}
55
};
56
57
#endif
// CPROVER_UTIL_FORMAT_SPEC_H
format_spect
Definition:
format_spec.h:16
format_spect::format_spect
format_spect(stylet _style)
Definition:
format_spec.h:38
format_spect::stylet
stylet
Definition:
format_spec.h:27
format_spect::stylet::AUTOMATIC
@ AUTOMATIC
format_spect::stylet::DECIMAL
@ DECIMAL
format_spect::stylet::SCIENTIFIC
@ SCIENTIFIC
format_spect::style
stylet style
Definition:
format_spec.h:28
format_spect::format_spect
format_spect()
Definition:
format_spec.h:30
format_spect::zero_padding
bool zero_padding
Definition:
format_spec.h:20
format_spect::precision
unsigned precision
Definition:
format_spec.h:19
format_spect::min_width
unsigned min_width
Definition:
format_spec.h:18
format_spect::automatic
static format_spect automatic()
Definition:
format_spec.h:51
format_spect::scientific
static format_spect scientific()
Definition:
format_spec.h:46
src
util
format_spec.h
Generated by
1.9.1