mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'tmj-dev' into milek-dev
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
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
|
||||
@@ -246,6 +246,24 @@ std::string to_hex_str( int const Value, int const Width )
|
||||
return converter.str();
|
||||
};
|
||||
|
||||
std::string const fractionlabels[] = { " ", u8"¹", u8"²", u8"³", u8"⁴", u8"⁵", u8"⁶", u8"⁷", u8"⁸", u8"⁹" };
|
||||
|
||||
std::string to_minutes_str( float const Minutes, bool const Leadingzero, int const Width ) {
|
||||
|
||||
float minutesintegral;
|
||||
auto const minutesfractional { std::modf( Minutes, &minutesintegral ) };
|
||||
auto const width { Width - 1 };
|
||||
auto minutes = (
|
||||
std::string( width - 1, ' ' )
|
||||
+ ( Leadingzero ?
|
||||
to_string( 100 + minutesintegral ).substr( 1, 2 ) :
|
||||
to_string( minutesintegral, 0 ) ) );
|
||||
return (
|
||||
minutes.substr( minutes.size() - width, width )
|
||||
+ fractionlabels[ static_cast<int>( std::floor( minutesfractional * 10 + 0.1 ) ) ] );
|
||||
}
|
||||
|
||||
|
||||
int stol_def(const std::string &str, const int &DefaultValue) {
|
||||
|
||||
int result { DefaultValue };
|
||||
|
||||
Reference in New Issue
Block a user