MCPcopy Create free account
hub / github.com/comaps/comaps / FormatMapSize

Function FormatMapSize

qt/mainwindow.cpp:63–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61namespace
62{
63void FormatMapSize(uint64_t sizeInBytes, std::string & units, size_t & sizeToDownload)
64{
65 int const mbInBytes = 1024 * 1024;
66 int const kbInBytes = 1024;
67 if (sizeInBytes > mbInBytes)
68 {
69 sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes;
70 units = "MB";
71 }
72 else if (sizeInBytes > kbInBytes)
73 {
74 sizeToDownload = (sizeInBytes + kbInBytes - 1) / kbInBytes;
75 units = "KB";
76 }
77 else
78 {
79 sizeToDownload = sizeInBytes;
80 units = "B";
81 }
82}
83
84template <class T>
85T * CreateBlackControl(QString const & name)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected