00001 #ifndef OUTPUT_PROCESSOR_H 00002 #define OUTPUT_PROCESSOR_H 00003 00004 #include "y2storage/StorageInterface.h" 00005 00006 class OutputProcessor 00007 { 00008 public: 00009 OutputProcessor() {} 00010 virtual ~OutputProcessor() {} 00011 virtual void reset() {} 00012 virtual void finished() {} 00013 virtual void process( const string& txt, bool stderr ); 00014 }; 00015 00016 class ScrollBarHandler : public OutputProcessor 00017 { 00018 public: 00019 ScrollBarHandler( const string& sid, storage::CallbackProgressBar cb ) 00020 { id=sid; first=true; callback=cb; cur=0; max=100; } 00021 virtual ~ScrollBarHandler() {} 00022 virtual void reset() { first=true; cur=0; } 00023 virtual void finished() { setCurValue( max ); } 00024 virtual void process( const string& txt, bool stderr ); 00025 void setMaxValue( unsigned val ) { max=val; } 00026 unsigned getMaxValue() { return( max ); } 00027 void setCurValue( unsigned val ); 00028 unsigned getCurValue() { return( cur ); } 00029 00030 protected: 00031 unsigned max; 00032 unsigned cur; 00033 bool first; 00034 string id; 00035 storage::CallbackProgressBar callback; 00036 }; 00037 00038 class Mke2fsScrollbar : public ScrollBarHandler 00039 { 00040 public: 00041 Mke2fsScrollbar( storage::CallbackProgressBar cb ) : 00042 ScrollBarHandler( "format", cb ) { done=false; } 00043 virtual void process( const string& txt, bool stderr ); 00044 protected: 00045 string seen; 00046 bool done; 00047 }; 00048 00049 class ReiserScrollbar : public ScrollBarHandler 00050 { 00051 public: 00052 ReiserScrollbar( storage::CallbackProgressBar cb ) : 00053 ScrollBarHandler( "format", cb ) { max=100; } 00054 virtual void process( const string& txt, bool stderr ); 00055 protected: 00056 string seen; 00057 }; 00058 00059 #endif
1.4.4