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. --- src/word.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/word.cpp') diff --git a/src/word.cpp b/src/word.cpp index f55a66f3..cff5afe3 100644 --- a/src/word.cpp +++ b/src/word.cpp @@ -57,7 +57,7 @@ word::word(const string& buffer, const charset& charset) } -word* word::parseNext(const string& buffer, const string::size_type position, +ref word::parseNext(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition, bool prevIsEncoded, bool* isEncoded, bool isFirst) { @@ -101,7 +101,7 @@ word* word::parseNext(const string& buffer, const string::size_type position, if (!unencoded.empty()) { - word* w = new word(unencoded, charset(charsets::US_ASCII)); + ref w = vmime::create (unencoded, charset(charsets::US_ASCII)); w->setParsedBounds(position, pos); if (newPosition) @@ -158,7 +158,7 @@ word* word::parseNext(const string& buffer, const string::size_type position, pos += 2; // ?= - word* w = new word(); + ref w = vmime::create (); w->parse(buffer, wordStart, pos, NULL); if (newPosition) @@ -181,7 +181,7 @@ word* word::parseNext(const string& buffer, const string::size_type position, unencoded += string(buffer.begin() + startPos, buffer.begin() + end); - word* w = new word(unencoded, charset(charsets::US_ASCII)); + ref w = vmime::create (unencoded, charset(charsets::US_ASCII)); w->setParsedBounds(position, end); if (newPosition) @@ -193,15 +193,15 @@ word* word::parseNext(const string& buffer, const string::size_type position, return (w); } - return (NULL); + return (null); } -const std::vector word::parseMultiple(const string& buffer, const string::size_type position, +const std::vector > word::parseMultiple(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition) { - std::vector res; - word* w = NULL; + std::vector > res; + ref w; string::size_type pos = position; @@ -694,9 +694,9 @@ const string word::getConvertedText(const charset& dest) const } -word* word::clone() const +ref word::clone() const { - return new word(m_buffer, m_charset); + return vmime::create (m_buffer, m_charset); } @@ -730,9 +730,9 @@ void word::setBuffer(const string& buffer) } -const std::vector word::getChildComponents() const +const std::vector > word::getChildComponents() const { - return std::vector (); + return std::vector >(); } -- cgit v1.2.3