From f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Nov 2013 22:16:57 +0100 Subject: Boost/C++11 shared pointers. --- examples/example3.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'examples/example3.cpp') diff --git a/examples/example3.cpp b/examples/example3.cpp index 31e26534..56b3c7e7 100644 --- a/examples/example3.cpp +++ b/examples/example3.cpp @@ -52,12 +52,12 @@ int main() mb.setExpeditor(vmime::mailbox("me@somewhere.com")); vmime::addressList to; - to.appendAddress(vmime::create ("you@elsewhere.com")); + to.appendAddress(vmime::make_shared ("you@elsewhere.com")); mb.setRecipients(to); vmime::addressList bcc; - bcc.appendAddress(vmime::create ("you-bcc@nowhere.com")); + bcc.appendAddress(vmime::make_shared ("you-bcc@nowhere.com")); mb.setBlindCopyRecipients(bcc); @@ -69,35 +69,35 @@ int main() // Fill in the text part: the message is available in two formats: HTML and plain text. // HTML text part also includes an inline image (embedded into the message). - vmime::htmlTextPart& textPart = *mb.getTextPart().dynamicCast (); + vmime::htmlTextPart& textPart = *vmime::dynamicCast (mb.getTextPart()); // -- embed an image (the returned "CID" (content identifier) is used to reference // -- the image into HTML content). - vmime::ref fs = + vmime::shared_ptr fs = vmime::platform::getHandler()->getFileSystemFactory(); - vmime::ref imageFile = + vmime::shared_ptr imageFile = fs->create(fs->stringToPath("/path/to/image.jpg")); - vmime::ref fileReader = + vmime::shared_ptr fileReader = imageFile->getFileReader(); - vmime::ref imageCts = - vmime::create + vmime::shared_ptr imageCts = + vmime::make_shared (fileReader->getInputStream(), imageFile->getLength()); - vmime::ref obj = textPart.addObject + vmime::shared_ptr obj = textPart.addObject (imageCts, vmime::mediaType(vmime::mediaTypes::IMAGE, vmime::mediaTypes::IMAGE_JPEG)); // -- message text - textPart.setText(vmime::create + textPart.setText(vmime::make_shared (vmime::string("This is the HTML text.
" "getReferenceId() + vmime::string("\"/>"))); - textPart.setPlainText(vmime::create + textPart.setPlainText(vmime::make_shared ("This is the plain text (without HTML formatting).")); // Construction - vmime::ref msg = mb.construct(); + vmime::shared_ptr msg = mb.construct(); // Raw text generation vmime::string dataToSend = msg->generate(); -- cgit v1.2.3