aboutsummaryrefslogtreecommitdiffstats
path: root/examples/example2.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-07-12 22:28:02 +0000
committerVincent Richard <[email protected]>2005-07-12 22:28:02 +0000
commit681297e10b666e13cc463f6fbb16236f36c3266c (patch)
tree5d2392e2283232ed3475cd9c69e22897b03e8a97 /examples/example2.cpp
parentAdded contentHandler::extractRaw(). (diff)
downloadvmime-681297e10b666e13cc463f6fbb16236f36c3266c.tar.gz
vmime-681297e10b666e13cc463f6fbb16236f36c3266c.zip
Reference counting and smart pointers.
Diffstat (limited to 'examples/example2.cpp')
-rw-r--r--examples/example2.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/examples/example2.cpp b/examples/example2.cpp
index 70389076..ef4759aa 100644
--- a/examples/example2.cpp
+++ b/examples/example2.cpp
@@ -48,24 +48,24 @@ int main()
mb.setExpeditor(vmime::mailbox("[email protected]"));
vmime::addressList to;
- to.appendAddress(new vmime::mailbox("[email protected]"));
+ to.appendAddress(vmime::create <vmime::mailbox>("[email protected]"));
mb.setRecipients(to);
vmime::addressList bcc;
- bcc.appendAddress(new vmime::mailbox("[email protected]"));
+ bcc.appendAddress(vmime::create <vmime::mailbox>("[email protected]"));
mb.setBlindCopyRecipients(bcc);
mb.setSubject(vmime::text("My first message generated with vmime::messageBuilder"));
// Message body
- mb.getTextPart()->setText(vmime::stringContentHandler(
+ mb.getTextPart()->setText(vmime::create <vmime::stringContentHandler>(
"I'm writing this short text to test message construction " \
"with attachment, using the vmime::messageBuilder component."));
// Adding an attachment
- vmime::fileAttachment* a = new vmime::fileAttachment
+ vmime::ref <vmime::fileAttachment> a = vmime::create <vmime::fileAttachment>
(
"./example2.cpp", // full path to file
vmime::mediaType("application/octet-stream"), // content type
@@ -78,7 +78,7 @@ int main()
mb.attach(a);
// Construction
- vmime::message* msg = mb.construct();
+ vmime::ref <vmime::message> msg = mb.construct();
// Raw text generation
vmime::string dataToSend = msg->generate();
@@ -87,9 +87,6 @@ int main()
std::cout << "==================" << std::endl;
std::cout << std::endl;
std::cout << dataToSend << std::endl;
-
- // Destruction
- delete (msg);
}
// VMime exception
catch (vmime::exception& e)