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 (C) 2023 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef CLI_PROGRESS_REPORTER_H
25#define CLI_PROGRESS_REPORTER_H
26
27#include <wx/string.h>
28#include <progress_reporter.h>
29
34{
35public:
37
39
41
45 virtual void SetNumPhases( int aNumPhases ) override {}
46 virtual void AddPhases( int aNumPhases ) override {};
47
51 virtual void BeginPhase( int aPhase ) override {}
52
56 virtual void AdvancePhase() override {}
57
61 virtual void AdvancePhase( const wxString& aMessage ) override;
62
66 virtual void Report( const wxString& aMessage ) override;
67
71 virtual void SetCurrentProgress( double aProgress ) override {}
72
77 virtual void SetMaxProgress( int aMaxProgress ) override {}
78
82 virtual void AdvanceProgress() override {}
83
91 virtual bool KeepRefreshing( bool aWait = false ) override { return false; }
92
100 virtual void SetTitle( const wxString& aTitle ) override {}
101
102 virtual bool IsCancelled() const override { return false; }
103
104
105private:
106 void printLine( const wxString& aMessage );
107};
108
109#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).
static PROGRESS_REPORTER & GetInstance()
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 printLine(const wxString &aMessage)
virtual void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
virtual bool IsCancelled() const override
A progress reporter interface for use in multi-threaded environments.