libcruft-util/cruft/util/parse/si.hpp

23 lines
546 B
C++
Raw Normal View History

2011-08-29 14:37:47 +10:00
/*
2018-08-04 15:14:06 +10:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2011-08-29 14:37:47 +10:00
*
2019-03-18 14:08:06 +11:00
* Copyright 2019 Danny Robson <danny@nerdcruft.net>
2011-08-29 14:37:47 +10:00
*/
2019-03-18 14:08:06 +11:00
#pragma once
2011-08-29 14:37:47 +10:00
#include "../expected.hpp"
#include "../view.hpp"
2011-08-29 14:37:47 +10:00
2019-03-18 14:08:06 +11:00
#include <system_error>
2011-08-29 14:37:47 +10:00
namespace cruft::parse {
/// Parse a number with an SI suffix. eg, 10K for 10 * 1024
2019-03-18 14:08:06 +11:00
template <typename ValueT>
expected<ValueT, std::errc>
si (cruft::view<char const*>);
2019-03-18 14:08:06 +11:00
}
2011-08-29 14:37:47 +10:00