grpc
third_party
abseil-cpp
absl
strings
internal
abseil-cpp/absl/strings/internal/utf8.h
Go to the documentation of this file.
1
// Copyright 2017 The Abseil Authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// UTF8 utilities, implemented to reduce dependencies.
16
17
#ifndef ABSL_STRINGS_INTERNAL_UTF8_H_
18
#define ABSL_STRINGS_INTERNAL_UTF8_H_
19
20
#include <cstddef>
21
#include <cstdint>
22
23
#include "absl/base/config.h"
24
25
namespace
absl
{
26
ABSL_NAMESPACE_BEGIN
27
namespace
strings_internal {
28
29
// For Unicode code points 0 through 0x10FFFF, EncodeUTF8Char writes
30
// out the UTF-8 encoding into buffer, and returns the number of chars
31
// it wrote.
32
//
33
// As described in https://tools.ietf.org/html/rfc3629#section-3 , the encodings
34
// are:
35
// 00 - 7F : 0xxxxxxx
36
// 80 - 7FF : 110xxxxx 10xxxxxx
37
// 800 - FFFF : 1110xxxx 10xxxxxx 10xxxxxx
38
// 10000 - 10FFFF : 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
39
//
40
// Values greater than 0x10FFFF are not supported and may or may not write
41
// characters into buffer, however never will more than kMaxEncodedUTF8Size
42
// bytes be written, regardless of the value of utf8_char.
43
enum
{
kMaxEncodedUTF8Size
= 4 };
44
size_t
EncodeUTF8Char
(
char
*
buffer
, char32_t utf8_char);
45
46
}
// namespace strings_internal
47
ABSL_NAMESPACE_END
48
}
// namespace absl
49
50
#endif // ABSL_STRINGS_INTERNAL_UTF8_H_
absl::strings_internal::EncodeUTF8Char
size_t EncodeUTF8Char(char *buffer, char32_t utf8_char)
Definition:
abseil-cpp/absl/strings/internal/utf8.cc:23
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition:
third_party/abseil-cpp/absl/base/config.h:171
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition:
third_party/abseil-cpp/absl/base/config.h:170
absl::strings_internal::kMaxEncodedUTF8Size
@ kMaxEncodedUTF8Size
Definition:
abseil-cpp/absl/strings/internal/utf8.h:43
buffer
char buffer[1024]
Definition:
libuv/docs/code/idle-compute/main.c:8
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:48