| 1 | // |
| 2 | // MailRecipient.cpp |
| 3 | // |
| 4 | // Library: Net |
| 5 | // Package: Mail |
| 6 | // Module: MailRecipient |
| 7 | // |
| 8 | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/Net/MailRecipient.h" |
| 16 | #include <algorithm> |
| 17 | |
| 18 | |
| 19 | namespace Poco { |
| 20 | namespace Net { |
| 21 | |
| 22 | |
| 23 | MailRecipient::MailRecipient(): |
| 24 | _type(PRIMARY_RECIPIENT) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | |
| 29 | MailRecipient::MailRecipient(const MailRecipient& recipient): |
| 30 | _address(recipient._address), |
| 31 | _realName(recipient._realName), |
| 32 | _type(recipient._type) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | |
| 37 | MailRecipient::MailRecipient(RecipientType type, const std::string& address): |
| 38 | _address(address), |
| 39 | _type(type) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | |
| 44 | MailRecipient::MailRecipient(RecipientType type, const std::string& address, const std::string& realName): |
| 45 | _address(address), |
| 46 | _realName(realName), |
| 47 | _type(type) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | |
| 52 | MailRecipient::~MailRecipient() |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | |
| 57 | MailRecipient& MailRecipient::operator = (const MailRecipient& recipient) |
| 58 | { |
| 59 | if (this != &recipient) |
| 60 | { |
| 61 | MailRecipient tmp(recipient); |
| 62 | swap(tmp); |
| 63 | } |
| 64 | return *this; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | void MailRecipient::swap(MailRecipient& recipient) |
| 69 | { |
| 70 | std::swap(_type, recipient._type); |
| 71 | std::swap(_address, recipient._address); |
| 72 | std::swap(_realName, recipient._realName); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | void MailRecipient::setType(RecipientType type) |
| 77 | { |
| 78 | _type = type; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | void MailRecipient::setAddress(const std::string& address) |
| 83 | { |
| 84 | _address = address; |
| 85 | } |
| 86 | |
| 87 | |
| 88 | void MailRecipient::setRealName(const std::string& realName) |
| 89 | { |
| 90 | _realName = realName; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | } } // namespace Poco::Net |
| 95 | |