From c433e0213aeec09dd5b0b5d8ecac45e675854485 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 25 Oct 2004 11:15:53 +0000 Subject: [PATCH] Added specialization for typeAdapter ::parse() as it took only the first word of the text (operator<<). --- SConstruct | 2 +- src/typeAdapter.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/typeAdapter.hpp | 5 +++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/typeAdapter.cpp diff --git a/SConstruct b/SConstruct index 93b0d23a..052c034f 100644 --- a/SConstruct +++ b/SConstruct @@ -82,7 +82,7 @@ libvmime_sources = [ 'text.cpp', 'text.hpp', 'textPartFactory.cpp', 'textPartFactory.hpp', 'textPart.hpp', - 'typeAdapter.hpp', + 'typeAdapter.cpp', 'typeAdapter.hpp', 'types.hpp', 'word.cpp', 'word.hpp', 'vmime', diff --git a/src/typeAdapter.cpp b/src/typeAdapter.cpp new file mode 100644 index 00000000..58b42a01 --- /dev/null +++ b/src/typeAdapter.cpp @@ -0,0 +1,39 @@ +// +// VMime library (http://vmime.sourceforge.net) +// Copyright (C) 2002-2004 Vincent Richard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + + +#include "typeAdapter.hpp" + + +namespace vmime +{ + + +template <> +void typeAdapter ::parse(const string& buffer, const string::size_type position, + const string::size_type end, string::size_type* newPosition) +{ + m_value = string(buffer.begin() + position, buffer.begin() + end); + + if (newPosition) + *newPosition = end; +} + + +} // vmime diff --git a/src/typeAdapter.hpp b/src/typeAdapter.hpp index 1e67ab33..6405b108 100644 --- a/src/typeAdapter.hpp +++ b/src/typeAdapter.hpp @@ -113,6 +113,11 @@ private: }; +template <> +void typeAdapter ::parse(const string& buffer, const string::size_type position, + const string::size_type end, string::size_type* newPosition); + + } // vmime