1 // This file is part of Desktop App Toolkit,
2 // a set of libraries for developing nice desktop applications.
3 //
4 // For license and copyright information please follow this link:
5 // https://github.com/desktop-app/legal/blob/master/LEGAL
6 //
7 #include "ui/ph.h"
8 
9 namespace ph {
10 namespace {
11 
PhraseCounter()12 int &PhraseCounter() {
13 	static auto result = 0;
14 	return result;
15 }
16 
17 } // namespace
18 
phrase(const QString & initial)19 phrase::phrase(const QString &initial) : value(initial) {
20 	if (auto &counter = PhraseCounter()) {
21 		++counter;
22 	}
23 }
24 
phrase(rpl::producer<QString> initial)25 phrase::phrase(rpl::producer<QString> initial) : value(std::move(initial)) {
26 }
27 
28 
start_phrase_count()29 now_t start_phrase_count() {
30 	PhraseCounter() = 1;
31 	return now;
32 }
33 
check_phrase_count(int count)34 now_t check_phrase_count(int count) {
35 	Expects(PhraseCounter() == count + 1);
36 
37 	PhraseCounter() = 0;
38 	return now;
39 }
40 
41 } // namespace ph
42