|
fw4spl
|
Conversion helper for size in bytes Converts string to number of bytes and vice-versa. This class is also able to manage conversions between units standards (IEC, SI) More...
#include <ByteSize.hpp>
Collaboration diagram for fwMemory::ByteSize:Public Types | |
| enum | StandardType { SI, IEC } |
| typedef std::uint64_t | SizeType |
| typedef std::uint64_t | UnitType |
Public Member Functions | |
| FWMEMORY_API | ByteSize () |
| Default constructor. | |
| FWMEMORY_API | ByteSize (double size, UnitType unit=Bytes) |
| Build a ByteSize object from given size and unit. | |
| FWMEMORY_API | ByteSize (const std::string &size) |
| Build a ByteSize object from given string. | |
| FWMEMORY_API std::string | getSizeAsString (UnitType unit=Bytes) |
| Convert this size to a string with specified unit. More... | |
| FWMEMORY_API std::string | getHumanReadableSize (StandardType standard=IEC) |
| Convert this size to a human readable string in the required Convert this size to a human readable string in the required standard. The unit will be chosen to make the numeric value fit in [0; 1024[ when possible. More... | |
| SizeType | getSize () |
| Returns size in bytes. | |
| FWMEMORY_API void | setSize (double size, UnitType unit=Bytes) |
| Build a ByteSize object from given size and unit. | |
| FWMEMORY_API void | setSize (const std::string &size) |
| Build a ByteSize object from given string. | |
| FWMEMORY_API ByteSize & | operator= (SizeType size) |
| FWMEMORY_API ByteSize & | operator= (double size) |
| FWMEMORY_API ByteSize & | operator= (const std::string &size) |
| template<typename T > | |
| ByteSize & | operator= (T size) |
| operator SizeType () | |
| operator std::string () | |
| FWMEMORY_API | ByteSize (SizeType size, UnitType unit=Bytes) |
| Build a ByteSize object from given size and unit. | |
| template<typename T > | |
| ByteSize (T size, UnitType unit=Bytes) | |
| Build a ByteSize object from given size and unit. | |
| FWMEMORY_API void | setSize (SizeType size, UnitType unit=Bytes) |
| Build a ByteSize object from given size and unit. | |
| template<typename T > | |
| void | setSize (T size, UnitType unit=Bytes) |
| Build a ByteSize object from given size and unit. | |
Static Public Member Functions | |
| static FWMEMORY_API bool | parseSize (const std::string &s, std::uint64_t &size) |
| static FWMEMORY_API std::string | unitToString (UnitType unit) |
Protected Attributes | |
| SizeType | m_size |
Conversion helper for size in bytes Converts string to number of bytes and vice-versa. This class is also able to manage conversions between units standards (IEC, SI)
Definition at line 25 of file ByteSize.hpp.
| std::string fwMemory::ByteSize::getHumanReadableSize | ( | StandardType | standard = IEC | ) |
Convert this size to a human readable string in the required Convert this size to a human readable string in the required standard. The unit will be chosen to make the numeric value fit in [0; 1024[ when possible.
| standard | Wanted set of unit |
Definition at line 278 of file ByteSize.cpp.
References getSizeAsString().
Here is the call graph for this function:| std::string fwMemory::ByteSize::getSizeAsString | ( | UnitType | unit = Bytes | ) |
Convert this size to a string with specified unit.
| unit | Unit to convert this size to. |
Definition at line 255 of file ByteSize.cpp.
References SLM_ASSERT.
Referenced by getHumanReadableSize().
Here is the caller graph for this function: