File indexing completed on 2025-01-18 09:27:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef ABSL_STRINGS_INTERNAL_ESCAPING_H_
0016 #define ABSL_STRINGS_INTERNAL_ESCAPING_H_
0017
0018 #include <cassert>
0019
0020 #include "absl/strings/internal/resize_uninitialized.h"
0021
0022 namespace absl {
0023 ABSL_NAMESPACE_BEGIN
0024 namespace strings_internal {
0025
0026 ABSL_CONST_INIT extern const char kBase64Chars[];
0027 ABSL_CONST_INIT extern const char kWebSafeBase64Chars[];
0028
0029
0030
0031
0032 size_t CalculateBase64EscapedLenInternal(size_t input_len, bool do_padding);
0033
0034
0035
0036
0037
0038 size_t Base64EscapeInternal(const unsigned char* src, size_t szsrc, char* dest,
0039 size_t szdest, const char* base64, bool do_padding);
0040 template <typename String>
0041 void Base64EscapeInternal(const unsigned char* src, size_t szsrc, String* dest,
0042 bool do_padding, const char* base64_chars) {
0043 const size_t calc_escaped_size =
0044 CalculateBase64EscapedLenInternal(szsrc, do_padding);
0045 STLStringResizeUninitialized(dest, calc_escaped_size);
0046
0047 const size_t escaped_len = Base64EscapeInternal(
0048 src, szsrc, &(*dest)[0], dest->size(), base64_chars, do_padding);
0049 assert(calc_escaped_size == escaped_len);
0050 dest->erase(escaped_len);
0051 }
0052
0053 }
0054 ABSL_NAMESPACE_END
0055 }
0056
0057 #endif