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/bodyPart.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) (limited to 'src/bodyPart.cpp') diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp index 522a34cd..ec046ce2 100644 --- a/src/bodyPart.cpp +++ b/src/bodyPart.cpp @@ -25,7 +25,7 @@ namespace vmime bodyPart::bodyPart() - : m_body(*this), m_parent(NULL) + : m_body(this), m_parent(NULL) { } @@ -64,12 +64,59 @@ bodyPart* bodyPart::clone() const bodyPart* p = new bodyPart; p->m_parent = NULL; - p->m_header = m_header; - p->m_body = m_body; + + p->m_header.copyFrom(m_header); + p->m_body.copyFrom(m_body); return (p); } +void bodyPart::copyFrom(const component& other) +{ + const bodyPart& bp = dynamic_cast (other); + + m_header = bp.m_header; + m_body = bp.m_body; +} + + +bodyPart& bodyPart::operator=(const bodyPart& other) +{ + copyFrom(other); + return (*this); +} + + +const header* bodyPart::getHeader() const +{ + return (&m_header); +} + + +header* bodyPart::getHeader() +{ + return (&m_header); +} + + +const body* bodyPart::getBody() const +{ + return (&m_body); +} + + +body* bodyPart::getBody() +{ + return (&m_body); +} + + +bodyPart* bodyPart::getParentPart() const +{ + return (m_parent); +} + + } // vmime -- cgit