libosmscout 1.1.1
Loading...
Searching...
No Matches
Progress.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_UTIL_PROGRESS_H
2#define OSMSCOUT_UTIL_PROGRESS_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2009 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <ctime>
24#include <string>
25
26#include <osmscout/lib/CoreFeatures.h>
28
30
31namespace osmscout {
32
34 {
35 private:
36 bool outputDebug;
37
38 protected:
40
41 public:
42 virtual ~Progress() = default;
43
44 void SetOutputDebug(bool outputDebug);
45 bool OutputDebug() const;
46
47 virtual void SetStep(const std::string& step);
48 virtual void SetAction(const std::string& action);
49 virtual void SetProgress(double current, double total, const std::string& label="");
50 virtual void SetProgress(unsigned int current, unsigned int total, const std::string& label="");
51 virtual void SetProgress(unsigned long current, unsigned long total, const std::string& label="");
52 virtual void SetProgress(unsigned long long current, unsigned long long total, const std::string& label="");
53 virtual void Debug(const std::string& text);
54 virtual void Info(const std::string& text);
55 virtual void Warning(const std::string& text);
56 virtual void Error(const std::string& text);
57 };
58
59 class OSMSCOUT_API SilentProgress CLASS_FINAL : public Progress
60 {
61 public:
62 SilentProgress() = default;
63 ~SilentProgress() override = default;
64 };
65
67 {
68 private:
69 std::time_t lastProgressDump;
70
71 public:
72 ConsoleProgress() = default;
73 ~ConsoleProgress() override = default;
74
75 void SetStep(const std::string& step) override;
76 void SetAction(const std::string& action) override;
77 void SetProgress(double current, double total, const std::string& label) override;
78 void SetProgress(unsigned int current, unsigned int total,const std::string& label) override;
79 void SetProgress(unsigned long current, unsigned long total, const std::string& label="") override;
80 void SetProgress(unsigned long long current, unsigned long long total, const std::string& label="") override;
81
82 void Debug(const std::string& text) override;
83 void Info(const std::string& text) override;
84 void Warning(const std::string& text) override;
85 void Error(const std::string& text) override;
86 };
87}
88
89#endif
#define OSMSCOUT_API
Definition CoreImportExport.h:45
Definition Area.h:88
~SilentProgress() override=default
void Error(const std::string &text) override
void SetStep(const std::string &step) override
void SetProgress(unsigned long long current, unsigned long long total, const std::string &label="") override
void SetProgress(unsigned int current, unsigned int total, const std::string &label) override
void SetProgress(unsigned long current, unsigned long total, const std::string &label="") override
void SetProgress(double current, double total, const std::string &label) override
void Info(const std::string &text) override
void Warning(const std::string &text) override
void SetAction(const std::string &action) override
~ConsoleProgress() override=default
void Debug(const std::string &text) override
Definition Progress.h:34
virtual void SetProgress(unsigned long long current, unsigned long long total, const std::string &label="")
void SetOutputDebug(bool outputDebug)
virtual ~Progress()=default
virtual void Error(const std::string &text)
virtual void SetStep(const std::string &step)
bool OutputDebug() const
virtual void Info(const std::string &text)
virtual void Warning(const std::string &text)
virtual void Debug(const std::string &text)
virtual void SetAction(const std::string &action)
virtual void SetProgress(unsigned long current, unsigned long total, const std::string &label="")
virtual void SetProgress(unsigned int current, unsigned int total, const std::string &label="")
virtual void SetProgress(double current, double total, const std::string &label="")
Definition Area.h:39