Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / include / utils / SkBase64.h
1 /*
2  * Copyright 2006 The Android Open Source Project
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7
8 #ifndef SkBase64_DEFINED
9 #define SkBase64_DEFINED
10
11 #include "include/core/SkTypes.h"
12
13 struct SkBase64 {
14 public:
15     enum Error {
16         kNoError,
17         kPadError,
18         kBadCharError
19     };
20
21     /**
22        Base64 encodes src into dst.
23
24        Normally this is called once with 'dst' nullptr to get the required size, then again with an
25        allocated 'dst' pointer to do the actual encoding.
26
27        @param dst nullptr or a pointer to a buffer large enough to receive the result
28
29        @param encode nullptr for default encoding or a pointer to at least 65 chars.
30                      encode[64] will be used as the pad character.
31                      Encodings other than the default encoding cannot be decoded.
32
33        @return the required length of dst for encoding.
34     */
35     static size_t Encode(const void* src, size_t length, void* dst, const char* encode = nullptr);
36
37     /**
38        Base64 decodes src into dst.
39
40        Normally this is called once with 'dst' nullptr to get the required size, then again with an
41        allocated 'dst' pointer to do the actual encoding.
42
43        @param dst nullptr or a pointer to a buffer large enough to receive the result
44
45        @param dstLength assigned the length dst is required to be. Must not be nullptr.
46     */
47     static Error SK_WARN_UNUSED_RESULT Decode(const void* src, size_t  srcLength,
48                                                     void* dst, size_t* dstLength);
49 };
50
51 #endif // SkBase64_DEFINED