| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/cspmeter.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
    00003     Writen by Eric Sunshine <sunshine@sunshineco.com>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public
    00016     License along with this library; if not, write to the Free
    00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00018 */
    00019
    00020 #ifndef __CS_CSPMETER_H__
    00021 #define __CS_CSPMETER_H__
    00022
    00027 #include "csextern.h"
    00028 #include "csutil/scf_implementation.h"
    00029 #include "ivaria/pmeter.h"
    00030
    00031 struct iConsoleOutput;
    00032
    00055 class CS_CRYSTALSPACE_EXPORT csTextProgressMeter :
    00056   public scfImplementation1<csTextProgressMeter, iProgressMeter>
    00057 {
    00058 private:
    00059   iConsoleOutput* console;
    00060   int granularity;
    00061   int tick_scale;
    00062   int total;
    00063   int current;
    00064   int anchor;
    00065
    00066 public:
    00068   csTextProgressMeter (iConsoleOutput* console, int total = 100);
    00070   virtual ~csTextProgressMeter ();
    00071
    00078   void SetTickScale (int);
    00080   int GetTickScale () const { return tick_scale; }
    00081
    00087   virtual void CS_GNUC_PRINTF (3, 4)
    00088       SetProgressDescription (const char*, const char*, ...) { }
    00089   virtual void CS_GNUC_PRINTF (3, 0)
    00090       SetProgressDescriptionV (const char*, const char*, va_list) { }
    00091
    00093   virtual void Step (unsigned int n = 1);
    00095   virtual void Reset () { current = 0; anchor = 0; }
    00097   virtual void Restart ();
    00099   virtual void Abort ();
    00101   virtual void Finalize ();
    00102
    00104   virtual void SetTotal (int n) { total = n; Reset(); }
    00106   virtual int GetTotal () const { return total; }
    00108   virtual int GetCurrent () const { return current; }
    00109
    00116   virtual void SetGranularity (int);
    00118   virtual int GetGranularity () const { return granularity; }
    00119 };
    00120
    00121 #endif // __CS_CSPMETER_H__