|
| 1 | +//===-- SBProgress.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_SBPROGRESS_H |
| 10 | +#define LLDB_API_SBPROGRESS_H |
| 11 | + |
| 12 | +#include "lldb/API/SBDebugger.h" |
| 13 | +#include "lldb/API/SBDefines.h" |
| 14 | + |
| 15 | +namespace lldb { |
| 16 | + |
| 17 | +/// A Progress indicator helper class. |
| 18 | +/// |
| 19 | +/// Any potentially long running sections of code in LLDB should report |
| 20 | +/// progress so that clients are aware of delays that might appear during |
| 21 | +/// debugging. Delays commonly include indexing debug information, parsing |
| 22 | +/// symbol tables for object files, downloading symbols from remote |
| 23 | +/// repositories, and many more things. |
| 24 | +/// |
| 25 | +/// The Progress class helps make sure that progress is correctly reported |
| 26 | +/// and will always send an initial progress update, updates when |
| 27 | +/// Progress::Increment() is called, and also will make sure that a progress |
| 28 | +/// completed update is reported even if the user doesn't explicitly cause one |
| 29 | +/// to be sent. |
| 30 | +class LLDB_API SBProgress { |
| 31 | +public: |
| 32 | + /// Construct a progress object with a title, details and a given debugger. |
| 33 | + /// \param title |
| 34 | + /// The title of the progress object. |
| 35 | + /// \param details |
| 36 | + /// The details of the progress object. |
| 37 | + /// \param debugger |
| 38 | + /// The debugger for this progress object to report to. |
| 39 | + SBProgress(const char *title, const char *details, SBDebugger &debugger); |
| 40 | + |
| 41 | + /// Construct a progress object with a title, details, the total units of work |
| 42 | + /// to be done, and a given debugger. |
| 43 | + /// \param title |
| 44 | + /// The title of the progress object. |
| 45 | + /// \param details |
| 46 | + /// The details of the progress object. |
| 47 | + /// \param total_units |
| 48 | + /// The total number of units of work to be done. |
| 49 | + /// \param debugger |
| 50 | + /// The debugger for this progress object to report to. |
| 51 | + SBProgress(const char *title, const char *details, uint64_t total_units, |
| 52 | + SBDebugger &debugger); |
| 53 | + |
| 54 | + ~SBProgress(); |
| 55 | + |
| 56 | + void Increment(uint64_t amount, const char *description = nullptr); |
| 57 | + |
| 58 | +protected: |
| 59 | + lldb_private::Progress &ref() const; |
| 60 | + |
| 61 | +private: |
| 62 | + std::unique_ptr<lldb_private::Progress> m_opaque_up; |
| 63 | +}; // SBProgress |
| 64 | +} // namespace lldb |
| 65 | + |
| 66 | +#endif // LLDB_API_SBPROGRESS_H |
0 commit comments