/* Copyright (C) 2025 Carl Hetherington 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 . */ #include "upload_destination.h" #include #include UploadDestination::UploadDestination(cxml::ConstNodePtr node) : name(node->string_child("Name")) , protocol(file_transfer_protocol_from_string(node->string_child("Protocol"))) , passive_ftp(node->bool_child("PassiveFTP")) , maximum_connections(node->optional_number_child("MaximumConnections")) , host(node->string_child("Host")) , path(node->string_child("Path")) , user(node->string_child("User")) , password(node->string_child("Password")) { } void UploadDestination::as_xml(xmlpp::Element* parent) const { cxml::add_text_child(parent, "Name", name); cxml::add_text_child(parent, "Protocol", file_transfer_protocol_to_string(protocol)); cxml::add_text_child(parent, "PassiveFTP", passive_ftp ? "1" : "0"); if (maximum_connections) { cxml::add_text_child(parent, "MaximumConnections", fmt::to_string(*maximum_connections)); } cxml::add_text_child(parent, "Host", host); cxml::add_text_child(parent, "Path", path); cxml::add_text_child(parent, "User", user); cxml::add_text_child(parent, "Password", password); } bool operator==(UploadDestination const& a, UploadDestination const& b) { return a.name == b.name && a.protocol == b.protocol && a.passive_ftp == b.passive_ftp && a.maximum_connections == b.maximum_connections && a.host == b.host && a.path == b.path && a.user == b.user && a.password == b.password; }