|
||||
File indexing completed on 2025-01-18 09:27:16
0001 // Copyright 2024 The Abseil Authors 0002 // 0003 // Licensed under the Apache License, Version 2.0 (the "License"); 0004 // you may not use this file except in compliance with the License. 0005 // You may obtain a copy of the License at 0006 // 0007 // https://www.apache.org/licenses/LICENSE-2.0 0008 // 0009 // Unless required by applicable law or agreed to in writing, software 0010 // distributed under the License is distributed on an "AS IS" BASIS, 0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0012 // See the License for the specific language governing permissions and 0013 // limitations under the License. 0014 0015 #ifndef ABSL_DEBUGGING_INTERNAL_UTF8_FOR_CODE_POINT_H_ 0016 #define ABSL_DEBUGGING_INTERNAL_UTF8_FOR_CODE_POINT_H_ 0017 0018 #include <cstdint> 0019 0020 #include "absl/base/config.h" 0021 0022 namespace absl { 0023 ABSL_NAMESPACE_BEGIN 0024 namespace debugging_internal { 0025 0026 struct Utf8ForCodePoint { 0027 // Converts a Unicode code point to the corresponding UTF-8 byte sequence. 0028 // Async-signal-safe to support use in symbolizing stack traces from a signal 0029 // handler. 0030 explicit Utf8ForCodePoint(uint64_t code_point); 0031 0032 // Returns true if the constructor's code_point argument was valid. 0033 bool ok() const { return length != 0; } 0034 0035 // If code_point was in range, then 1 <= length <= 4, and the UTF-8 encoding 0036 // is found in bytes[0 .. (length - 1)]. If code_point was invalid, then 0037 // length == 0. In either case, the contents of bytes[length .. 3] are 0038 // unspecified. 0039 char bytes[4] = {}; 0040 uint32_t length = 0; 0041 }; 0042 0043 } // namespace debugging_internal 0044 ABSL_NAMESPACE_END 0045 } // namespace absl 0046 0047 #endif // ABSL_DEBUGGING_INTERNAL_UTF8_FOR_CODE_POINT_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |