[base, thin_ls] factor out disk_units code

This commit is contained in:
Joe Thornber
2016-01-19 11:40:00 +00:00
parent 47bd31da8d
commit 7ce4e451ff
4 changed files with 113 additions and 80 deletions

34
base/disk_units.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef BASE_DISK_UNITS_H
#define BASE_DISK_UNITS_H
#include <string>
//----------------------------------------------------------------
namespace base {
enum disk_unit {
UNIT_BYTE,
UNIT_SECTOR,
// decimal multipliers
UNIT_kB,
UNIT_MB,
UNIT_GB,
UNIT_TB,
UNIT_PB,
// binary multipliers
UNIT_KiB,
UNIT_MiB,
UNIT_GiB,
UNIT_TiB,
UNIT_PiB
};
unsigned long long disk_unit_multiplier(disk_unit u);
std::string format_disk_unit(unsigned long long numerator, disk_unit u);
}
//----------------------------------------------------------------
#endif