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