progress: add progress_switcher
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
ff097d4432
commit
a8c3ade263
@ -261,4 +261,30 @@ namespace stdex
|
|||||||
progress* m_host;
|
progress* m_host;
|
||||||
interval<T> m_kaz, m_glob, m_odsek;
|
interval<T> m_kaz, m_glob, m_odsek;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Progress indicator switcher
|
||||||
|
///
|
||||||
|
/// Use to inject global_progress indicator inplace of another progress indicator.
|
||||||
|
///
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class progress_switcher : public global_progress<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
progress_switcher(progress<T>*& host) :
|
||||||
|
global_progress<T>(host),
|
||||||
|
m_host_ref(host)
|
||||||
|
{
|
||||||
|
m_host_ref = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~progress_switcher()
|
||||||
|
{
|
||||||
|
m_host_ref = detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
progress<T>*& m_host_ref;
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user