tlx
Toggle main menu visibility
Loading...
Searching...
No Matches
parse_si_iec_units.hpp
Go to the documentation of this file.
1
/*******************************************************************************
2
* tlx/string/parse_si_iec_units.hpp
3
*
4
* Part of tlx - http://panthema.net/tlx
5
*
6
* Copyright (C) 2016-2017 Timo Bingmann <tb@panthema.net>
7
*
8
* All rights reserved. Published under the Boost Software License, Version 1.0
9
******************************************************************************/
10
11
#ifndef TLX_STRING_PARSE_SI_IEC_UNITS_HEADER
12
#define TLX_STRING_PARSE_SI_IEC_UNITS_HEADER
13
14
#include <cstdint>
15
#include <string>
16
17
namespace
tlx
{
18
19
//! \addtogroup tlx_string
20
//! \{
21
22
/*!
23
* Parse a string like "343KB" or "44 GiB" into the corresponding size in
24
* bytes. Returns the number of bytes and sets ok = true if the string could be
25
* parsed correctly. If no units indicator is given, use def_unit in k/m/g/t/p
26
* (powers of ten) or in K/M/G/T/P (power of two).
27
*/
28
bool
parse_si_iec_units
(
29
const
char
* str, std::uint64_t* out_size,
char
default_unit = 0);
30
31
/*!
32
* Parse a string like "343KB" or "44 GiB" into the corresponding size in
33
* bytes. Returns the number of bytes and sets ok = true if the string could be
34
* parsed correctly. If no units indicator is given, use def_unit in k/m/g/t/p
35
* (powers of ten) or in K/M/G/T/P (power of two).
36
*/
37
bool
parse_si_iec_units
(
38
const
std::string& str, std::uint64_t* out_size,
char
default_unit = 0);
39
40
//! \}
41
42
}
// namespace tlx
43
44
#endif
// !TLX_STRING_PARSE_SI_IEC_UNITS_HEADER
45
46
/******************************************************************************/
tlx::parse_si_iec_units
bool parse_si_iec_units(const char *str, std::uint64_t *out_size, char default_unit)
Parse a string like "343KB" or "44 GiB" into the corresponding size in bytes.
Definition
parse_si_iec_units.cpp:18
tlx
Definition
exclusive_scan.hpp:17
tlx
string
parse_si_iec_units.hpp
Generated on
for tlx by
1.17.0