diff options
author | Vincent Richard <[email protected]> | 2004-10-21 15:05:47 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2004-10-21 15:05:47 +0000 |
commit | 2949fb51f13e1236d5c161f02e1c2c8541100e9f (patch) | |
tree | 991edcf50483116ce83977a4d9e652de8c5328dc /src/mailboxField.cpp | |
parent | header class unit tests added (diff) | |
download | vmime-2949fb51f13e1236d5c161f02e1c2c8541100e9f.tar.gz vmime-2949fb51f13e1236d5c161f02e1c2c8541100e9f.zip |
Refactoring (see ChangeLog).
Diffstat (limited to 'src/mailboxField.cpp')
-rw-r--r-- | src/mailboxField.cpp | 41 |
1 files changed, 10 insertions, 31 deletions
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 <mailbox>() +{ +} + + 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 <mailboxGroup*>(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 <mailbox*>(parsedAddress); + getValue() = *static_cast <mailbox*>(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<const mailboxField&>(field); - m_mailbox = source.m_mailbox; - - headerField::copyFrom(field); -} - - } // vmime |