Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
DisplayProgress.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "DisplayProgress.h"
13 
14 
15 using namespace kome::core;
16 
17 
18 #include <crtdbg.h>
19 #ifdef _DEBUG
20  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
21  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
22 #endif // _DEBUG
23 
24 
25 
26 // constructor
27 DisplayProgress::DisplayProgress( const char* title ) : Progress( title ) {
28  m_progress = NULL;
29 }
30 
31 // destructor
33  if( m_progress != NULL ) {
34  delete m_progress;
35  }
36 }
37 
38 // set range
39 void DisplayProgress::onSetRange( const int start, const int end ) {
40  // range
41  int range = end - start;
42  range = ABS( range );
43 
44  // create object
45  if( m_progress != NULL ) {
46  delete m_progress;
47  }
48  m_progress = new boost::progress_display( range );
49 }
50 
51 // set position
52 void DisplayProgress::onSetPosition( const int pos, const int prevPos ) {
53  // check the member
54  if( m_progress == NULL ) {
55  return;
56  }
57 
58  // add count
59  int count = pos - prevPos;
60  if( m_start > m_end ) {
61  count = - count;
62  }
63  if( count > 0 ) {
64  ( *m_progress ) += count;
65  }
66 }
67 
68 // set status
69 void DisplayProgress::onSetStatus( const char* status, const bool bForced ) {
70 }
71 
72 // is stopped
74  return false;
75 }
76 
77 // >>>>>> @Date:2013/11/25 <Add> A.Ozaki
78 //
80 {
81  return;
82 }
83 //
84 // <<<<<< @Date:2013/11/25 <Add> A.Ozaki
virtual void onSetRange(const int start, const int end)
This method is called by setRange method. (override method)
DisplayProgress(const char *title)
constructor
boost::progress_display * m_progress
progress display abstract class
Definition: Progress.h:31
virtual ~DisplayProgress()
destructor
#define NULL
Definition: CoreMacros.h:18
interfaces of DisplayProgress class
virtual void onSetStatus(const char *status, const bool bForced=false)
This method is called by setStatus method. (override method)
virtual void onFill(void)
This method is called by fill method. (override method)
virtual bool onIsStopped()
This method is called by isStopped method. (override method)
#define ABS(v)
Definition: CoreMacros.h:38
virtual void onSetPosition(const int pos, const int prevPos)
This method is called by setPosition method. (override method)