From 2949fb51f13e1236d5c161f02e1c2c8541100e9f Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Oct 2004 15:05:47 +0000 Subject: Refactoring (see ChangeLog). --- src/mailboxField.cpp | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'src/mailboxField.cpp') diff --git a/src/mailboxField.cpp b/src/mailboxField.cpp index e4e0164c..3cd7d910 100644 --- a/src/mailboxField.cpp +++ b/src/mailboxField.cpp @@ -30,10 +30,16 @@ mailboxField::mailboxField() } +mailboxField::mailboxField(const mailboxField&) + : headerField(), genericField () +{ +} + + void mailboxField::parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition) { - m_mailbox.clear(); + getValue().clear(); // Here, we cannot simply call "m_mailbox.parse()" because it // may have more than one address specified (even if this field @@ -48,13 +54,13 @@ void mailboxField::parse(const string& buffer, const string::size_type position, // mailbox of the group mailboxGroup* group = static_cast (parsedAddress); - if (!group->empty()) - m_mailbox = *(group->begin()); + if (!group->isEmpty()) + getValue() = *(group->getMailboxAt(0)); } else { // Parse only if it is a mailbox - m_mailbox = *static_cast (parsedAddress); + getValue() = *static_cast (parsedAddress); } } @@ -65,31 +71,4 @@ void mailboxField::parse(const string& buffer, const string::size_type position, } -void mailboxField::generate(utility::outputStream& os, const string::size_type maxLineLength, - const string::size_type curLinePos, string::size_type* newLinePos) const -{ - string::size_type pos = curLinePos; - - headerField::generate(os, maxLineLength, pos, &pos); - - m_mailbox.generate(os, maxLineLength, pos, newLinePos); -} - - -mailboxField& mailboxField::operator=(const class mailbox& mailbox) -{ - m_mailbox = mailbox; - return (*this); -} - - -void mailboxField::copyFrom(const headerField& field) -{ - const mailboxField& source = dynamic_cast(field); - m_mailbox = source.m_mailbox; - - headerField::copyFrom(field); -} - - } // vmime -- cgit v1.2.3