1 //===-- SBFormat.h ----------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_API_SBFORMAT_H 10 #define LLDB_API_SBFORMAT_H 11 12 #include "lldb/API/SBDefines.h" 13 14 namespace lldb_private { 15 namespace python { 16 class SWIGBridge; 17 } // namespace python 18 namespace lua { 19 class SWIGBridge; 20 } // namespace lua 21 } // namespace lldb_private 22 23 namespace lldb { 24 25 /// Class that represents a format string that can be used to generate 26 /// descriptions of objects like frames and threads. See 27 /// https://lldb.llvm.org/use/formatting.html for more information. 28 class LLDB_API SBFormat { 29 public: 30 SBFormat(); 31 32 /// Create an \a SBFormat by parsing the given format string. If parsing 33 /// fails, this object is initialized as invalid. 34 /// 35 /// \param[in] format 36 /// The format string to parse. 37 /// 38 /// \param[out] error 39 /// An object where error messages will be written to if parsing fails. 40 SBFormat(const char *format, lldb::SBError &error); 41 42 SBFormat(const lldb::SBFormat &rhs); 43 44 lldb::SBFormat &operator=(const lldb::SBFormat &rhs); 45 46 ~SBFormat(); 47 48 /// \return 49 /// \b true if and only if this object is valid and can be used for 50 /// formatting. 51 explicit operator bool() const; 52 53 protected: 54 friend class SBFrame; 55 friend class SBThread; 56 57 /// \return 58 /// The underlying shared pointer storage for this object. 59 lldb::FormatEntrySP GetFormatEntrySP() const; 60 61 /// The storage for this object. 62 lldb::FormatEntrySP m_opaque_sp; 63 }; 64 65 } // namespace lldb 66 #endif // LLDB_API_SBFORMAT_H 67