diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-24 00:12:45 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-24 00:12:45 +0000 |
| commit | 1e4f8cc123ccf1661ea4d23a51625614c2cf2e59 (patch) | |
| tree | 0abbbfac2097b52640ce447bc8fdc93e1939233e /src/lib/update.h | |
| parent | 68f662ac50a00ad986e3bd258c3f7daac374ab26 (diff) | |
Hand-apply d4470377df181b4d15fbac86c454a8372b1a0f3d; fix update checker.
Diffstat (limited to 'src/lib/update.h')
| -rw-r--r-- | src/lib/update.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/update.h b/src/lib/update.h index f3a0ffc36..c3e2b5613 100644 --- a/src/lib/update.h +++ b/src/lib/update.h @@ -27,6 +27,8 @@ #include <boost/thread/condition.hpp> #include <boost/thread.hpp> +struct update_checker_test; + /** Class to check for the existance of an update for DCP-o-matic on a remote server */ class UpdateChecker { @@ -49,14 +51,14 @@ public: return _state; } - /** @return the version string of the latest stable version (if _state == YES or NO) */ - std::string stable () { + /** @return new stable version, if there is one */ + boost::optional<std::string> stable () { boost::mutex::scoped_lock lm (_data_mutex); return _stable; } - /** @return the version string of the latest test version (if _state == YES or NO) */ - std::string test () { + /** @return new test version, if there is one and Config is set to look for it */ + boost::optional<std::string> test () { boost::mutex::scoped_lock lm (_data_mutex); return _test; } @@ -73,9 +75,13 @@ public: static UpdateChecker* instance (); -private: +private: + friend struct update_checker_test; + static UpdateChecker* _instance; + static bool version_less_than (std::string const & a, std::string const & b); + void set_state (State); void thread (); @@ -86,8 +92,8 @@ private: /** mutex to protect _state, _stable, _test and _emits */ mutable boost::mutex _data_mutex; State _state; - std::string _stable; - std::string _test; + boost::optional<std::string> _stable; + boost::optional<std::string> _test; int _emits; boost::thread* _thread; |
