MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / base64

Function base64

src/ifcparse/IfcGlobalId.cpp:36–49  ·  view source on GitHub ↗

Converts an unsigned integer into a base64 string of length l

Source from the content-addressed store, hash-verified

34
35// Converts an unsigned integer into a base64 string of length l
36std::string base64(unsigned value, int length) {
37 const int BASE64 = 64;
38 std::string result;
39 result.reserve(length);
40 while (value != 0U) {
41 result.push_back(chars[value % BASE64]);
42 value /= BASE64;
43 }
44 while ((int)result.size() != length) {
45 result.push_back('0');
46 }
47 std::reverse(result.begin(), result.end());
48 return result;
49}
50
51// Converts a base64 string into an unsigned integer
52unsigned from_base64(const std::string& string) {

Callers 1

compressFunction · 0.85

Calls 6

reverseFunction · 0.85
reserveMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected