-
Notifications
You must be signed in to change notification settings - Fork 250
/
Copy pathbase_64_encoded_output.cpp
41 lines (32 loc) · 1.12 KB
/
base_64_encoded_output.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Suneth Warnakulasuriya
//
// System includes
// External includes
// Project includes
#include "input_output/base_64_encoded_output.h"
namespace Kratos
{
Base64EncodedOutput::~Base64EncodedOutput()
{
const IndexType padding = 3 - mByteTripletIndex;
// Check if there are remaining bytes and padding needs to be added
if (padding != 0 && mByteTripletIndex != 0) {
// Fill the remaining bytes with null characters
for (; mByteTripletIndex < 3; ++mByteTripletIndex) {
mByteTriplet[mByteTripletIndex] = '\0';
}
// Encode the remaining byte triplet and write it to the output stream
EncodeTriplet(mrOStream, mByteTriplet, padding);
}
mByteTripletIndex = 0; // Reset the byte triplet index for future encoding operations
}
} // namespace Kratos