Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
format_si_iec_units.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/string/format_si_iec_units.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2016-2017 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_STRING_FORMAT_SI_IEC_UNITS_HEADER
12 #define TLX_STRING_FORMAT_SI_IEC_UNITS_HEADER
13 
14 #include <string>
15 
16 namespace tlx {
17 
18 //! \addtogroup tlx_string
19 //! \{
20 
21 //! Format a byte size using SI (K, M, G, T) suffixes (powers of ten). Returns
22 //! "123 M" or similar.
23 std::string format_si_units(uint64_t number, int precision = 3);
24 
25 //! Format a byte size using IEC (Ki, Mi, Gi, Ti) suffixes (powers of
26 //! two). Returns "123 Ki" or similar.
27 std::string format_iec_units(uint64_t number, int precision = 3);
28 
29 //! \}
30 
31 } // namespace tlx
32 
33 #endif // !TLX_STRING_FORMAT_SI_IEC_UNITS_HEADER
34 
35 /******************************************************************************/
std::string format_si_units(uint64_t number, int precision)
Format number as something like 1 TB.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220
std::string format_iec_units(uint64_t number, int precision)
Format number as something like 1 TiB.