VTK  9.1.0
vtkBase64Utilities.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBase64Utilities.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
22#ifndef vtkBase64Utilities_h
23#define vtkBase64Utilities_h
24
25#include "vtkIOCoreModule.h" // For export macro
26#include "vtkObject.h"
27
28class VTKIOCORE_EXPORT vtkBase64Utilities : public vtkObject
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
38 static void EncodeTriplet(unsigned char i0, unsigned char i1, unsigned char i2, unsigned char* o0,
39 unsigned char* o1, unsigned char* o2, unsigned char* o3);
40
44 static void EncodePair(unsigned char i0, unsigned char i1, unsigned char* o0, unsigned char* o1,
45 unsigned char* o2, unsigned char* o3);
46
50 static void EncodeSingle(
51 unsigned char i0, unsigned char* o0, unsigned char* o1, unsigned char* o2, unsigned char* o3);
52
66 static unsigned long Encode(
67 const unsigned char* input, unsigned long length, unsigned char* output, int mark_end = 0);
68
73 static int DecodeTriplet(unsigned char i0, unsigned char i1, unsigned char i2, unsigned char i3,
74 unsigned char* o0, unsigned char* o1, unsigned char* o2);
75
85 static size_t DecodeSafely(
86 const unsigned char* input, size_t inputLen, unsigned char* output, size_t outputLen);
87
88protected:
89 vtkBase64Utilities() = default;
90 ~vtkBase64Utilities() override = default;
91
92private:
94 void operator=(const vtkBase64Utilities&) = delete;
95};
96
97#endif
base64 encode and decode utilities.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static int DecodeTriplet(unsigned char i0, unsigned char i1, unsigned char i2, unsigned char i3, unsigned char *o0, unsigned char *o1, unsigned char *o2)
Decode 4 bytes into 3 bytes.
static void EncodeTriplet(unsigned char i0, unsigned char i1, unsigned char i2, unsigned char *o0, unsigned char *o1, unsigned char *o2, unsigned char *o3)
Encode 3 bytes into 4 bytes.
static vtkBase64Utilities * New()
static size_t DecodeSafely(const unsigned char *input, size_t inputLen, unsigned char *output, size_t outputLen)
Decode 4 bytes at a time from the input buffer and store the decoded stream into the output buffer.
static unsigned long Encode(const unsigned char *input, unsigned long length, unsigned char *output, int mark_end=0)
Encode 'length' bytes from the input buffer and store the encoded stream into the output buffer.
vtkBase64Utilities()=default
~vtkBase64Utilities() override=default
static void EncodeSingle(unsigned char i0, unsigned char *o0, unsigned char *o1, unsigned char *o2, unsigned char *o3)
Encode 1 byte into 4 bytes.
static void EncodePair(unsigned char i0, unsigned char i1, unsigned char *o0, unsigned char *o1, unsigned char *o2, unsigned char *o3)
Encode 2 bytes into 4 bytes.
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82