diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-17 01:06:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-22 14:34:25 +0100 |
| commit | 8b3561f2acc149e0654b47558569e06a10e068c3 (patch) | |
| tree | cc41210ad80bffa1604cc75a9a68f2f38e3467bb | |
| parent | 02cac1475862cf4d35ec79f54e1b969fb2c538ea (diff) | |
Add screens() to get all screens.
| -rw-r--r-- | src/lib/cinema_list.cc | 13 | ||||
| -rw-r--r-- | src/lib/cinema_list.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/cinema_list.cc b/src/lib/cinema_list.cc index 6805a42cd..f59a8f4f8 100644 --- a/src/lib/cinema_list.cc +++ b/src/lib/cinema_list.cc @@ -35,6 +35,7 @@ #include <numeric> +using std::function; using std::pair; using std::make_pair; using std::string; @@ -465,3 +466,15 @@ CinemaList::unique_utc_offset(std::set<CinemaID> const& cinemas_to_check) return offset; } + +void +CinemaList::screens(function<void (CinemaID, ScreenID, dcpomatic::Screen const& screen)> callback) const +{ + SQLiteStatement statement(_db, _screens.select("")); + statement.execute([this, &callback](SQLiteStatement& statement) { + auto const screen_id = statement.column_int64(0); + callback(statement.column_int64(1), screen_id, screen_from_result(statement, screen_id)); + }); + +} + diff --git a/src/lib/cinema_list.h b/src/lib/cinema_list.h index 101f93607..6c1e65017 100644 --- a/src/lib/cinema_list.h +++ b/src/lib/cinema_list.h @@ -105,6 +105,8 @@ public: std::vector<std::pair<ScreenID, dcpomatic::Screen>> screens(CinemaID cinema_id) const; std::vector<std::pair<ScreenID, dcpomatic::Screen>> screens_by_cinema_and_name(CinemaID id, std::string const& name) const; + void screens(std::function<void (CinemaID, ScreenID, dcpomatic::Screen const&)> callback) const; + boost::optional<dcp::UTCOffset> unique_utc_offset(std::set<CinemaID> const& cinemas); private: |
