diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-20 22:51:49 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-06 20:42:50 +0200 |
| commit | a3fcbb3a76e079a5485a0552ea5d35b8d6739116 (patch) | |
| tree | 58f6476b7197c0e32b5aa3d52d0859a9b04db268 /src/lib/cinema.cc | |
| parent | a4105c6e8dc83407abc9b12e80c958673c942888 (diff) | |
Use sqlite for cinema and DKDM recipient lists.
Diffstat (limited to 'src/lib/cinema.cc')
| -rw-r--r-- | src/lib/cinema.cc | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc deleted file mode 100644 index b1681fc28..000000000 --- a/src/lib/cinema.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net> - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. - -*/ - - -#include "cinema.h" -#include "screen.h" -#include "dcpomatic_assert.h" -#include <libcxml/cxml.h> -#include <dcp/raw_convert.h> -#include <libxml++/libxml++.h> - - -using std::make_shared; -using std::shared_ptr; -using std::string; -using dcp::raw_convert; -using dcpomatic::Screen; - - -Cinema::Cinema (cxml::ConstNodePtr node) - : name (node->string_child ("Name")) - , notes (node->optional_string_child("Notes").get_value_or("")) -{ - for (auto i: node->node_children("Email")) { - emails.push_back (i->content ()); - } - - int hour = 0; - - if (node->optional_number_child<int>("UTCOffset")) { - hour = node->number_child<int>("UTCOffset"); - } else { - hour = node->optional_number_child<int>("UTCOffsetHour").get_value_or(0); - } - - int minute = node->optional_number_child<int>("UTCOffsetMinute").get_value_or(0); - - utc_offset= { hour, minute }; -} - -/* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from - a constructor) -*/ -void -Cinema::read_screens (cxml::ConstNodePtr node) -{ - for (auto i: node->node_children("Screen")) { - add_screen (make_shared<Screen>(i)); - } -} - -void -Cinema::as_xml (xmlpp::Element* parent) const -{ - cxml::add_text_child(parent, "Name", name); - - for (auto i: emails) { - cxml::add_text_child(parent, "Email", i); - } - - cxml::add_text_child(parent, "Notes", notes); - - cxml::add_text_child(parent, "UTCOffsetHour", raw_convert<string>(utc_offset.hour())); - cxml::add_text_child(parent, "UTCOffsetMinute", raw_convert<string>(utc_offset.minute())); - - for (auto i: _screens) { - i->as_xml(cxml::add_child(parent, "Screen")); - } -} - -void -Cinema::add_screen (shared_ptr<Screen> s) -{ - s->cinema = shared_from_this (); - _screens.push_back (s); -} - -void -Cinema::remove_screen (shared_ptr<Screen> s) -{ - auto iter = std::find(_screens.begin(), _screens.end(), s); - if (iter != _screens.end()) { - _screens.erase(iter); - } -} - |
