From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- examples/example1.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'examples/example1.cpp') diff --git a/examples/example1.cpp b/examples/example1.cpp index 8cd271d3..f5c5aae3 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -48,24 +48,24 @@ int main() mb.setExpeditor(vmime::mailbox("me@somewhere.com")); vmime::addressList to; - to.appendAddress(new vmime::mailbox("you@elsewhere.com")); + to.appendAddress(vmime::create ("you@elsewhere.com")); mb.setRecipients(to); vmime::addressList bcc; - bcc.appendAddress(new vmime::mailbox("you-bcc@nowhere.com")); + bcc.appendAddress(vmime::create ("you-bcc@nowhere.com")); 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 ( "I'm writing this short text to test message construction " \ "using the vmime::messageBuilder component.")); // Construction - vmime::message* msg = mb.construct(); + vmime::ref msg = mb.construct(); // Raw text generation std::cout << "Generated message:" << std::endl; @@ -73,9 +73,6 @@ int main() vmime::utility::outputStreamAdapter out(std::cout); msg->generate(out); - - // Destruction - delete (msg); } // VMime exception catch (vmime::exception& e) -- cgit v1.2.3