diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-06-03 23:36:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-07-09 00:33:34 +0200 |
| commit | e67c0db714284d2eeba6be52ad075acaf002de08 (patch) | |
| tree | d9dae2dffc11a712e52727dac729ca8879562417 | |
| parent | bb07c53c501365b6380ae2c7e1a149b955d13d4d (diff) | |
Add conversion of FileTransferProtocol to and from string.
| -rw-r--r-- | src/lib/types.cc | 31 | ||||
| -rw-r--r-- | src/lib/types.h | 6 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/types.cc b/src/lib/types.cc index 28d58f36b..0be90e5c7 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -111,3 +111,34 @@ reel_type_to_string(ReelType type) DCPOMATIC_ASSERT(false); return "single"; } + + + +FileTransferProtocol +file_transfer_protocol_from_string(string s) +{ + if (s == "scp") { + return FileTransferProtocol::SCP; + } else if (s == "ftp") { + return FileTransferProtocol::FTP; + } + + DCPOMATIC_ASSERT(false); + return FileTransferProtocol::SCP; +} + + +string +file_transfer_protocol_to_string(FileTransferProtocol p) +{ + switch (p) { + case FileTransferProtocol::SCP: + return "scp"; + case FileTransferProtocol::FTP: + return "ftp"; + default: + DCPOMATIC_ASSERT(false); + } + + return ""; +} diff --git a/src/lib/types.h b/src/lib/types.h index f6b0fb3be..9cc20d8b4 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -139,11 +139,17 @@ struct CPLSummary time_t last_write_time; }; + enum class FileTransferProtocol { SCP, FTP }; + +FileTransferProtocol file_transfer_protocol_from_string(std::string s); +std::string file_transfer_protocol_to_string(FileTransferProtocol p); + + enum class EmailProtocol { AUTO, PLAIN, |
