diff options
author | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-11-21 21:16:57 +0000 |
commit | f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 (patch) | |
tree | 2bdc90e361a8f6e0a81164cf67afec9f78f9b959 /examples/example3.cpp | |
parent | Per-protocol include files. (diff) | |
download | vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.tar.gz vmime-f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8.zip |
Boost/C++11 shared pointers.
Diffstat (limited to 'examples/example3.cpp')
-rw-r--r-- | examples/example3.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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("[email protected]")); vmime::addressList to; - to.appendAddress(vmime::create <vmime::mailbox>("[email protected]")); + to.appendAddress(vmime::make_shared <vmime::mailbox>("[email protected]")); mb.setRecipients(to); vmime::addressList bcc; - bcc.appendAddress(vmime::create <vmime::mailbox>("[email protected]")); + bcc.appendAddress(vmime::make_shared <vmime::mailbox>("[email protected]")); 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>(); + vmime::htmlTextPart& textPart = *vmime::dynamicCast <vmime::htmlTextPart>(mb.getTextPart()); // -- embed an image (the returned "CID" (content identifier) is used to reference // -- the image into HTML content). - vmime::ref <vmime::utility::fileSystemFactory> fs = + vmime::shared_ptr <vmime::utility::fileSystemFactory> fs = vmime::platform::getHandler()->getFileSystemFactory(); - vmime::ref <vmime::utility::file> imageFile = + vmime::shared_ptr <vmime::utility::file> imageFile = fs->create(fs->stringToPath("/path/to/image.jpg")); - vmime::ref <vmime::utility::fileReader> fileReader = + vmime::shared_ptr <vmime::utility::fileReader> fileReader = imageFile->getFileReader(); - vmime::ref <vmime::contentHandler> imageCts = - vmime::create <vmime::streamContentHandler> + vmime::shared_ptr <vmime::contentHandler> imageCts = + vmime::make_shared <vmime::streamContentHandler> (fileReader->getInputStream(), imageFile->getLength()); - vmime::ref <const vmime::htmlTextPart::embeddedObject> obj = textPart.addObject + vmime::shared_ptr <const vmime::htmlTextPart::embeddedObject> obj = textPart.addObject (imageCts, vmime::mediaType(vmime::mediaTypes::IMAGE, vmime::mediaTypes::IMAGE_JPEG)); // -- message text - textPart.setText(vmime::create <vmime::stringContentHandler> + textPart.setText(vmime::make_shared <vmime::stringContentHandler> (vmime::string("This is the <b>HTML text</b>.<br/>" "<img src=\"") + obj->getReferenceId() + vmime::string("\"/>"))); - textPart.setPlainText(vmime::create <vmime::stringContentHandler> + textPart.setPlainText(vmime::make_shared <vmime::stringContentHandler> ("This is the plain text (without HTML formatting).")); // Construction - vmime::ref <vmime::message> msg = mb.construct(); + vmime::shared_ptr <vmime::message> msg = mb.construct(); // Raw text generation vmime::string dataToSend = msg->generate(); |