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. --- src/component.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/component.cpp') diff --git a/src/component.cpp b/src/component.cpp index d2138b60..cb013899 100644 --- a/src/component.cpp +++ b/src/component.cpp @@ -47,14 +47,14 @@ component::~component() void component::parse - (ref inputStream, const utility::stream::size_type length) + (shared_ptr inputStream, const utility::stream::size_type length) { parse(inputStream, 0, length, NULL); } void component::parse - (ref inputStream, const utility::stream::size_type position, + (shared_ptr inputStream, const utility::stream::size_type position, const utility::stream::size_type end, utility::stream::size_type* newPosition) { parse(parsingContext::getDefaultContext(), inputStream, position, end, newPosition); @@ -63,13 +63,13 @@ void component::parse void component::parse (const parsingContext& ctx, - ref inputStream, const utility::stream::size_type position, + shared_ptr inputStream, const utility::stream::size_type position, const utility::stream::size_type end, utility::stream::size_type* newPosition) { m_parsedOffset = m_parsedLength = 0; - ref seekableStream = - inputStream.dynamicCast (); + shared_ptr seekableStream = + dynamicCast (inputStream); if (seekableStream == NULL || end == 0) { @@ -84,8 +84,8 @@ void component::parse } else { - ref parser = - vmime::create (seekableStream); + shared_ptr parser = + make_shared (seekableStream); parseImpl(ctx, parser, position, end, newPosition); } @@ -136,7 +136,7 @@ void component::offsetParsedBounds(const utility::stream::size_type offset) m_parsedOffset += offset; // Offset parsed bounds of our children - std::vector > children = getChildComponents(); + std::vector > children = getChildComponents(); for (size_t i = 0, n = children.size() ; i < n ; ++i) children[i]->offsetParsedBounds(offset); @@ -144,7 +144,7 @@ void component::offsetParsedBounds(const utility::stream::size_type offset) void component::parseImpl - (const parsingContext& ctx, ref parser, + (const parsingContext& ctx, shared_ptr parser, const utility::stream::size_type position, const utility::stream::size_type end, utility::stream::size_type* newPosition) { @@ -169,11 +169,11 @@ void component::parseImpl // This is the default implementation for parsing from a string: // actually, we encapsulate the string buffer in an input stream, then use // the "parse from input stream" implementation - ref stream = - vmime::create (buffer); + shared_ptr stream = + make_shared (buffer); - ref parser = - vmime::create (stream); + shared_ptr parser = + make_shared (stream); parseImpl(ctx, parser, position, end, newPosition); } @@ -235,10 +235,10 @@ void component::setParsedBounds(const string::size_type start, const string::siz utility::stream::size_type component::getGeneratedSize(const generationContext& ctx) { - std::vector > children = getChildComponents(); + std::vector > children = getChildComponents(); utility::stream::size_type totalSize = 0; - for (std::vector >::iterator it = children.begin() ; it != children.end() ; ++it) + for (std::vector >::iterator it = children.begin() ; it != children.end() ; ++it) totalSize += (*it)->getGeneratedSize(ctx); return totalSize; -- cgit v1.2.3