| 1 | //===-- CxxStringTypes.h ----------------------------------------------*- C++ |
| 2 | //-*-===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_CXXSTRINGTYPES_H |
| 11 | #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_CXXSTRINGTYPES_H |
| 12 | |
| 13 | #include "lldb/DataFormatters/StringPrinter.h" |
| 14 | #include "lldb/DataFormatters/TypeSummary.h" |
| 15 | #include "lldb/Utility/Stream.h" |
| 16 | #include "lldb/ValueObject/ValueObject.h" |
| 17 | |
| 18 | namespace lldb_private { |
| 19 | namespace formatters { |
| 20 | bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream, |
| 21 | const TypeSummaryOptions &options); // char8_t* |
| 22 | |
| 23 | bool Char16StringSummaryProvider( |
| 24 | ValueObject &valobj, Stream &stream, |
| 25 | const TypeSummaryOptions &options); // char16_t* and unichar* |
| 26 | |
| 27 | bool Char32StringSummaryProvider( |
| 28 | ValueObject &valobj, Stream &stream, |
| 29 | const TypeSummaryOptions &options); // char32_t* |
| 30 | |
| 31 | bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream, |
| 32 | const TypeSummaryOptions &options); // wchar_t* |
| 33 | |
| 34 | bool Char8SummaryProvider(ValueObject &valobj, Stream &stream, |
| 35 | const TypeSummaryOptions &options); // char8_t |
| 36 | |
| 37 | bool Char16SummaryProvider( |
| 38 | ValueObject &valobj, Stream &stream, |
| 39 | const TypeSummaryOptions &options); // char16_t and unichar |
| 40 | |
| 41 | bool Char32SummaryProvider(ValueObject &valobj, Stream &stream, |
| 42 | const TypeSummaryOptions &options); // char32_t |
| 43 | |
| 44 | bool WCharSummaryProvider(ValueObject &valobj, Stream &stream, |
| 45 | const TypeSummaryOptions &options); // wchar_t |
| 46 | |
| 47 | std::optional<uint64_t> GetWCharByteSize(ValueObject &valobj); |
| 48 | |
| 49 | /// Print a summary for a string buffer to \a stream. |
| 50 | /// |
| 51 | /// \param[in] stream |
| 52 | /// The output stream to print the summary to. |
| 53 | /// |
| 54 | /// \param[in] summary_options |
| 55 | /// Options for printing the string contents. This function respects the |
| 56 | /// capping. |
| 57 | /// |
| 58 | /// \param[in] location_sp |
| 59 | /// ValueObject of a pointer to the string being printed. |
| 60 | /// |
| 61 | /// \param[in] size |
| 62 | /// The size of the buffer pointed to by \a location_sp. |
| 63 | /// |
| 64 | /// \param[in] prefix_token |
| 65 | /// A prefix before the double quotes (e.g. 'u' results in u"..."). |
| 66 | /// |
| 67 | /// \return |
| 68 | /// Returns whether the string buffer was successfully printed. |
| 69 | template <StringPrinter::StringElementType element_type> |
| 70 | bool StringBufferSummaryProvider(Stream &stream, |
| 71 | const TypeSummaryOptions &summary_options, |
| 72 | lldb::ValueObjectSP location_sp, uint64_t size, |
| 73 | std::string prefix_token); |
| 74 | |
| 75 | } // namespace formatters |
| 76 | } // namespace lldb_private |
| 77 | |
| 78 | #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_CXXSTRINGTYPES_H |
| 79 | |