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 
00047 public:
00049     void setMessage(const std::string& message, const std::string& filename="");
00051     void taskFinished();
00053     bool updateDisplay();
00054     bool updateDisplay(const std::string& message);
00055     bool updateDisplayValue();
00057     void setMaximum(int newMaximum);
00060     bool wasCancelled();
00061 
00062 protected:
00066     virtual void updateProgressDisplay() = 0;
00067 
00068 protected:
00069     bool m_canceled;
00070     std::string m_message;
00071     std::string m_filename;
00072     int m_maximum;
00073     int m_progress;
00074 };
00075 
00076 
00079 class IMPEX DummyProgressDisplay : public ProgressDisplay
00080 {
00081 protected:
00083     virtual void updateProgressDisplay() {};
00084 };
00085 
00088 class IMPEX StreamProgressDisplay : public ProgressDisplay
00089 {
00090     public:
00092         explicit StreamProgressDisplay(std::ostream & o) : ProgressDisplay(), m_stream(o) {};
00094         virtual void updateProgressDisplay();
00095     protected:
00096         std::ostream & m_stream;
00097 };
00098 
00099 }; //namespace
00100 
00101 #endif // _H

Generated on 31 Aug 2015 for Hugintrunk by  doxygen 1.4.7