Replaced & with ref<> + clean up.
This commit is contained in:
parent
9a42c8bca4
commit
27840a441d
@ -251,7 +251,7 @@ void attachmentHelper::addAttachment(ref <message> msg, ref <attachment> att)
|
||||
}
|
||||
|
||||
// Generate the attachment part
|
||||
att->generateIn(*part);
|
||||
att->generateIn(part);
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ ref <const contentTypeField> bodyPartAttachment::getContentType() const
|
||||
}
|
||||
|
||||
|
||||
void bodyPartAttachment::generateIn(bodyPart& /* parent */) const
|
||||
void bodyPartAttachment::generateIn(ref <bodyPart> /* parent */) const
|
||||
{
|
||||
// Not used
|
||||
}
|
||||
|
@ -76,56 +76,56 @@ defaultAttachment& defaultAttachment::operator=(const defaultAttachment& attach)
|
||||
}
|
||||
|
||||
|
||||
void defaultAttachment::generateIn(bodyPart& parent) const
|
||||
void defaultAttachment::generateIn(ref <bodyPart> parent) const
|
||||
{
|
||||
// Create and append a new part for this attachment
|
||||
ref <bodyPart> part = vmime::create <bodyPart>();
|
||||
parent.getBody()->appendPart(part);
|
||||
parent->getBody()->appendPart(part);
|
||||
|
||||
generatePart(*part);
|
||||
generatePart(part);
|
||||
}
|
||||
|
||||
|
||||
void defaultAttachment::generatePart(bodyPart& part) const
|
||||
void defaultAttachment::generatePart(ref <bodyPart> part) const
|
||||
{
|
||||
// Set header fields
|
||||
part.getHeader()->ContentType()->setValue(m_type);
|
||||
if (!m_desc.isEmpty()) part.getHeader()->ContentDescription()->setValue(m_desc);
|
||||
part.getHeader()->ContentTransferEncoding()->setValue(m_encoding);
|
||||
part.getHeader()->ContentDisposition()->setValue(contentDisposition(contentDispositionTypes::ATTACHMENT));
|
||||
part->getHeader()->ContentType()->setValue(m_type);
|
||||
if (!m_desc.isEmpty()) part->getHeader()->ContentDescription()->setValue(m_desc);
|
||||
part->getHeader()->ContentTransferEncoding()->setValue(m_encoding);
|
||||
part->getHeader()->ContentDisposition()->setValue(contentDisposition(contentDispositionTypes::ATTACHMENT));
|
||||
|
||||
// Set contents
|
||||
part.getBody()->setContents(m_data);
|
||||
part->getBody()->setContents(m_data);
|
||||
}
|
||||
|
||||
|
||||
const mediaType defaultAttachment::getType() const
|
||||
{
|
||||
return (m_type);
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
const text defaultAttachment::getDescription() const
|
||||
{
|
||||
return (m_desc);
|
||||
return m_desc;
|
||||
}
|
||||
|
||||
|
||||
const word defaultAttachment::getName() const
|
||||
{
|
||||
return (m_name);
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
const ref <const contentHandler> defaultAttachment::getData() const
|
||||
{
|
||||
return (m_data);
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
||||
const encoding defaultAttachment::getEncoding() const
|
||||
{
|
||||
return (m_encoding);
|
||||
return m_encoding;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ void fileAttachment::setData(const string& filename)
|
||||
|
||||
if (!*file)
|
||||
{
|
||||
delete (file);
|
||||
delete file;
|
||||
throw exceptions::open_file_error();
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ void fileAttachment::setData(const string& filename)
|
||||
}
|
||||
|
||||
|
||||
void fileAttachment::generatePart(bodyPart& part) const
|
||||
void fileAttachment::generatePart(ref <bodyPart> part) const
|
||||
{
|
||||
defaultAttachment::generatePart(part);
|
||||
|
||||
ref <contentDispositionField> cdf = part.getHeader()->ContentDisposition().
|
||||
ref <contentDispositionField> cdf = part->getHeader()->ContentDisposition().
|
||||
dynamicCast <contentDispositionField>();
|
||||
|
||||
if (m_fileInfo.hasSize()) cdf->setSize(utility::stringUtils::toString(m_fileInfo.getSize()));
|
||||
@ -93,13 +93,13 @@ void fileAttachment::generatePart(bodyPart& part) const
|
||||
|
||||
const fileAttachment::fileInfo& fileAttachment::getFileInfo() const
|
||||
{
|
||||
return (m_fileInfo);
|
||||
return m_fileInfo;
|
||||
}
|
||||
|
||||
|
||||
fileAttachment::fileInfo& fileAttachment::getFileInfo()
|
||||
{
|
||||
return (m_fileInfo);
|
||||
return m_fileInfo;
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +95,7 @@ ref <message> generatedMessageAttachment::getMessage() const
|
||||
}
|
||||
|
||||
|
||||
void generatedMessageAttachment::generateIn(bodyPart& /* parent */) const
|
||||
void generatedMessageAttachment::generateIn(ref <bodyPart> /* parent */) const
|
||||
{
|
||||
// Not used (see 'parsedMessageAttachment')
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ ref <message> messageBuilder::construct() const
|
||||
for (std::vector <ref <attachment> >::const_iterator a = m_attach.begin() ;
|
||||
a != m_attach.end() ; ++a)
|
||||
{
|
||||
(*a)->generateIn(*msg);
|
||||
(*a)->generateIn(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,11 +95,11 @@ ref <message> parsedMessageAttachment::getMessage() const
|
||||
}
|
||||
|
||||
|
||||
void parsedMessageAttachment::generateIn(bodyPart& parent) const
|
||||
void parsedMessageAttachment::generateIn(ref <bodyPart> parent) const
|
||||
{
|
||||
// Create and append a new part for this attachment
|
||||
ref <bodyPart> part = vmime::create <bodyPart>();
|
||||
parent.getBody()->appendPart(part);
|
||||
parent->getBody()->appendPart(part);
|
||||
|
||||
// Set header fields
|
||||
part->getHeader()->ContentType()->setValue(getType());
|
||||
|
@ -108,7 +108,7 @@ protected:
|
||||
*
|
||||
* @param parent body part in which to generate the attachment
|
||||
*/
|
||||
virtual void generateIn(bodyPart& parent) const = 0;
|
||||
virtual void generateIn(ref <bodyPart> parent) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void generateIn(bodyPart& parent) const;
|
||||
void generateIn(ref <bodyPart> parent) const;
|
||||
|
||||
ref <const contentDispositionField> getContentDisposition() const;
|
||||
ref <const contentTypeField> getContentType() const;
|
||||
|
@ -74,11 +74,11 @@ protected:
|
||||
private:
|
||||
|
||||
// No need to override "generateIn", use "generatePart" instead (see below).
|
||||
void generateIn(bodyPart& parent) const;
|
||||
void generateIn(ref <bodyPart> parent) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void generatePart(bodyPart& part) const;
|
||||
virtual void generatePart(ref <bodyPart> part) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -166,7 +166,7 @@ private:
|
||||
|
||||
fileInfo m_fileInfo;
|
||||
|
||||
void generatePart(bodyPart& part) const;
|
||||
void generatePart(ref <bodyPart> part) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void generateIn(bodyPart& parent) const;
|
||||
void generateIn(ref <bodyPart> parent) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void generateIn(bodyPart& parent) const;
|
||||
void generateIn(ref <bodyPart> parent) const;
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user