Avoid a function call for most status updates
[linguistica.git] / ui / Status.cpp
blob52e907fe43179b6c956dc9db807c89977ae04d53
1 // Shim to allow code that expects a status bar to work without one.
2 // Copyright © 2010 The University of Chicago
4 #include "ui/Status.h"
6 namespace linguistica {
7 namespace ui {
9 namespace {
10 struct null_agent : status_user_agent {
11 typedef status_user_agent base;
13 struct string_forgetter : base::string_type {
14 void clear() { }
15 string_forgetter& operator=(const QString&)
16 { return *this; }
18 struct progress_forgetter : base::progress_type {
19 void clear() { }
20 void set_denominator(int) { incr = 0; }
21 progress_forgetter& assign(int) { return *this; }
23 string_forgetter string_sink;
24 progress_forgetter progress_sink;
25 null_agent() : base(string_sink, string_sink, progress_sink) { }
29 status_user_agent& ignore_status_updates()
31 static null_agent sink;
32 return sink;
35 } // namespace linguistica::ui
36 } // namespace linguistica