KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cli_progress_reporter.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef CLI_PROGRESS_REPORTER_H
21#define CLI_PROGRESS_REPORTER_H
22
23#include <wx/string.h>
24#include <progress_reporter.h>
25#include <kicommon.h>
26
32{
33public:
35 m_verbose( false )
36 { }
37
39
40 static CLI_PROGRESS_REPORTER& GetInstance();
41
45 void SetVerbose( bool aVerbose ) { m_verbose = aVerbose; }
46
47 bool GetVerbose() const { return m_verbose; }
48
52 virtual void SetNumPhases( int aNumPhases ) override {}
53 virtual void AddPhases( int aNumPhases ) override {};
54
58 virtual void BeginPhase( int aPhase ) override {}
59
63 virtual void AdvancePhase() override {}
64
68 virtual void AdvancePhase( const wxString& aMessage ) override;
69
73 virtual void Report( const wxString& aMessage ) override;
74
78 virtual void SetCurrentProgress( double aProgress ) override {}
79
84 virtual void SetMaxProgress( int aMaxProgress ) override {}
85
89 virtual void AdvanceProgress() override {}
90
98 virtual bool KeepRefreshing( bool aWait = false ) override { return false; }
99
107 virtual void SetTitle( const wxString& aTitle ) override {}
108
109 virtual bool IsCancelled() const override { return false; }
110
111
112private:
113 void printLine( const wxString& aMessage );
114
116};
117
118#endif
Reporter forwarding messages to stdout or stderr as appropriate.
virtual void SetTitle(const wxString &aTitle) override
Change the title displayed on the window caption.
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
virtual void BeginPhase(int aPhase) override
Initialize the aPhase virtual zone of the dialog progress bar.
virtual void AdvanceProgress() override
Increment the progress bar length (inside the current virtual zone).
virtual void SetNumPhases(int aNumPhases) override
Set the number of phases.
virtual bool KeepRefreshing(bool aWait=false) override
Update the UI (if any).
virtual void AddPhases(int aNumPhases) override
virtual void SetMaxProgress(int aMaxProgress) override
Fix the value that gives the 100 percent progress bar length (inside the current virtual zone).
virtual void SetCurrentProgress(double aProgress) override
Set the progress value to aProgress (0..1).
void SetVerbose(bool aVerbose)
Enable or disable verbose mode.
virtual bool IsCancelled() const override
virtual void Report(const wxString &aMessage)=0
Display aMessage in the progress bar dialog.
virtual void AdvancePhase()=0
Use the next available virtual zone of the dialog progress bar.
#define KICOMMON_API
Definition kicommon.h:27