ProgressDisplay.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00026 #ifndef _APPBASE_PROGRESSDISPLAY_H
00027 #define _APPBASE_PROGRESSDISPLAY_H
00028 
00029 #include <iostream>
00030 #include <string>
00031 
00032 #include <hugin_shared.h>
00033 #include <hugin_utils/utils.h>
00034 
00035 
00036 namespace AppBase {
00037 
00041 class IMPEX ProgressDisplay
00042 {
00043 protected:
00045     explicit ProgressDisplay(int maximum=0) : m_canceled(false), m_maximum(maximum), m_progress(0) {};
00046 public:
00047     /* virtual destructor */
00048     virtual ~ProgressDisplay() {};
00050     void setMessage(const std::string& message, const std::string& filename="");
00052     void taskFinished();
00054     bool updateDisplay();
00055     bool updateDisplay(const std::string& message);
00056     bool updateDisplayValue();
00058     void setMaximum(int newMaximum);
00061     bool wasCancelled();
00062 
00063 protected:
00067     virtual void updateProgressDisplay() = 0;
00068 
00069 protected:
00070     bool m_canceled;
00071     std::string m_message;
00072     std::string m_filename;
00073     int m_maximum;
00074     int m_progress;
00075 };
00076 
00077 
00080 class IMPEX DummyProgressDisplay : public ProgressDisplay
00081 {
00082 protected:
00084     virtual void updateProgressDisplay() {};
00085 };
00086 
00089 class IMPEX StreamProgressDisplay : public ProgressDisplay
00090 {
00091     public:
00093         explicit StreamProgressDisplay(std::ostream & o) : ProgressDisplay(), m_stream(o) {};
00095         virtual void updateProgressDisplay();
00096     protected:
00097         std::ostream & m_stream;
00098 };
00099 
00100 }; //namespace
00101 
00102 #endif // _H

Generated on 29 Apr 2016 for Hugintrunk by  doxygen 1.4.7