Permalink
Browse files

Removed 'stringProxy' since COW std::string is no longer valid in C++11.

  • Loading branch information...
vincent-richard committed Sep 15, 2018
1 parent 0c81108 commit df135b5a8bc24af2bd8454dd61f4bf73b72a55b1
@@ -28,7 +28,6 @@
#include <limits>
#include "vmime/base.hpp"
#include "vmime/utility/stringProxy.hpp"
#include "vmime/utility/progressListener.hpp"
#include "vmime/encoding.hpp"
#include "vmime/mediaType.hpp"
@@ -34,7 +34,7 @@
#include "vmime/net/imap/IMAPStore.hpp"
#include "vmime/utility/outputStreamAdapter.hpp"
#include "vmime/utility/inputStreamStringProxyAdapter.hpp"
#include "vmime/utility/inputStreamStringAdapter.hpp"
namespace vmime {
@@ -87,7 +87,7 @@ void IMAPMessagePartContentHandler::generate(
msg->extractPart(part, tmp, NULL);
// Decode to another temporary buffer
utility::inputStreamStringProxyAdapter in(oss.str());
utility::inputStreamStringAdapter in(oss.str());
std::ostringstream oss2;
utility::outputStreamAdapter tmp2(oss2);
@@ -24,8 +24,8 @@
#include "vmime/stringContentHandler.hpp"
#include "vmime/utility/inputStreamStringAdapter.hpp"
#include "vmime/utility/inputStreamStringProxyAdapter.hpp"
#include "vmime/utility/outputStreamAdapter.hpp"
#include "vmime/utility/streamUtils.hpp"
namespace vmime {
@@ -57,28 +57,6 @@ stringContentHandler::stringContentHandler(
}
stringContentHandler::stringContentHandler(
const utility::stringProxy& str,
const vmime::encoding& enc
)
: m_encoding(enc),
m_string(str) {
}
stringContentHandler::stringContentHandler(
const string& buffer,
const size_t start,
const size_t end,
const vmime::encoding& enc
)
: m_encoding(enc),
m_string(buffer, start, end) {
}
stringContentHandler::~stringContentHandler() {
}
@@ -100,29 +78,10 @@ stringContentHandler& stringContentHandler::operator=(const stringContentHandler
}
void stringContentHandler::setData(const utility::stringProxy& str, const vmime::encoding& enc) {
m_encoding = enc;
m_string = str;
}
void stringContentHandler::setData(const string& buffer, const vmime::encoding& enc) {
m_encoding = enc;
m_string.set(buffer);
}
void stringContentHandler::setData(
const string& buffer,
const size_t start,
const size_t end,
const vmime::encoding& enc
) {
m_encoding = enc;
m_string.set(buffer, start, end);
m_string = buffer;
}
@@ -154,7 +113,7 @@ void stringContentHandler::generate(
theEncoder->getProperties()["maxlinelength"] = maxLineLength;
theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT);
utility::inputStreamStringProxyAdapter in(m_string);
utility::inputStreamStringAdapter in(m_string);
std::ostringstream oss;
utility::outputStreamAdapter tempOut(oss);
@@ -169,7 +128,7 @@ void stringContentHandler::generate(
// No encoding to perform
} else {
m_string.extract(os);
os.write(m_string.data(), m_string.length());
}
// Need to encode data before
@@ -179,7 +138,7 @@ void stringContentHandler::generate(
theEncoder->getProperties()["maxlinelength"] = maxLineLength;
theEncoder->getProperties()["text"] = (m_contentType.getType() == mediaTypes::TEXT);
utility::inputStreamStringProxyAdapter in(m_string);
utility::inputStreamStringAdapter in(m_string);
theEncoder->encode(in, os);
}
@@ -194,14 +153,17 @@ void stringContentHandler::extract(
// No decoding to perform
if (!isEncoded()) {
m_string.extract(os, 0, m_string.length(), progress);
utility::inputStreamStringAdapter in(m_string);
utility::progressListenerSizeAdapter plsa(progress, getLength());
utility::bufferedStreamCopy(in, os, m_string.length(), progress);
// Need to decode data
} else {
shared_ptr <utility::encoder::encoder> theDecoder = m_encoding.getEncoder();
utility::inputStreamStringProxyAdapter in(m_string);
utility::inputStreamStringAdapter in(m_string);
utility::progressListenerSizeAdapter plsa(progress, getLength());
theDecoder->decode(in, os, &plsa);
@@ -214,7 +176,10 @@ void stringContentHandler::extractRaw(
utility::progressListener* progress
) const {
m_string.extract(os, 0, m_string.length(), progress);
utility::inputStreamStringAdapter in(m_string);
utility::progressListenerSizeAdapter plsa(progress, getLength());
utility::bufferedStreamCopy(in, os, m_string.length(), progress);
}
@@ -42,51 +42,27 @@ class VMIME_EXPORT stringContentHandler : public contentHandler
const vmime::encoding& enc = NO_ENCODING
);
stringContentHandler(
const utility::stringProxy& str,
const vmime::encoding& enc = NO_ENCODING
);
stringContentHandler(
const string& buffer,
const size_t start,
const size_t end,
const vmime::encoding& enc = NO_ENCODING
);
~stringContentHandler();
stringContentHandler(const stringContentHandler& cts);
stringContentHandler& operator=(const stringContentHandler& cts);
shared_ptr <contentHandler> clone() const;
// Set the data contained in the body.
//
// The two first functions take advantage of the COW (copy-on-write) system that
// might be implemented into std::string. This is done using "stringProxy" object.
//
// Set "enc" parameter to anything other than NO_ENCODING if the data managed by
// this content handler is already encoded with the specified encoding (so, no
// encoding/decoding will be performed on generate()/extract()). Note that the
// data may be re-encoded (that is, decoded and encoded) if the encoding passed
// to generate() is different from this one...
void setData(
const utility::stringProxy& str,
const vmime::encoding& enc = NO_ENCODING
);
/** Set data contained in this object.
*
* @param buffer buffer containing data
* @param enc set to anything other than NO_ENCODING if the data managed by
* this content handler is already encoded with the specified encoding (so, no
* encoding/decoding will be performed on generate()/extract()). Note that the
* data may be re-encoded (that is, decoded and encoded) if the encoding passed
* to generate() is different from this one.
*/
void setData(
const string& buffer,
const vmime::encoding& enc = NO_ENCODING
);
void setData(
const string& buffer,
const size_t start,
const size_t end,
const vmime::encoding& enc = NO_ENCODING
);
stringContentHandler& operator=(const string& buffer);
@@ -121,7 +97,7 @@ class VMIME_EXPORT stringContentHandler : public contentHandler
vmime::encoding m_encoding;
// The actual data
utility::stringProxy m_string;
string m_string;
};

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit df135b5

Please sign in to comment.