aboutsummaryrefslogtreecommitdiffstats
path: root/vmime
diff options
context:
space:
mode:
Diffstat (limited to 'vmime')
-rw-r--r--vmime/address.hpp4
-rw-r--r--vmime/addressList.hpp28
-rw-r--r--vmime/attachment.hpp8
-rw-r--r--vmime/attachmentHelper.hpp22
-rw-r--r--vmime/base.hpp129
-rw-r--r--vmime/body.hpp49
-rw-r--r--vmime/bodyPart.hpp49
-rw-r--r--vmime/bodyPartAttachment.hpp22
-rw-r--r--vmime/charset.hpp4
-rw-r--r--vmime/charsetConverter.hpp6
-rw-r--r--vmime/charsetConverter_iconv.hpp2
-rw-r--r--vmime/charsetConverter_icu.hpp2
-rw-r--r--vmime/charsetConverter_idna.hpp2
-rw-r--r--vmime/component.hpp12
-rw-r--r--vmime/contentDisposition.hpp4
-rw-r--r--vmime/contentDispositionField.hpp2
-rw-r--r--vmime/contentHandler.hpp3
-rw-r--r--vmime/contentTypeField.hpp2
-rw-r--r--vmime/dateTime.hpp4
-rw-r--r--vmime/defaultAttachment.hpp16
-rw-r--r--vmime/disposition.hpp4
-rw-r--r--vmime/emailAddress.hpp4
-rw-r--r--vmime/emptyContentHandler.hpp2
-rw-r--r--vmime/encoding.hpp10
-rw-r--r--vmime/fileAttachment.hpp10
-rw-r--r--vmime/fileContentHandler.hpp8
-rw-r--r--vmime/generatedMessageAttachment.hpp16
-rw-r--r--vmime/header.hpp68
-rw-r--r--vmime/headerField.hpp40
-rw-r--r--vmime/headerFieldFactory.hpp14
-rw-r--r--vmime/htmlTextPart.hpp36
-rw-r--r--vmime/mailbox.hpp4
-rw-r--r--vmime/mailboxField.hpp2
-rw-r--r--vmime/mailboxGroup.hpp26
-rw-r--r--vmime/mailboxList.hpp26
-rw-r--r--vmime/mdn/MDNHelper.hpp20
-rw-r--r--vmime/mdn/MDNInfos.hpp2
-rw-r--r--vmime/mdn/receivedMDNInfos.hpp6
-rw-r--r--vmime/mdn/sendableMDNInfos.hpp6
-rw-r--r--vmime/mediaType.hpp4
-rw-r--r--vmime/messageAttachment.hpp2
-rw-r--r--vmime/messageBuilder.hpp20
-rw-r--r--vmime/messageId.hpp6
-rw-r--r--vmime/messageIdSequence.hpp26
-rw-r--r--vmime/messageParser.hpp22
-rw-r--r--vmime/misc/importanceHelper.hpp12
-rw-r--r--vmime/net/events.hpp30
-rw-r--r--vmime/net/folder.hpp30
-rw-r--r--vmime/net/folderStatus.hpp2
-rw-r--r--vmime/net/imap/IMAPConnection.hpp28
-rw-r--r--vmime/net/imap/IMAPFolder.hpp37
-rw-r--r--vmime/net/imap/IMAPFolderStatus.hpp2
-rw-r--r--vmime/net/imap/IMAPMessage.hpp36
-rw-r--r--vmime/net/imap/IMAPMessagePart.hpp28
-rw-r--r--vmime/net/imap/IMAPMessagePartContentHandler.hpp8
-rw-r--r--vmime/net/imap/IMAPMessageStructure.hpp10
-rw-r--r--vmime/net/imap/IMAPParser.hpp40
-rw-r--r--vmime/net/imap/IMAPSStore.hpp2
-rw-r--r--vmime/net/imap/IMAPStore.hpp16
-rw-r--r--vmime/net/imap/IMAPUtils.hpp4
-rw-r--r--vmime/net/maildir/format/courierMaildirFormat.hpp2
-rw-r--r--vmime/net/maildir/format/kmailMaildirFormat.hpp2
-rw-r--r--vmime/net/maildir/maildirFolder.hpp34
-rw-r--r--vmime/net/maildir/maildirFolderStatus.hpp2
-rw-r--r--vmime/net/maildir/maildirFormat.hpp16
-rw-r--r--vmime/net/maildir/maildirMessage.hpp31
-rw-r--r--vmime/net/maildir/maildirMessagePart.hpp16
-rw-r--r--vmime/net/maildir/maildirMessageStructure.hpp14
-rw-r--r--vmime/net/maildir/maildirStore.hpp16
-rw-r--r--vmime/net/maildir/maildirUtils.hpp2
-rw-r--r--vmime/net/message.hpp26
-rw-r--r--vmime/net/pop3/POP3Command.hpp40
-rw-r--r--vmime/net/pop3/POP3Connection.hpp26
-rw-r--r--vmime/net/pop3/POP3Folder.hpp34
-rw-r--r--vmime/net/pop3/POP3FolderStatus.hpp2
-rw-r--r--vmime/net/pop3/POP3Message.hpp27
-rw-r--r--vmime/net/pop3/POP3Response.hpp16
-rw-r--r--vmime/net/pop3/POP3SStore.hpp2
-rw-r--r--vmime/net/pop3/POP3Store.hpp14
-rw-r--r--vmime/net/pop3/POP3Utils.hpp2
-rw-r--r--vmime/net/sendmail/sendmailTransport.hpp4
-rw-r--r--vmime/net/service.hpp36
-rw-r--r--vmime/net/serviceFactory.hpp30
-rw-r--r--vmime/net/serviceInfos.hpp4
-rw-r--r--vmime/net/session.hpp28
-rw-r--r--vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp6
-rw-r--r--vmime/net/smtp/SMTPCommand.hpp30
-rw-r--r--vmime/net/smtp/SMTPCommandSet.hpp14
-rw-r--r--vmime/net/smtp/SMTPConnection.hpp30
-rw-r--r--vmime/net/smtp/SMTPResponse.hpp10
-rw-r--r--vmime/net/smtp/SMTPSTransport.hpp2
-rw-r--r--vmime/net/smtp/SMTPTransport.hpp10
-rw-r--r--vmime/net/socket.hpp4
-rw-r--r--vmime/net/store.hpp8
-rw-r--r--vmime/net/timeoutHandler.hpp2
-rw-r--r--vmime/net/tls/TLSProperties.hpp2
-rw-r--r--vmime/net/tls/TLSSecuredConnectionInfos.hpp8
-rw-r--r--vmime/net/tls/TLSSession.hpp6
-rw-r--r--vmime/net/tls/TLSSocket.hpp6
-rw-r--r--vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp10
-rw-r--r--vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp14
-rw-r--r--vmime/net/tls/openssl/OpenSSLInitializer.hpp4
-rw-r--r--vmime/net/tls/openssl/TLSSession_OpenSSL.hpp10
-rw-r--r--vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp14
-rw-r--r--vmime/net/transport.hpp10
-rw-r--r--vmime/object.hpp49
-rw-r--r--vmime/parameter.hpp8
-rw-r--r--vmime/parameterizedHeaderField.hpp30
-rw-r--r--vmime/parsedMessageAttachment.hpp16
-rw-r--r--vmime/path.hpp4
-rw-r--r--vmime/plainTextPart.hpp10
-rw-r--r--vmime/platform.hpp16
-rw-r--r--vmime/platforms/posix/posixChildProcess.hpp10
-rw-r--r--vmime/platforms/posix/posixFile.hpp16
-rw-r--r--vmime/platforms/posix/posixHandler.hpp14
-rw-r--r--vmime/platforms/posix/posixSocket.hpp8
-rw-r--r--vmime/platforms/windows/windowsFile.hpp16
-rw-r--r--vmime/platforms/windows/windowsHandler.hpp12
-rw-r--r--vmime/platforms/windows/windowsSocket.hpp8
-rw-r--r--vmime/propertySet.hpp18
-rw-r--r--vmime/relay.hpp4
-rw-r--r--vmime/security/authenticator.hpp2
-rw-r--r--vmime/security/cert/X509Certificate.hpp8
-rw-r--r--vmime/security/cert/certificate.hpp2
-rw-r--r--vmime/security/cert/certificateChain.hpp6
-rw-r--r--vmime/security/cert/certificateVerifier.hpp2
-rw-r--r--vmime/security/cert/defaultCertificateVerifier.hpp12
-rw-r--r--vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp12
-rw-r--r--vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp16
-rw-r--r--vmime/security/defaultAuthenticator.hpp6
-rw-r--r--vmime/security/digest/messageDigestFactory.hpp12
-rw-r--r--vmime/security/sasl/SASLAuthenticator.hpp10
-rw-r--r--vmime/security/sasl/SASLContext.hpp10
-rw-r--r--vmime/security/sasl/SASLMechanism.hpp6
-rw-r--r--vmime/security/sasl/SASLMechanismFactory.hpp14
-rw-r--r--vmime/security/sasl/SASLSession.hpp18
-rw-r--r--vmime/security/sasl/SASLSocket.hpp6
-rw-r--r--vmime/security/sasl/builtinSASLMechanism.hpp10
-rw-r--r--vmime/security/sasl/defaultSASLAuthenticator.hpp24
-rw-r--r--vmime/streamContentHandler.hpp8
-rw-r--r--vmime/stringContentHandler.hpp2
-rw-r--r--vmime/text.hpp26
-rw-r--r--vmime/textPart.hpp8
-rw-r--r--vmime/textPartFactory.hpp8
-rw-r--r--vmime/types.hpp56
-rw-r--r--vmime/utility/childProcess.hpp6
-rw-r--r--vmime/utility/encoder/encoderFactory.hpp28
-rw-r--r--vmime/utility/file.hpp16
-rw-r--r--vmime/utility/parserInputStreamAdapter.hpp6
-rw-r--r--vmime/utility/seekableInputStreamRegionAdapter.hpp4
-rw-r--r--vmime/utility/smartPtr.hpp550
-rw-r--r--vmime/utility/smartPtrInt.hpp113
-rw-r--r--vmime/utility/sync/autoLock.hpp4
-rw-r--r--vmime/word.hpp8
-rw-r--r--vmime/wordEncoder.hpp2
155 files changed, 1125 insertions, 1800 deletions
diff --git a/vmime/address.hpp b/vmime/address.hpp
index 3c0c0b2a..110e1e6b 100644
--- a/vmime/address.hpp
+++ b/vmime/address.hpp
@@ -61,7 +61,7 @@ public:
*/
virtual bool isGroup() const = 0;
- virtual ref <component> clone() const = 0;
+ virtual shared_ptr <component> clone() const = 0;
/** Parse an address from an input buffer.
*
@@ -74,7 +74,7 @@ public:
* of a group (end delimiter was found), or false otherwise (may be set to NULL)
* @return a new address object, or null if no more address is available in the input buffer
*/
- static ref <address> parseNext
+ static shared_ptr <address> parseNext
(const parsingContext& ctx, const string& buffer,
const string::size_type position, const string::size_type end,
string::size_type* newPosition, bool *isLastAddressOfGroup);
diff --git a/vmime/addressList.hpp b/vmime/addressList.hpp
index 9fd5ab08..2958000b 100644
--- a/vmime/addressList.hpp
+++ b/vmime/addressList.hpp
@@ -51,19 +51,19 @@ public:
~addressList();
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
addressList& operator=(const addressList& other);
addressList& operator=(const mailboxList& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Add a address at the end of the list.
*
* @param addr address to append
*/
- void appendAddress(ref <address> addr);
+ void appendAddress(shared_ptr <address> addr);
/** Insert a new address before the specified address.
*
@@ -71,7 +71,7 @@ public:
* @param addr address to insert
* @throw exceptions::no_such_address if the address is not in the list
*/
- void insertAddressBefore(ref <address> beforeAddress, ref <address> addr);
+ void insertAddressBefore(shared_ptr <address> beforeAddress, shared_ptr <address> addr);
/** Insert a new address before the specified position.
*
@@ -79,7 +79,7 @@ public:
* the beginning of the list)
* @param addr address to insert
*/
- void insertAddressBefore(const size_t pos, ref <address> addr);
+ void insertAddressBefore(const size_t pos, shared_ptr <address> addr);
/** Insert a new address after the specified address.
*
@@ -87,21 +87,21 @@ public:
* @param addr address to insert
* @throw exceptions::no_such_address if the address is not in the list
*/
- void insertAddressAfter(ref <address> afterAddress, ref <address> addr);
+ void insertAddressAfter(shared_ptr <address> afterAddress, shared_ptr <address> addr);
/** Insert a new address after the specified position.
*
* @param pos position of the address before the new address
* @param addr address to insert
*/
- void insertAddressAfter(const size_t pos, ref <address> addr);
+ void insertAddressAfter(const size_t pos, shared_ptr <address> addr);
/** Remove the specified address from the list.
*
* @param addr address to remove
* @throw exceptions::no_such_address if the address is not in the list
*/
- void removeAddress(ref <address> addr);
+ void removeAddress(shared_ptr <address> addr);
/** Remove the address at the specified position.
*
@@ -130,26 +130,26 @@ public:
* @param pos position
* @return address at position 'pos'
*/
- ref <address> getAddressAt(const size_t pos);
+ shared_ptr <address> getAddressAt(const size_t pos);
/** Return the address at the specified position.
*
* @param pos position
* @return address at position 'pos'
*/
- const ref <const address> getAddressAt(const size_t pos) const;
+ const shared_ptr <const address> getAddressAt(const size_t pos) const;
/** Return the address list.
*
* @return list of addresses
*/
- const std::vector <ref <const address> > getAddressList() const;
+ const std::vector <shared_ptr <const address> > getAddressList() const;
/** Return the address list.
*
* @return list of addresses
*/
- const std::vector <ref <address> > getAddressList();
+ const std::vector <shared_ptr <address> > getAddressList();
/** Return a list of mailboxes.
* If some addresses are actually groups, mailboxes are recursively
@@ -157,11 +157,11 @@ public:
*
* @return list of mailboxes
*/
- ref <mailboxList> toMailboxList() const;
+ shared_ptr <mailboxList> toMailboxList() const;
private:
- std::vector <ref <address> > m_list;
+ std::vector <shared_ptr <address> > m_list;
protected:
diff --git a/vmime/attachment.hpp b/vmime/attachment.hpp
index e131fcd0..9730bc6c 100644
--- a/vmime/attachment.hpp
+++ b/vmime/attachment.hpp
@@ -79,7 +79,7 @@ public:
*
* @return attachment data
*/
- virtual const ref <const contentHandler> getData() const = 0;
+ virtual const shared_ptr <const contentHandler> getData() const = 0;
/** Return the encoding used for this attachment.
*
@@ -93,14 +93,14 @@ public:
* @return attachment part or NULL if the attachment is not
* attached to a part
*/
- virtual ref <const object> getPart() const = 0;
+ virtual shared_ptr <const object> getPart() const = 0;
/** Return the header of the attachment part.
*
* @return attachment part header or NULL if the attachment
* is not attached to a part
*/
- virtual ref <const header> getHeader() const = 0;
+ virtual shared_ptr <const header> getHeader() const = 0;
protected:
@@ -108,7 +108,7 @@ protected:
*
* @param parent body part in which to generate the attachment
*/
- virtual void generateIn(ref <bodyPart> parent) const = 0;
+ virtual void generateIn(shared_ptr <bodyPart> parent) const = 0;
};
diff --git a/vmime/attachmentHelper.hpp b/vmime/attachmentHelper.hpp
index 0dd052cb..e03a4f7d 100644
--- a/vmime/attachmentHelper.hpp
+++ b/vmime/attachmentHelper.hpp
@@ -59,7 +59,7 @@ public:
* @param options search options (see FindOptions)
* @return true if the part is an attachment, false otherwise
*/
- static bool isBodyPartAnAttachment(ref <const bodyPart> part, const unsigned int options = 0);
+ static bool isBodyPartAnAttachment(shared_ptr <const bodyPart> part, const unsigned int options = 0);
/** Return attachment information in the specified body part.
* If the specified body part does not contain attachment
@@ -69,8 +69,8 @@ public:
* @param options search options (see FindOptions)
* @return attachment found in the part, or NULL
*/
- static ref <const attachment>
- getBodyPartAttachment(ref <const bodyPart> part, const unsigned int options = 0);
+ static shared_ptr <const attachment>
+ getBodyPartAttachment(shared_ptr <const bodyPart> part, const unsigned int options = 0);
/** Find all attachments contained in the specified part
* and all its children parts.
@@ -80,8 +80,8 @@ public:
* @param options search options (see FindOptions)
* @return a list of attachments found
*/
- static const std::vector <ref <const attachment> >
- findAttachmentsInBodyPart(ref <const bodyPart> part, const unsigned int options = 0);
+ static const std::vector <shared_ptr <const attachment> >
+ findAttachmentsInBodyPart(shared_ptr <const bodyPart> part, const unsigned int options = 0);
/** Find all attachments contained in the specified message.
* This is simply a recursive call to getBodyPartAttachment().
@@ -90,27 +90,27 @@ public:
* @param options search options (see FindOptions)
* @return a list of attachments found
*/
- static const std::vector <ref <const attachment> >
- findAttachmentsInMessage(ref <const message> msg, const unsigned int options = 0);
+ static const std::vector <shared_ptr <const attachment> >
+ findAttachmentsInMessage(shared_ptr <const message> msg, const unsigned int options = 0);
/** Add an attachment to the specified message.
*
* @param msg message into which to add the attachment
* @param att attachment to add
*/
- static void addAttachment(ref <message> msg, ref <attachment> att);
+ static void addAttachment(shared_ptr <message> msg, shared_ptr <attachment> att);
/** Add a message attachment to the specified message.
*
* @param msg message into which to add the attachment
* @param amsg message to attach
*/
- static void addAttachment(ref <message> msg, ref <message> amsg);
+ static void addAttachment(shared_ptr <message> msg, shared_ptr <message> amsg);
protected:
- static ref <bodyPart> findBodyPart
- (ref <bodyPart> part, const mediaType& type);
+ static shared_ptr <bodyPart> findBodyPart
+ (shared_ptr <bodyPart> part, const mediaType& type);
};
diff --git a/vmime/base.hpp b/vmime/base.hpp
index 2437514b..36938cb7 100644
--- a/vmime/base.hpp
+++ b/vmime/base.hpp
@@ -35,7 +35,6 @@
#include "vmime/config.hpp"
#include "vmime/types.hpp"
#include "vmime/constants.hpp"
-#include "vmime/utility/smartPtr.hpp"
namespace vmime
@@ -51,6 +50,19 @@ namespace vmime
extern VMIME_EXPORT const text NULL_TEXT;
extern VMIME_EXPORT const word NULL_WORD;
+#ifndef VMIME_BUILDING_DOC
+
+ // Null pointer
+ struct nullPtrType
+ {
+ template<typename T>
+ operator shared_ptr <T>() { return shared_ptr <T>(); }
+ };
+
+ extern nullPtrType VMIME_EXPORT null;
+
+#endif // VMIME_BUILDING_DOC
+
//
// Library name and version
@@ -66,13 +78,25 @@ namespace vmime
//
template <typename T, size_t N>
- inline T const* begin(T const (&array)[N])
+ inline T const* cbegin(T const (&array)[N])
{
return (array);
}
template <typename T, size_t N>
- inline T const* end(T const (&array)[N])
+ inline T const* cend(T const (&array)[N])
+ {
+ return (array + N);
+ }
+
+ template <typename T, size_t N>
+ inline T* begin(T (&array)[N])
+ {
+ return (array);
+ }
+
+ template <typename T, size_t N>
+ inline T* end(T (&array)[N])
{
return (array + N);
}
@@ -158,100 +182,49 @@ namespace vmime
namespace utility { }
-#ifndef VMIME_BUILDING_DOC
- /** Work-around for friend template functions.
- *
- * Make this class a friend if you want to be able to use
- * vmime::create() with private/protected constructors.
- */
- class VMIME_EXPORT creator
- {
- public:
-
- template <class T>
- static ref <T> create() { return ref <T>::fromPtr(new T); }
-
- template <class T, class P0>
- static ref <T> create(const P0& p0) { return ref <T>::fromPtr(new T(p0)); }
-
- template <class T, class P0, class P1>
- static ref <T> create(const P0& p0, const P1& p1) { return ref <T>::fromPtr(new T(p0, p1)); }
-
- template <class T, class P0, class P1, class P2>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2) { return ref <T>::fromPtr(new T(p0, p1, p2)); }
-
- template <class T, class P0, class P1, class P2, class P3>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2, const P3& p3) { return ref <T>::fromPtr(new T(p0, p1, p2, p3)); }
-
- template <class T, class P0, class P1, class P2, class P3, class P4>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2, const P3& p3, const P4& p4) { return ref <T>::fromPtr(new T(p0, p1, p2, p3, p4)); }
- };
-#endif // VMIME_BUILDING_DOC
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
+ /** Clone helper (using a shared_ptr).
+ * This is an alias for dynamic_pointer_cast <T>(obj->clone()).
*/
template <class T>
- static ref <T> create() { return creator::create <T>(); }
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
- */
- template <class T, class P0>
- static ref <T> create(const P0& p0) { return creator::create <T, P0>(p0); }
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
- */
- template <class T, class P0, class P1>
- static ref <T> create(const P0& p0, const P1& p1) { return creator::create <T, P0, P1>(p0, p1); }
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
- */
- template <class T, class P0, class P1, class P2>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2) { return creator::create <T, P0, P1, P2>(p0, p1, p2); }
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
- */
- template <class T, class P0, class P1, class P2, class P3>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2, const P3& p3) { return creator::create <T, P0, P1, P2, P3>(p0, p1, p2, p3); }
-
- /** Create a new object and return a reference to it.
- * @return reference to the new object
- */
- template <class T, class P0, class P1, class P2, class P3, class P4>
- static ref <T> create(const P0& p0, const P1& p1, const P2& p2, const P3& p3, const P4& p4) { return creator::create <T, P0, P1, P2, P3, P4>(p0, p1, p2, p3, p4); }
-
+ shared_ptr <T> clone(shared_ptr <T> obj)
+ {
+ return dynamic_pointer_cast <T>(obj->clone());
+ }
- /** Clone helper.
- * Use "vmime::clone(obj)" instead of "obj->clone().cast <objtype>()".
+ /** Clone helper (using a const shared_ptr).
+ * This is an alias for dynamic_pointer_cast <T>(obj->clone()).
*/
template <class T>
- ref <T> clone(ref <const T> x)
+ shared_ptr <T> clone(shared_ptr <const T> obj)
{
- return x->clone().template dynamicCast <T>();
+ return dynamic_pointer_cast <T>(obj->clone());
}
- /** Clone helper.
- * Use "vmime::clone(obj)" instead of "obj.clone().cast <objtype>()".
+ /** Clone helper (using a const reference).
+ * This is an alias for dynamic_pointer_cast <T>(obj.clone()).
*/
template <class T>
- ref <T> clone(const T& x)
+ shared_ptr <T> clone(const T& obj)
{
- return x.clone().template dynamicCast <T>();
+ return dynamic_pointer_cast <T>(obj.clone());
}
-
/** Downcast helper.
* Usage: vmime::dynamicCast <DerivedType>(obj), where 'obj' is of
* type Type, and DerivedType is derived from Type.
*/
template <class X, class Y>
- ref <X> dynamicCast(ref <Y> y)
+ shared_ptr <X> dynamicCast(shared_ptr <Y> obj)
+ {
+ return dynamic_pointer_cast <X, Y>(obj);
+ }
+
+ /** Const cast helper.
+ */
+ template <class X, class Y>
+ shared_ptr <X> constCast(const shared_ptr <Y>& obj)
{
- return y.template dynamicCast <X>();
+ return const_pointer_cast <X, Y>(obj);
}
/** Inherit from this class to indicate the subclass is not copyable,
diff --git a/vmime/body.hpp b/vmime/body.hpp
index 3f2ea483..465a7a81 100644
--- a/vmime/body.hpp
+++ b/vmime/body.hpp
@@ -60,7 +60,7 @@ public:
*
* @param part part to append
*/
- void appendPart(ref <bodyPart> part);
+ void appendPart(shared_ptr <bodyPart> part);
/** Insert a new part before the specified part.
*
@@ -68,7 +68,7 @@ public:
* @param part part to insert
* @throw exceptions::no_such_part if the part is not in the list
*/
- void insertPartBefore(ref <bodyPart> beforePart, ref <bodyPart> part);
+ void insertPartBefore(shared_ptr <bodyPart> beforePart, shared_ptr <bodyPart> part);
/** Insert a new part before the specified position.
*
@@ -76,7 +76,7 @@ public:
* the beginning of the list)
* @param part part to insert
*/
- void insertPartBefore(const size_t pos, ref <bodyPart> part);
+ void insertPartBefore(const size_t pos, shared_ptr <bodyPart> part);
/** Insert a new part after the specified part.
*
@@ -84,21 +84,21 @@ public:
* @param part part to insert
* @throw exceptions::no_such_part if the part is not in the list
*/
- void insertPartAfter(ref <bodyPart> afterPart, ref <bodyPart> part);
+ void insertPartAfter(shared_ptr <bodyPart> afterPart, shared_ptr <bodyPart> part);
/** Insert a new part after the specified position.
*
* @param pos position of the part before the new part
* @param part part to insert
*/
- void insertPartAfter(const size_t pos, ref <bodyPart> part);
+ void insertPartAfter(const size_t pos, shared_ptr <bodyPart> part);
/** Remove the specified part from the list.
*
* @param part part to remove
* @throw exceptions::no_such_part if the part is not in the list
*/
- void removePart(ref <bodyPart> part);
+ void removePart(shared_ptr <bodyPart> part);
/** Remove the part at the specified position.
*
@@ -127,26 +127,26 @@ public:
* @param pos position
* @return part at position 'pos'
*/
- ref <bodyPart> getPartAt(const size_t pos);
+ shared_ptr <bodyPart> getPartAt(const size_t pos);
/** Return the part at the specified position.
*
* @param pos position
* @return part at position 'pos'
*/
- const ref <const bodyPart> getPartAt(const size_t pos) const;
+ const shared_ptr <const bodyPart> getPartAt(const size_t pos) const;
/** Return the part list.
*
* @return list of parts
*/
- const std::vector <ref <const bodyPart> > getPartList() const;
+ const std::vector <shared_ptr <const bodyPart> > getPartList() const;
/** Return the part list.
*
* @return list of parts
*/
- const std::vector <ref <bodyPart> > getPartList();
+ const std::vector <shared_ptr <bodyPart> > getPartList();
/** Return the prolog text.
*
@@ -176,20 +176,20 @@ public:
*
* @return read-only body contents
*/
- const ref <const contentHandler> getContents() const;
+ const shared_ptr <const contentHandler> getContents() const;
/** Set the body contents.
*
* @param contents new body contents
*/
- void setContents(ref <const contentHandler> contents);
+ void setContents(shared_ptr <const contentHandler> contents);
/** Set the body contents and type.
*
* @param contents new body contents
* @param type type of contents
*/
- void setContents(ref <const contentHandler> contents, const mediaType& type);
+ void setContents(shared_ptr <const contentHandler> contents, const mediaType& type);
/** Set the body contents, type and charset.
*
@@ -197,7 +197,7 @@ public:
* @param type type of contents
* @param chset charset of contents
*/
- void setContents(ref <const contentHandler> contents, const mediaType& type, const charset& chset);
+ void setContents(shared_ptr <const contentHandler> contents, const mediaType& type, const charset& chset);
/** Set the body contents, type, charset and encoding.
*
@@ -206,7 +206,7 @@ public:
* @param chset charset of contents
* @param enc contents encoding
*/
- void setContents(ref <const contentHandler> contents, const mediaType& type,
+ void setContents(shared_ptr <const contentHandler> contents, const mediaType& type,
const charset& chset, const encoding& enc);
/** Set the MIME type and charset of contents.
@@ -274,11 +274,11 @@ public:
*/
static bool isValidBoundary(const string& boundary);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
body& operator=(const body& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
utility::stream::size_type getGeneratedSize(const generationContext& ctx);
@@ -287,22 +287,21 @@ private:
text getActualPrologText(const generationContext& ctx) const;
text getActualEpilogText(const generationContext& ctx) const;
- void setParentPart(ref <bodyPart> parent);
+ void setParentPart(bodyPart* parent);
string m_prologText;
string m_epilogText;
- ref <const contentHandler> m_contents;
+ shared_ptr <const contentHandler> m_contents;
- weak_ref <bodyPart> m_part;
- weak_ref <header> m_header;
+ bodyPart* m_part;
- std::vector <ref <bodyPart> > m_parts;
+ std::vector <shared_ptr <bodyPart> > m_parts;
bool isRootPart() const;
- void initNewPart(ref <bodyPart> part);
+ void initNewPart(shared_ptr <bodyPart> part);
protected:
@@ -319,14 +318,14 @@ protected:
* @return the position of the boundary string, or stream::npos if not found
*/
utility::stream::size_type findNextBoundaryPosition
- (ref <utility::parserInputStreamAdapter> parser, const string& boundary,
+ (shared_ptr <utility::parserInputStreamAdapter> parser, const string& boundary,
const utility::stream::size_type position, const utility::stream::size_type end,
utility::stream::size_type* boundaryStart, utility::stream::size_type* boundaryEnd);
// Component parsing & assembling
void parseImpl
(const parsingContext& ctx,
- ref <utility::parserInputStreamAdapter> parser,
+ shared_ptr <utility::parserInputStreamAdapter> parser,
const utility::stream::size_type position,
const utility::stream::size_type end,
utility::stream::size_type* newPosition = NULL);
diff --git a/vmime/bodyPart.hpp b/vmime/bodyPart.hpp
index 62365b8b..fd0deb73 100644
--- a/vmime/bodyPart.hpp
+++ b/vmime/bodyPart.hpp
@@ -46,78 +46,97 @@ class VMIME_EXPORT bodyPart : public component
public:
bodyPart();
- bodyPart(weak_ref <vmime::bodyPart> parentPart);
/** Return the header section of this part.
*
* @return header section
*/
- const ref <const header> getHeader() const;
+ const shared_ptr <const header> getHeader() const;
/** Return the header section of this part.
*
* @return header section
*/
- ref <header> getHeader();
+ shared_ptr <header> getHeader();
/** Replaces the header section of this part.
*
* @param header the new header of this part
*/
- void setHeader(ref <header> header);
+ void setHeader(shared_ptr <header> header);
/** Return the body section of this part.
*
* @return body section
*/
- const ref <const body> getBody() const;
+ const shared_ptr <const body> getBody() const;
/** Return the body section of this part.
*
* @return body section
*/
- ref <body> getBody();
+ shared_ptr <body> getBody();
/** Replaces the body section of this part.
*
* @param body new body section
*/
- void setBody(ref <body> body);
+ void setBody(shared_ptr <body> body);
/** Return the parent part of this part.
*
* @return parent part or NULL if not known
*/
- ref <bodyPart> getParentPart();
+ bodyPart* getParentPart();
/** Return the parent part of this part (const version).
*
* @return parent part or NULL if not known
*/
- ref <const bodyPart> getParentPart() const;
+ const bodyPart* getParentPart() const;
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
bodyPart& operator=(const bodyPart& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
utility::stream::size_type getGeneratedSize(const generationContext& ctx);
private:
- ref <header> m_header;
- ref <body> m_body;
+ shared_ptr <header> m_header;
+ mutable shared_ptr <body> m_body;
- weak_ref <bodyPart> m_parent;
+ // We can't use a weak_ptr<> here as the parent part may
+ // have been allocated on the stack
+ bodyPart* m_parent;
protected:
+ /** Creates and returns a new part and set this part as its
+ * parent. The newly created sub-part should then be added
+ * to this part by calling getBody()->appendPart(). Called
+ * by the body class.
+ *
+ * @return child part
+ */
+ shared_ptr <bodyPart> createChildPart();
+
+ /** Detach the specified part from its current parent part (if
+ * any) and attach it to this part by setting this part as its
+ * new parent. The sub-part should then be added to this part
+ * by calling getBody()->appendPart(). Called by body class.
+ *
+ * @param part child part to attach
+ */
+ void importChildPart(shared_ptr <bodyPart> part);
+
// Component parsing & assembling
void parseImpl
(const parsingContext& ctx,
- ref <utility::parserInputStreamAdapter> parser,
+ shared_ptr <utility::parserInputStreamAdapter> parser,
const utility::stream::size_type position,
const utility::stream::size_type end,
utility::stream::size_type* newPosition = NULL);
diff --git a/vmime/bodyPartAttachment.hpp b/vmime/bodyPartAttachment.hpp
index b885d020..e1a4a89a 100644
--- a/vmime/bodyPartAttachment.hpp
+++ b/vmime/bodyPartAttachment.hpp
@@ -42,33 +42,29 @@ namespace vmime
*/
class VMIME_EXPORT bodyPartAttachment : public attachment
{
- friend class creator;
-
-protected:
-
- bodyPartAttachment(ref <const bodyPart> part);
-
public:
+ bodyPartAttachment(shared_ptr <const bodyPart> part);
+
const mediaType getType() const;
const word getName() const;
const text getDescription() const;
const encoding getEncoding() const;
- const ref <const contentHandler> getData() const;
+ const shared_ptr <const contentHandler> getData() const;
- ref <const object> getPart() const;
- ref <const header> getHeader() const;
+ shared_ptr <const object> getPart() const;
+ shared_ptr <const header> getHeader() const;
private:
- void generateIn(ref <bodyPart> parent) const;
+ void generateIn(shared_ptr <bodyPart> parent) const;
- ref <const contentDispositionField> getContentDisposition() const;
- ref <const contentTypeField> getContentType() const;
+ shared_ptr <const contentDispositionField> getContentDisposition() const;
+ shared_ptr <const contentTypeField> getContentType() const;
- ref <const bodyPart> m_part;
+ shared_ptr <const bodyPart> m_part;
};
diff --git a/vmime/charset.hpp b/vmime/charset.hpp
index c77a2e01..9c1325c6 100644
--- a/vmime/charset.hpp
+++ b/vmime/charset.hpp
@@ -63,7 +63,7 @@ public:
bool operator==(const charset& value) const;
bool operator!=(const charset& value) const;
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Gets the recommended encoding for this charset.
* Note: there may be no recommended encoding.
@@ -117,7 +117,7 @@ public:
const charset& source, const charset& dest,
const charsetConverterOptions& opts = charsetConverterOptions());
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
private:
diff --git a/vmime/charsetConverter.hpp b/vmime/charsetConverter.hpp
index 9a4f8b37..07f38d8f 100644
--- a/vmime/charsetConverter.hpp
+++ b/vmime/charsetConverter.hpp
@@ -69,7 +69,7 @@ public:
* @param dest output charset
* @param opts conversion options
*/
- static ref <charsetConverter> create
+ static shared_ptr <charsetConverter> create
(const charset& source, const charset& dest,
const charsetConverterOptions& opts = charsetConverterOptions());
@@ -103,11 +103,11 @@ public:
* @param os stream into which filtered data will be written
* @return a filtered output stream, or NULL if not supported
*/
- virtual ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os) = 0;
+ virtual shared_ptr <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os) = 0;
private:
- static ref <charsetConverter> createGenericConverter
+ static shared_ptr <charsetConverter> createGenericConverter
(const charset& source, const charset& dest,
const charsetConverterOptions& opts);
};
diff --git a/vmime/charsetConverter_iconv.hpp b/vmime/charsetConverter_iconv.hpp
index a590b320..0309d848 100644
--- a/vmime/charsetConverter_iconv.hpp
+++ b/vmime/charsetConverter_iconv.hpp
@@ -59,7 +59,7 @@ public:
void convert(const string& in, string& out);
void convert(utility::inputStream& in, utility::outputStream& out);
- ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
+ shared_ptr <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
private:
diff --git a/vmime/charsetConverter_icu.hpp b/vmime/charsetConverter_icu.hpp
index c693775e..91cf0b86 100644
--- a/vmime/charsetConverter_icu.hpp
+++ b/vmime/charsetConverter_icu.hpp
@@ -62,7 +62,7 @@ public:
void convert(const string& in, string& out);
void convert(utility::inputStream& in, utility::outputStream& out);
- ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
+ shared_ptr <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
private:
diff --git a/vmime/charsetConverter_idna.hpp b/vmime/charsetConverter_idna.hpp
index d3b8b25f..874d6bf1 100644
--- a/vmime/charsetConverter_idna.hpp
+++ b/vmime/charsetConverter_idna.hpp
@@ -53,7 +53,7 @@ public:
void convert(const string& in, string& out);
void convert(utility::inputStream& in, utility::outputStream& out);
- ref <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
+ shared_ptr <utility::charsetFilteredOutputStream> getFilteredOutputStream(utility::outputStream& os);
private:
diff --git a/vmime/component.hpp b/vmime/component.hpp
index f96572b7..0c3716cb 100644
--- a/vmime/component.hpp
+++ b/vmime/component.hpp
@@ -70,7 +70,7 @@ public:
* @param inputStream stream from which to read data
* @param length data length, in bytes (0 = unknown/not specified)
*/
- void parse(ref <utility::inputStream> inputStream, const utility::stream::size_type length);
+ void parse(shared_ptr <utility::inputStream> inputStream, const utility::stream::size_type length);
/** Parse RFC-822/MIME data for this component, using the default
* parsing context.
@@ -112,7 +112,7 @@ public:
* @param newPosition will receive the new position in the input stream
*/
void parse
- (ref <utility::inputStream> inputStream,
+ (shared_ptr <utility::inputStream> inputStream,
const utility::stream::size_type position,
const utility::stream::size_type end,
utility::stream::size_type* newPosition = NULL);
@@ -129,7 +129,7 @@ public:
*/
void parse
(const parsingContext& ctx,
- ref <utility::inputStream> inputStream,
+ shared_ptr <utility::inputStream> inputStream,
const utility::stream::size_type position,
const utility::stream::size_type end,
utility::stream::size_type* newPosition = NULL);
@@ -174,7 +174,7 @@ public:
*
* @return a copy of this component
*/
- virtual ref <component> clone() const = 0;
+ virtual shared_ptr <component> clone() const = 0;
/** Replace data in this component by data in other component.
* Both components must be of the same type.
@@ -205,7 +205,7 @@ public:
*
* @return list of child components
*/
- virtual const std::vector <ref <component> > getChildComponents() = 0;
+ virtual const std::vector <shared_ptr <component> > getChildComponents() = 0;
/** Get the number of bytes that will be used by this component when
* it is generated. This may be a heuristically-derived estimate,
@@ -224,7 +224,7 @@ protected:
// AT LEAST ONE of these parseImpl() functions MUST be implemented in derived class
virtual void parseImpl
(const parsingContext& ctx,
- ref <utility::parserInputStreamAdapter> parser,
+ shared_ptr <utility::parserInputStreamAdapter> parser,
const utility::stream::size_type position,
const utility::stream::size_type end,
utility::stream::size_type* newPosition = NULL);
diff --git a/vmime/contentDisposition.hpp b/vmime/contentDisposition.hpp
index 9407885d..0f417111 100644
--- a/vmime/contentDisposition.hpp
+++ b/vmime/contentDisposition.hpp
@@ -59,11 +59,11 @@ public:
*/
void setName(const string& name);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
contentDisposition& operator=(const contentDisposition& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
contentDisposition& operator=(const string& name);
diff --git a/vmime/contentDispositionField.hpp b/vmime/contentDispositionField.hpp
index 58b40dff..0eb32bc4 100644
--- a/vmime/contentDispositionField.hpp
+++ b/vmime/contentDispositionField.hpp
@@ -38,7 +38,7 @@ namespace vmime
class VMIME_EXPORT contentDispositionField : public parameterizedHeaderField
{
- friend class vmime::creator; // create ref
+ friend class headerFieldFactory;
protected:
diff --git a/vmime/contentHandler.hpp b/vmime/contentHandler.hpp
index ae20e892..5ae9e02b 100644
--- a/vmime/contentHandler.hpp
+++ b/vmime/contentHandler.hpp
@@ -29,7 +29,6 @@
#include "vmime/base.hpp"
#include "vmime/utility/stringProxy.hpp"
-#include "vmime/utility/smartPtr.hpp"
#include "vmime/utility/progressListener.hpp"
#include "vmime/encoding.hpp"
#include "vmime/mediaType.hpp"
@@ -53,7 +52,7 @@ public:
*
* @return copy of this object
*/
- virtual ref <contentHandler> clone() const = 0;
+ virtual shared_ptr <contentHandler> clone() const = 0;
/** Output the contents into the specified stream. Data will be
* encoded before being written into the stream. This is used internally
diff --git a/vmime/contentTypeField.hpp b/vmime/contentTypeField.hpp
index b522927a..b81d9a68 100644
--- a/vmime/contentTypeField.hpp
+++ b/vmime/contentTypeField.hpp
@@ -37,7 +37,7 @@ namespace vmime
class VMIME_EXPORT contentTypeField : public parameterizedHeaderField
{
- friend class vmime::creator; // create ref
+ friend class headerFieldFactory;
protected:
diff --git a/vmime/dateTime.hpp b/vmime/dateTime.hpp
index 1d25124a..8a596f02 100644
--- a/vmime/dateTime.hpp
+++ b/vmime/dateTime.hpp
@@ -224,7 +224,7 @@ public:
void copyFrom(const component& other);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
// Comparison
bool operator==(const datetime& other) const;
@@ -237,7 +237,7 @@ public:
// Current date and time
static const datetime now();
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
protected:
diff --git a/vmime/defaultAttachment.hpp b/vmime/defaultAttachment.hpp
index 171b7a84..6eb0c5b6 100644
--- a/vmime/defaultAttachment.hpp
+++ b/vmime/defaultAttachment.hpp
@@ -45,8 +45,8 @@ protected:
public:
- defaultAttachment(ref <const contentHandler> data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD);
- defaultAttachment(ref <const contentHandler> data, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD);
+ defaultAttachment(shared_ptr <const contentHandler> data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD);
+ defaultAttachment(shared_ptr <const contentHandler> data, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD);
defaultAttachment(const defaultAttachment& attach);
~defaultAttachment();
@@ -56,29 +56,29 @@ public:
const mediaType getType() const;
const text getDescription() const;
const word getName() const;
- const ref <const contentHandler> getData() const;
+ const shared_ptr <const contentHandler> getData() const;
const encoding getEncoding() const;
- ref <const object> getPart() const;
+ shared_ptr <const object> getPart() const;
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
protected:
mediaType m_type; /**< Media type (eg. "application/octet-stream") */
text m_desc; /**< Description (eg. "The image you requested") */
- ref <const contentHandler> m_data; /**< Attachment data (eg. the file contents) */
+ shared_ptr <const contentHandler> m_data; /**< Attachment data (eg. the file contents) */
encoding m_encoding; /**< Encoding */
word m_name; /**< Name/filename (eg. "sunset.jpg") */
private:
// No need to override "generateIn", use "generatePart" instead (see below).
- void generateIn(ref <bodyPart> parent) const;
+ void generateIn(shared_ptr <bodyPart> parent) const;
protected:
- virtual void generatePart(ref <bodyPart> part) const;
+ virtual void generatePart(shared_ptr <bodyPart> part) const;
};
diff --git a/vmime/disposition.hpp b/vmime/disposition.hpp
index b75327a1..01de1653 100644
--- a/vmime/disposition.hpp
+++ b/vmime/disposition.hpp
@@ -46,11 +46,11 @@ public:
disposition(const string& actionMode, const string& sendingMode, const string& type, const string& modifier);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
disposition& operator=(const disposition& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Set the disposition action mode.
diff --git a/vmime/emailAddress.hpp b/vmime/emailAddress.hpp
index a16366c7..e46afdf6 100644
--- a/vmime/emailAddress.hpp
+++ b/vmime/emailAddress.hpp
@@ -98,10 +98,10 @@ public:
// Assignment
void copyFrom(const component& other);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
emailAddress& operator=(const emailAddress& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
protected:
diff --git a/vmime/emptyContentHandler.hpp b/vmime/emptyContentHandler.hpp
index 829e8898..1307f7eb 100644
--- a/vmime/emptyContentHandler.hpp
+++ b/vmime/emptyContentHandler.hpp
@@ -38,7 +38,7 @@ public:
emptyContentHandler();
- ref <contentHandler> clone() const;
+ shared_ptr <contentHandler> clone() const;
void generate(utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength = lineLengthLimits::infinite) const;
diff --git a/vmime/encoding.hpp b/vmime/encoding.hpp
index cdee1d43..ba07a25f 100644
--- a/vmime/encoding.hpp
+++ b/vmime/encoding.hpp
@@ -93,7 +93,7 @@ public:
bool operator==(const encoding& value) const;
bool operator!=(const encoding& value) const;
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Decide which encoding to use based on the specified data.
*
@@ -101,7 +101,7 @@ public:
* @param usage context of use of data
* @return suitable encoding for specified data
*/
- static const encoding decide(ref <const contentHandler> data, const EncodingUsage usage = USAGE_BINARY_DATA);
+ static const encoding decide(shared_ptr <const contentHandler> data, const EncodingUsage usage = USAGE_BINARY_DATA);
/** Decide which encoding to use based on the specified data and charset.
*
@@ -110,10 +110,10 @@ public:
* @param usage context of use of data
* @return suitable encoding for specified data and charset
*/
- static const encoding decide(ref <const contentHandler> data, const charset& chset, const EncodingUsage usage = USAGE_BINARY_DATA);
+ static const encoding decide(shared_ptr <const contentHandler> data, const charset& chset, const EncodingUsage usage = USAGE_BINARY_DATA);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
/** Use encoderFactory to obtain an encoder/decoder object
@@ -123,7 +123,7 @@ public:
* is registered for the encoding
* @return a new encoder object for the encoding type
*/
- ref <utility::encoder::encoder> getEncoder() const;
+ shared_ptr <utility::encoder::encoder> getEncoder() const;
private:
diff --git a/vmime/fileAttachment.hpp b/vmime/fileAttachment.hpp
index d18b8a14..2d9ff575 100644
--- a/vmime/fileAttachment.hpp
+++ b/vmime/fileAttachment.hpp
@@ -52,9 +52,9 @@ public:
fileAttachment(const string& filepath, const mediaType& type, const text& desc);
fileAttachment(const string& filepath, const mediaType& type, const text& desc, const encoding& enc);
- fileAttachment(ref <contentHandler> cts, const word& filename, const mediaType& type);
- fileAttachment(ref <contentHandler> cts, const word& filename, const mediaType& type, const text& desc);
- fileAttachment(ref <contentHandler> cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc);
+ fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type);
+ fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type, const text& desc);
+ fileAttachment(shared_ptr <contentHandler> cts, const word& filename, const mediaType& type, const text& desc, const encoding& enc);
/** Stores information about a file attachment.
*/
@@ -181,11 +181,11 @@ public:
private:
void setData(const string& filepath);
- void setData(ref <contentHandler> cts);
+ void setData(shared_ptr <contentHandler> cts);
fileInfo m_fileInfo;
- void generatePart(ref <bodyPart> part) const;
+ void generatePart(shared_ptr <bodyPart> part) const;
};
diff --git a/vmime/fileContentHandler.hpp b/vmime/fileContentHandler.hpp
index 36a6a459..68b4d396 100644
--- a/vmime/fileContentHandler.hpp
+++ b/vmime/fileContentHandler.hpp
@@ -56,7 +56,7 @@ public:
* @return a reference to a new content handler
*/
fileContentHandler
- (ref <utility::file> file,
+ (shared_ptr <utility::file> file,
const vmime::encoding& enc = NO_ENCODING);
~fileContentHandler();
@@ -64,7 +64,7 @@ public:
fileContentHandler(const fileContentHandler& cts);
fileContentHandler& operator=(const fileContentHandler& cts);
- ref <contentHandler> clone() const;
+ shared_ptr <contentHandler> clone() const;
/** Sets the data managed by this content handler.
*
@@ -73,7 +73,7 @@ public:
* in the file is already encoded with the specified encoding
*/
void setData
- (ref <utility::file> file,
+ (shared_ptr <utility::file> file,
const vmime::encoding& enc = NO_ENCODING);
private:
@@ -83,7 +83,7 @@ private:
vmime::encoding m_encoding;
// Actual data
- ref <utility::file> m_file;
+ shared_ptr <utility::file> m_file;
};
diff --git a/vmime/generatedMessageAttachment.hpp b/vmime/generatedMessageAttachment.hpp
index 4c9c0aba..7137b22b 100644
--- a/vmime/generatedMessageAttachment.hpp
+++ b/vmime/generatedMessageAttachment.hpp
@@ -42,30 +42,30 @@ class VMIME_EXPORT generatedMessageAttachment : public messageAttachment
{
public:
- generatedMessageAttachment(ref <const bodyPart> part);
+ generatedMessageAttachment(shared_ptr <const bodyPart> part);
const mediaType getType() const;
const text getDescription() const;
const word getName() const;
- const ref <const contentHandler> getData() const;
+ const shared_ptr <const contentHandler> getData() const;
const encoding getEncoding() const;
- ref <const object> getPart() const;
+ shared_ptr <const object> getPart() const;
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
- ref <message> getMessage() const;
+ shared_ptr <message> getMessage() const;
protected:
- void generateIn(ref <bodyPart> parent) const;
+ void generateIn(shared_ptr <bodyPart> parent) const;
private:
- ref <bodyPartAttachment> m_bpa;
- mutable ref <message> m_msg;
+ shared_ptr <bodyPartAttachment> m_bpa;
+ mutable shared_ptr <message> m_msg;
};
diff --git a/vmime/header.hpp b/vmime/header.hpp
index 0758e775..b073e8cb 100644
--- a/vmime/header.hpp
+++ b/vmime/header.hpp
@@ -55,8 +55,8 @@ public:
~header();
#define FIELD_ACCESS(methodName, fieldName) \
- ref <headerField> methodName() { return getField(fields::fieldName); } \
- ref <const headerField> methodName() const { return findField(fields::fieldName); }
+ shared_ptr <headerField> methodName() { return getField(fields::fieldName); } \
+ shared_ptr <const headerField> methodName() const { return findField(fields::fieldName); }
FIELD_ACCESS(From, FROM)
FIELD_ACCESS(Sender, SENDER)
@@ -102,14 +102,26 @@ public:
* @throw exceptions::no_such_field if no field with this name exists
* @return first field with the specified name
*/
- ref <headerField> findField(const string& fieldName) const;
+ shared_ptr <headerField> findField(const string& fieldName) const;
+
+ /** Find the first field that matches the specified name,
+ * casted to the specified type.
+ * If no field is found, an exception is thrown.
+ *
+ * @return value object
+ */
+ template <typename T>
+ shared_ptr <T> findField(const string& fieldName) const
+ {
+ return dynamicCast <T>(findField(fieldName));
+ }
/** Find all fields that match the specified name.
* If no field is found, an empty vector is returned.
*
* @return list of fields with the specified name
*/
- std::vector <ref <headerField> > findAllFields(const string& fieldName);
+ std::vector <shared_ptr <headerField> > findAllFields(const string& fieldName);
/** Find the first field that matches the specified name.
* If no field is found, one will be created and inserted into
@@ -118,13 +130,27 @@ public:
* @return first field with the specified name or a new field
* if no field is found
*/
- ref <headerField> getField(const string& fieldName);
+ shared_ptr <headerField> getField(const string& fieldName);
+
+ /** Find the first field that matches the specified name,
+ * casted to the specified type.
+ * If no field is found, one will be created and inserted into
+ * the header.
+ *
+ * @return first field with the specified name or a new field
+ * if no field is found
+ */
+ template <typename T>
+ shared_ptr <T> getField(const string& fieldName)
+ {
+ return dynamicCast <T>(getField(fieldName));
+ }
/** Add a field at the end of the list.
*
* @param field field to append
*/
- void appendField(ref <headerField> field);
+ void appendField(shared_ptr <headerField> field);
/** Insert a new field before the specified field.
*
@@ -132,7 +158,7 @@ public:
* @param field field to insert
* @throw exceptions::no_such_field if the field is not in the list
*/
- void insertFieldBefore(ref <headerField> beforeField, ref <headerField> field);
+ void insertFieldBefore(shared_ptr <headerField> beforeField, shared_ptr <headerField> field);
/** Insert a new field before the specified position.
*
@@ -140,7 +166,7 @@ public:
* the beginning of the list)
* @param field field to insert
*/
- void insertFieldBefore(const size_t pos, ref <headerField> field);
+ void insertFieldBefore(const size_t pos, shared_ptr <headerField> field);
/** Insert a new field after the specified field.
*
@@ -148,21 +174,21 @@ public:
* @param field field to insert
* @throw exceptions::no_such_field if the field is not in the list
*/
- void insertFieldAfter(ref <headerField> afterField, ref <headerField> field);
+ void insertFieldAfter(shared_ptr <headerField> afterField, shared_ptr <headerField> field);
/** Insert a new field after the specified position.
*
* @param pos position of the field before the new field
* @param field field to insert
*/
- void insertFieldAfter(const size_t pos, ref <headerField> field);
+ void insertFieldAfter(const size_t pos, shared_ptr <headerField> field);
/** Remove the specified field from the list.
*
* @param field field to remove
* @throw exceptions::no_such_field if the field is not in the list
*/
- void removeField(ref <headerField> field);
+ void removeField(shared_ptr <headerField> field);
/** Remove the field at the specified position.
*
@@ -176,7 +202,7 @@ public:
* @param newField field to replace with
* @throw exceptions::no_such_field if the field is not in the list
*/
- void replaceField(ref <headerField> field, ref <headerField> newField);
+ void replaceField(shared_ptr <headerField> field, shared_ptr <headerField> newField);
/** Remove all fields from the list.
*/
@@ -203,38 +229,38 @@ public:
* @param pos position
* @return field at position 'pos'
*/
- const ref <headerField> getFieldAt(const size_t pos);
+ const shared_ptr <headerField> getFieldAt(const size_t pos);
/** Return the field at the specified position.
*
* @param pos position
* @return field at position 'pos'
*/
- const ref <const headerField> getFieldAt(const size_t pos) const;
+ const shared_ptr <const headerField> getFieldAt(const size_t pos) const;
/** Return the field list.
*
* @return list of fields
*/
- const std::vector <ref <const headerField> > getFieldList() const;
+ const std::vector <shared_ptr <const headerField> > getFieldList() const;
/** Return the field list.
*
* @return list of fields
*/
- const std::vector <ref <headerField> > getFieldList();
+ const std::vector <shared_ptr <headerField> > getFieldList();
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
header& operator=(const header& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
utility::stream::size_type getGeneratedSize(const generationContext& ctx);
private:
- std::vector <ref <headerField> > m_fields;
+ std::vector <shared_ptr <headerField> > m_fields;
class fieldHasName
@@ -242,7 +268,7 @@ private:
public:
fieldHasName(const string& name);
- bool operator() (const ref <const headerField>& field);
+ bool operator() (const shared_ptr <const headerField>& field);
private:
@@ -254,7 +280,7 @@ private:
public:
fieldHasNotName(const string& name);
- bool operator() (const ref <const headerField>& field);
+ bool operator() (const shared_ptr <const headerField>& field);
private:
diff --git a/vmime/headerField.hpp b/vmime/headerField.hpp
index 5276c84a..c9972317 100644
--- a/vmime/headerField.hpp
+++ b/vmime/headerField.hpp
@@ -42,8 +42,6 @@ class VMIME_EXPORT headerField : public component
friend class headerFieldFactory;
friend class header;
- friend class vmime::creator; // create ref
-
protected:
// Protected constructor to prevent the user from creating
@@ -55,11 +53,11 @@ public:
~headerField();
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
headerField& operator=(const headerField& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Sets the name of this field.
*
@@ -84,13 +82,35 @@ public:
*
* @return read-only value object
*/
- virtual ref <const headerFieldValue> getValue() const;
+ virtual shared_ptr <const headerFieldValue> getValue() const;
+
+ /** Return the read-only value object attached to this field,
+ * casted to the specified type.
+ *
+ * @return value object
+ */
+ template <typename T>
+ shared_ptr <const T> getValue() const
+ {
+ return dynamicCast <const T>(m_value);
+ }
/** Return the value object attached to this field.
*
* @return value object
*/
- virtual ref <headerFieldValue> getValue();
+ virtual shared_ptr <headerFieldValue> getValue();
+
+ /** Return the value object attached to this field,
+ * casted to the specified type.
+ *
+ * @return value object
+ */
+ template <typename T>
+ shared_ptr <T> getValue()
+ {
+ return dynamicCast <T>(m_value);
+ }
/** Set the value of this field.
*
@@ -98,7 +118,7 @@ public:
* valid for this header field
* @param value new value
*/
- virtual void setValue(ref <headerFieldValue> value);
+ virtual void setValue(shared_ptr <headerFieldValue> value);
/** Set the value of this field by cloning the specified value.
*
@@ -106,7 +126,7 @@ public:
* valid for this header field
* @param value new value
*/
- virtual void setValueConst(ref <const headerFieldValue> value);
+ virtual void setValueConst(shared_ptr <const headerFieldValue> value);
/** Set the value of this field (reference version).
* The value will be cloned.
@@ -134,7 +154,7 @@ public:
* @return parsed header field, or NULL if no more header field can be parsed
* in the input buffer
*/
- static ref <headerField> parseNext
+ static shared_ptr <headerField> parseNext
(const parsingContext& ctx,
const string& buffer,
const string::size_type position,
@@ -160,7 +180,7 @@ protected:
string m_name;
- ref <headerFieldValue> m_value;
+ shared_ptr <headerFieldValue> m_value;
};
diff --git a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
index e8a1a84c..960f27b7 100644
--- a/vmime/headerFieldFactory.hpp
+++ b/vmime/headerFieldFactory.hpp
@@ -43,7 +43,7 @@ protected:
headerFieldFactory();
~headerFieldFactory();
- typedef ref <headerField> (*AllocFunc)(void);
+ typedef shared_ptr <headerField> (*AllocFunc)(void);
typedef std::map <string, AllocFunc> NameMap;
NameMap m_nameMap;
@@ -51,7 +51,7 @@ protected:
struct ValueInfo
{
- typedef ref <headerFieldValue> (*ValueAllocFunc)(void);
+ typedef shared_ptr <headerFieldValue> (*ValueAllocFunc)(void);
typedef bool (*ValueTypeCheckFunc)(const object&);
ValueAllocFunc allocFunc;
@@ -64,7 +64,7 @@ protected:
public:
- static headerFieldFactory* getInstance();
+ static shared_ptr <headerFieldFactory> getInstance();
#ifndef VMIME_BUILDING_DOC
// TYPE must inherit from BASE_TYPE
@@ -79,10 +79,10 @@ public:
return typedObj != NULL;
}
- static ref <BASE_TYPE> creator()
+ static shared_ptr <BASE_TYPE> creator()
{
// Allocate a new object
- return vmime::create <TYPE>();
+ return shared_ptr <BASE_TYPE>(new TYPE());
}
};
#endif // VMIME_BUILDING_DOC
@@ -126,14 +126,14 @@ public:
* the value of the field
* @return a new field object
*/
- ref <headerField> create(const string& name, const string& body = NULL_STRING);
+ shared_ptr <headerField> create(const string& name, const string& body = NULL_STRING);
/** Create a new field value for the specified field.
*
* @param fieldName name of the field for which to create value
* @return a new value object for the field
*/
- ref <headerFieldValue> createValue(const string& fieldName);
+ shared_ptr <headerFieldValue> createValue(const string& fieldName);
/** Returns whether the specified value type is valid for the specified field.
*
diff --git a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp
index 59ed1add..9596f3f4 100644
--- a/vmime/htmlTextPart.hpp
+++ b/vmime/htmlTextPart.hpp
@@ -51,11 +51,11 @@ public:
const charset& getCharset() const;
void setCharset(const charset& ch);
- ref <const contentHandler> getPlainText() const;
- void setPlainText(ref <contentHandler> plainText);
+ shared_ptr <const contentHandler> getPlainText() const;
+ void setPlainText(shared_ptr <contentHandler> plainText);
- const ref <const contentHandler> getText() const;
- void setText(ref <contentHandler> text);
+ const shared_ptr <const contentHandler> getText() const;
+ void setText(shared_ptr <contentHandler> text);
/** Embedded object (eg: image for &lt;IMG> tag).
*/
@@ -79,7 +79,7 @@ public:
* @param refType reference type
* @return a reference to a new embedded object
*/
- embeddedObject(ref <contentHandler> data, const encoding& enc,
+ embeddedObject(shared_ptr <contentHandler> data, const encoding& enc,
const string& id, const mediaType& type,
const ReferenceType refType);
@@ -87,7 +87,7 @@ public:
*
* @return stored data
*/
- ref <const contentHandler> getData() const;
+ shared_ptr <const contentHandler> getData() const;
/** Return the encoding used for data in this
* embedded object.
@@ -136,7 +136,7 @@ public:
static const string cleanId(const string& id);
- ref <contentHandler> m_data;
+ shared_ptr <contentHandler> m_data;
encoding m_encoding;
string m_id;
mediaType m_type;
@@ -158,7 +158,7 @@ public:
* @param id object identifier
* @return embedded object with the specified identifier
*/
- ref <const embeddedObject> findObject(const string& id) const;
+ shared_ptr <const embeddedObject> findObject(const string& id) const;
/** Return the number of embedded objects.
*
@@ -171,7 +171,7 @@ public:
* @param pos position of the embedded object
* @return embedded object at position 'pos'
*/
- ref <const embeddedObject> getObjectAt(const size_t pos) const;
+ shared_ptr <const embeddedObject> getObjectAt(const size_t pos) const;
/** Embed an object and returns a string which identifies it.
* The returned identifier is suitable for use in the 'src' attribute
@@ -185,7 +185,7 @@ public:
* @return an unique object identifier used to identify the new
* object among all other embedded objects
*/
- ref <const embeddedObject> addObject(const string& data, const mediaType& type);
+ shared_ptr <const embeddedObject> addObject(const string& data, const mediaType& type);
/** Embed an object and returns a string which identifies it.
* The returned identifier is suitable for use in the 'src' attribute
@@ -196,7 +196,7 @@ public:
* @return an unique object identifier used to identify the new
* object among all other embedded objects
*/
- ref <const embeddedObject> addObject(ref <contentHandler> data, const mediaType& type);
+ shared_ptr <const embeddedObject> addObject(shared_ptr <contentHandler> data, const mediaType& type);
/** Embed an object and returns a string which identifies it.
* The returned identifier is suitable for use in the 'src' attribute
@@ -208,23 +208,23 @@ public:
* @return an unique object identifier used to identify the new
* object among all other embedded objects
*/
- ref <const embeddedObject> addObject(ref <contentHandler> data, const encoding& enc, const mediaType& type);
+ shared_ptr <const embeddedObject> addObject(shared_ptr <contentHandler> data, const encoding& enc, const mediaType& type);
size_t getPartCount() const;
- void generateIn(ref <bodyPart> message, ref <bodyPart> parent) const;
- void parse(ref <const bodyPart> message, ref <const bodyPart> parent, ref <const bodyPart> textPart);
+ void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const;
+ void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart);
private:
- ref <contentHandler> m_plainText;
- ref <contentHandler> m_text;
+ shared_ptr <contentHandler> m_plainText;
+ shared_ptr <contentHandler> m_text;
charset m_charset;
- std::vector <ref <embeddedObject> > m_objects;
+ std::vector <shared_ptr <embeddedObject> > m_objects;
- void findEmbeddedParts(const bodyPart& part, std::vector <ref <const bodyPart> >& cidParts, std::vector <ref <const bodyPart> >& locParts);
+ void findEmbeddedParts(const bodyPart& part, std::vector <shared_ptr <const bodyPart> >& cidParts, std::vector <shared_ptr <const bodyPart> >& locParts);
void addEmbeddedObject(const bodyPart& part, const string& id, const embeddedObject::ReferenceType refType);
bool findPlainTextPart(const bodyPart& part, const bodyPart& parent, const bodyPart& textPart);
diff --git a/vmime/mailbox.hpp b/vmime/mailbox.hpp
index b6dc9fbe..586f88ee 100644
--- a/vmime/mailbox.hpp
+++ b/vmime/mailbox.hpp
@@ -79,14 +79,14 @@ public:
// Assignment
void copyFrom(const component& other);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
mailbox& operator=(const mailbox& other);
bool isEmpty() const;
void clear();
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
bool isGroup() const;
diff --git a/vmime/mailboxField.hpp b/vmime/mailboxField.hpp
index 798e84d7..75cae592 100644
--- a/vmime/mailboxField.hpp
+++ b/vmime/mailboxField.hpp
@@ -43,7 +43,7 @@ namespace vmime
class VMIME_EXPORT mailboxField : public headerField
{
- friend class vmime::creator; // create ref
+ friend class headerFieldFactory;
protected:
diff --git a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp
index 1c0511e1..ac6b9741 100644
--- a/vmime/mailboxGroup.hpp
+++ b/vmime/mailboxGroup.hpp
@@ -49,10 +49,10 @@ public:
void copyFrom(const component& other);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
mailboxGroup& operator=(const component& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Return the name of the group.
*
@@ -70,7 +70,7 @@ public:
*
* @param mbox mailbox to append
*/
- void appendMailbox(ref <mailbox> mbox);
+ void appendMailbox(shared_ptr <mailbox> mbox);
/** Insert a new mailbox before the specified mailbox.
*
@@ -78,7 +78,7 @@ public:
* @param mbox mailbox to insert
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void insertMailboxBefore(ref <mailbox> beforeMailbox, ref <mailbox> mbox);
+ void insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox);
/** Insert a new mailbox before the specified position.
*
@@ -86,7 +86,7 @@ public:
* the beginning of the list)
* @param mbox mailbox to insert
*/
- void insertMailboxBefore(const size_t pos, ref <mailbox> mbox);
+ void insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox);
/** Insert a new mailbox after the specified mailbox.
*
@@ -94,21 +94,21 @@ public:
* @param mbox mailbox to insert
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void insertMailboxAfter(ref <mailbox> afterMailbox, ref <mailbox> mbox);
+ void insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox);
/** Insert a new mailbox after the specified position.
*
* @param pos position of the mailbox before the new mailbox
* @param mbox mailbox to insert
*/
- void insertMailboxAfter(const size_t pos, ref <mailbox> mbox);
+ void insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox);
/** Remove the specified mailbox from the list.
*
* @param mbox mailbox to remove
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void removeMailbox(ref <mailbox> mbox);
+ void removeMailbox(shared_ptr <mailbox> mbox);
/** Remove the mailbox at the specified position.
*
@@ -137,33 +137,33 @@ public:
* @param pos position
* @return mailbox at position 'pos'
*/
- ref <mailbox> getMailboxAt(const size_t pos);
+ shared_ptr <mailbox> getMailboxAt(const size_t pos);
/** Return the mailbox at the specified position.
*
* @param pos position
* @return mailbox at position 'pos'
*/
- const ref <const mailbox> getMailboxAt(const size_t pos) const;
+ const shared_ptr <const mailbox> getMailboxAt(const size_t pos) const;
/** Return the mailbox list.
*
* @return list of mailboxes
*/
- const std::vector <ref <const mailbox> > getMailboxList() const;
+ const std::vector <shared_ptr <const mailbox> > getMailboxList() const;
/** Return the mailbox list.
*
* @return list of mailboxes
*/
- const std::vector <ref <mailbox> > getMailboxList();
+ const std::vector <shared_ptr <mailbox> > getMailboxList();
bool isGroup() const;
private:
text m_name;
- std::vector <ref <mailbox> > m_list;
+ std::vector <shared_ptr <mailbox> > m_list;
protected:
diff --git a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp
index 1b4cbb50..25daefec 100644
--- a/vmime/mailboxList.hpp
+++ b/vmime/mailboxList.hpp
@@ -47,17 +47,17 @@ public:
mailboxList(const mailboxList& mboxList);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
mailboxList& operator=(const mailboxList& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Add a mailbox at the end of the list.
*
* @param mbox mailbox to append
*/
- void appendMailbox(ref <mailbox> mbox);
+ void appendMailbox(shared_ptr <mailbox> mbox);
/** Insert a new mailbox before the specified mailbox.
*
@@ -65,7 +65,7 @@ public:
* @param mbox mailbox to insert
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void insertMailboxBefore(ref <mailbox> beforeMailbox, ref <mailbox> mbox);
+ void insertMailboxBefore(shared_ptr <mailbox> beforeMailbox, shared_ptr <mailbox> mbox);
/** Insert a new mailbox before the specified position.
*
@@ -73,7 +73,7 @@ public:
* the beginning of the list)
* @param mbox mailbox to insert
*/
- void insertMailboxBefore(const size_t pos, ref <mailbox> mbox);
+ void insertMailboxBefore(const size_t pos, shared_ptr <mailbox> mbox);
/** Insert a new mailbox after the specified mailbox.
*
@@ -81,21 +81,21 @@ public:
* @param mbox mailbox to insert
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void insertMailboxAfter(ref <mailbox> afterMailbox, ref <mailbox> mbox);
+ void insertMailboxAfter(shared_ptr <mailbox> afterMailbox, shared_ptr <mailbox> mbox);
/** Insert a new mailbox after the specified position.
*
* @param pos position of the mailbox before the new mailbox
* @param mbox mailbox to insert
*/
- void insertMailboxAfter(const size_t pos, ref <mailbox> mbox);
+ void insertMailboxAfter(const size_t pos, shared_ptr <mailbox> mbox);
/** Remove the specified mailbox from the list.
*
* @param mbox mailbox to remove
* @throw exceptions::no_such_mailbox if the mailbox is not in the list
*/
- void removeMailbox(ref <mailbox> mbox);
+ void removeMailbox(shared_ptr <mailbox> mbox);
/** Remove the mailbox at the specified position.
*
@@ -124,32 +124,32 @@ public:
* @param pos position
* @return mailbox at position 'pos'
*/
- ref <mailbox> getMailboxAt(const size_t pos);
+ shared_ptr <mailbox> getMailboxAt(const size_t pos);
/** Return the mailbox at the specified position.
*
* @param pos position
* @return mailbox at position 'pos'
*/
- const ref <const mailbox> getMailboxAt(const size_t pos) const;
+ const shared_ptr <const mailbox> getMailboxAt(const size_t pos) const;
/** Return the mailbox list.
*
* @return list of mailboxes
*/
- const std::vector <ref <const mailbox> > getMailboxList() const;
+ const std::vector <shared_ptr <const mailbox> > getMailboxList() const;
/** Return the mailbox list.
*
* @return list of mailboxes
*/
- const std::vector <ref <mailbox> > getMailboxList();
+ const std::vector <shared_ptr <mailbox> > getMailboxList();
/** Return a list of addresses.
*
* @return list of addresses
*/
- ref <addressList> toAddressList() const;
+ shared_ptr <addressList> toAddressList() const;
private:
diff --git a/vmime/mdn/MDNHelper.hpp b/vmime/mdn/MDNHelper.hpp
index 0e853989..2584978f 100644
--- a/vmime/mdn/MDNHelper.hpp
+++ b/vmime/mdn/MDNHelper.hpp
@@ -48,14 +48,14 @@ public:
* @param msg message in which to add a MDN request
* @param mailboxes list of mailboxes to which the MDN will be sent
*/
- static void attachMDNRequest(ref <message> msg, const mailboxList& mailboxes);
+ static void attachMDNRequest(shared_ptr <message> msg, const mailboxList& mailboxes);
/** Attach a MDN request to the specified message.
*
* @param msg message in which to add a MDN request
* @param mbox mailbox to which the MDN will be sent
*/
- static void attachMDNRequest(ref <message> msg, const mailbox& mbox);
+ static void attachMDNRequest(shared_ptr <message> msg, const mailbox& mbox);
/** Return a list of possible MDNs that can be generated
* for the specified message.
@@ -63,14 +63,14 @@ public:
* @param msg message for which to send a MDN
* @return list of possible MDNs
*/
- static const std::vector <sendableMDNInfos> getPossibleMDNs(const ref <const message> msg);
+ static const std::vector <sendableMDNInfos> getPossibleMDNs(const shared_ptr <const message> msg);
/** Test whether the specified message is a MDN.
*
* @param msg message
* @return true if the message is a MDN, false otherwise
*/
- static bool isMDN(const ref <const message> msg);
+ static bool isMDN(const shared_ptr <const message> msg);
/** If the specified message is a MDN, return information
* about it.
@@ -79,7 +79,7 @@ public:
* @throw exceptions::invalid_argument if the message is not a MDN
* @return information about the MDN
*/
- static receivedMDNInfos getReceivedMDN(const ref <const message> msg);
+ static receivedMDNInfos getReceivedMDN(const shared_ptr <const message> msg);
/** Check whether we need user confirmation for sending a MDN even
* if he/she explicitely allowed automatic send of MDNs. This can
@@ -88,7 +88,7 @@ public:
* @param msg message for which to send a MDN
* @return true if user confirmation should be asked, false otherwise
*/
- static bool needConfirmation(const ref <const message> msg);
+ static bool needConfirmation(const shared_ptr <const message> msg);
/** Build a new MDN for the message. The resulting MDN can then be
* sent over SMTP transport service.
@@ -105,7 +105,7 @@ public:
* @param fields additional MDN fields, like "Error", "Warning" or "Failure" (optional)
* @return a new message object containing the MDN
*/
- static ref <message> buildMDN(const sendableMDNInfos& mdnInfos,
+ static shared_ptr <message> buildMDN(const sendableMDNInfos& mdnInfos,
const string& text,
const charset& ch,
const mailbox& expeditor,
@@ -118,17 +118,17 @@ public:
private:
- static ref <bodyPart> createFirstMDNPart(const sendableMDNInfos& mdnInfos,
+ static shared_ptr <bodyPart> createFirstMDNPart(const sendableMDNInfos& mdnInfos,
const string& text, const charset& ch);
- static ref <bodyPart> createSecondMDNPart(const sendableMDNInfos& mdnInfos,
+ static shared_ptr <bodyPart> createSecondMDNPart(const sendableMDNInfos& mdnInfos,
const disposition& dispo,
const string& reportingUA,
const std::vector <string>& reportingUAProducts,
const std::map <string, string>& fields);
- static ref <bodyPart> createThirdMDNPart(const sendableMDNInfos& mdnInfos);
+ static shared_ptr <bodyPart> createThirdMDNPart(const sendableMDNInfos& mdnInfos);
};
diff --git a/vmime/mdn/MDNInfos.hpp b/vmime/mdn/MDNInfos.hpp
index d77a0306..030aa23e 100644
--- a/vmime/mdn/MDNInfos.hpp
+++ b/vmime/mdn/MDNInfos.hpp
@@ -47,7 +47,7 @@ public:
*
* @return related message
*/
- virtual const ref <const message> getMessage() const = 0;
+ virtual const shared_ptr <const message> getMessage() const = 0;
};
diff --git a/vmime/mdn/receivedMDNInfos.hpp b/vmime/mdn/receivedMDNInfos.hpp
index c836f23c..c6953a24 100644
--- a/vmime/mdn/receivedMDNInfos.hpp
+++ b/vmime/mdn/receivedMDNInfos.hpp
@@ -44,13 +44,13 @@ class VMIME_EXPORT receivedMDNInfos : public MDNInfos
{
public:
- receivedMDNInfos(const ref <const message> msg);
+ receivedMDNInfos(const shared_ptr <const message> msg);
receivedMDNInfos(const receivedMDNInfos& other);
receivedMDNInfos& operator=(const receivedMDNInfos& other);
- const ref <const message> getMessage() const;
+ const shared_ptr <const message> getMessage() const;
/** Return the identifier of the message for which this MDN
* has been generated.
@@ -79,7 +79,7 @@ private:
void extract();
- ref <const message> m_msg;
+ shared_ptr <const message> m_msg;
disposition m_disp;
messageId m_omid;
diff --git a/vmime/mdn/sendableMDNInfos.hpp b/vmime/mdn/sendableMDNInfos.hpp
index f886b5fa..e4f6d20d 100644
--- a/vmime/mdn/sendableMDNInfos.hpp
+++ b/vmime/mdn/sendableMDNInfos.hpp
@@ -42,12 +42,12 @@ class VMIME_EXPORT sendableMDNInfos : public MDNInfos
{
public:
- sendableMDNInfos(const ref <const message> msg, const mailbox& mbox);
+ sendableMDNInfos(const shared_ptr <const message> msg, const mailbox& mbox);
sendableMDNInfos(const sendableMDNInfos& other);
sendableMDNInfos& operator=(const sendableMDNInfos& other);
- const ref <const message> getMessage() const;
+ const shared_ptr <const message> getMessage() const;
/** Return the recipient of the MDN (the mailbox that will receive
* the notification message).
@@ -61,7 +61,7 @@ private:
void copyFrom(const sendableMDNInfos& other);
- ref <const message> m_msg;
+ shared_ptr <const message> m_msg;
mailbox m_mailbox;
};
diff --git a/vmime/mediaType.hpp b/vmime/mediaType.hpp
index b396c8bf..c2b214bd 100644
--- a/vmime/mediaType.hpp
+++ b/vmime/mediaType.hpp
@@ -51,11 +51,11 @@ public:
mediaType& operator=(const string& type);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
mediaType& operator=(const mediaType& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Return the media type.
* See the constants in vmime::mediaTypes.
diff --git a/vmime/messageAttachment.hpp b/vmime/messageAttachment.hpp
index b6b360f4..641fd3e1 100644
--- a/vmime/messageAttachment.hpp
+++ b/vmime/messageAttachment.hpp
@@ -44,7 +44,7 @@ public:
*
* @return encapsulated message
*/
- virtual ref <message> getMessage() const = 0;
+ virtual shared_ptr <message> getMessage() const = 0;
};
diff --git a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp
index f3f9fa0d..af86e826 100644
--- a/vmime/messageBuilder.hpp
+++ b/vmime/messageBuilder.hpp
@@ -136,13 +136,13 @@ public:
*
* @param attach new attachment
*/
- void attach(ref <attachment> attach);
+ void attach(shared_ptr <attachment> attach);
/** Attach a new object to the message.
*
* @param attach new attachment
*/
- void appendAttachment(ref <attachment> attach);
+ void appendAttachment(shared_ptr <attachment> attach);
/** Remove the attachment at the specified position.
*
@@ -155,14 +155,14 @@ public:
* @param pos position of the attachment
* @return attachment at the specified position
*/
- const ref <const attachment> getAttachmentAt(const size_t pos) const;
+ const shared_ptr <const attachment> getAttachmentAt(const size_t pos) const;
/** Return the attachment at the specified position.
*
* @param pos position of the attachment
* @return attachment at the specified position
*/
- ref <attachment> getAttachmentAt(const size_t pos);
+ shared_ptr <attachment> getAttachmentAt(const size_t pos);
/** Return the number of attachments in the message.
*
@@ -174,13 +174,13 @@ public:
*
* @return list of attachments
*/
- const std::vector <ref <const attachment> > getAttachmentList() const;
+ const std::vector <shared_ptr <const attachment> > getAttachmentList() const;
/** Return the list of attachments.
*
* @return list of attachments
*/
- const std::vector <ref <attachment> > getAttachmentList();
+ const std::vector <shared_ptr <attachment> > getAttachmentList();
/** Change the type of the text part and construct a new part.
*
@@ -192,14 +192,14 @@ public:
*
* @return text part of the message
*/
- ref <textPart> getTextPart();
+ shared_ptr <textPart> getTextPart();
/** Construct a new message based on the information specified
* in this object.
*
* @return a new message
*/
- ref <message> construct() const;
+ shared_ptr <message> construct() const;
private:
@@ -211,9 +211,9 @@ private:
text m_subject;
- ref <textPart> m_textPart;
+ shared_ptr <textPart> m_textPart;
- std::vector <ref <attachment> > m_attach;
+ std::vector <shared_ptr <attachment> > m_attach;
};
diff --git a/vmime/messageId.hpp b/vmime/messageId.hpp
index 7d6348e3..8c2f85d1 100644
--- a/vmime/messageId.hpp
+++ b/vmime/messageId.hpp
@@ -93,11 +93,11 @@ public:
*/
const string getId() const;
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
messageId& operator=(const messageId& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
private:
@@ -128,7 +128,7 @@ protected:
* @param newPosition will receive the new position in the input buffer
* @return a new message-id object, or null if no more message-id can be parsed from the input buffer
*/
- static ref <messageId> parseNext
+ static shared_ptr <messageId> parseNext
(const parsingContext& ctx,
const string& buffer,
const string::size_type position,
diff --git a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp
index ec54dbd3..39c415c7 100644
--- a/vmime/messageIdSequence.hpp
+++ b/vmime/messageIdSequence.hpp
@@ -45,18 +45,18 @@ public:
~messageIdSequence();
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
messageIdSequence& operator=(const messageIdSequence& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Add a message-id at the end of the list.
*
* @param mid message-id to append
*/
- void appendMessageId(ref <messageId> mid);
+ void appendMessageId(shared_ptr <messageId> mid);
/** Insert a new message-id before the specified message-id.
*
@@ -64,7 +64,7 @@ public:
* @param mid message-id to insert
* @throw exceptions::no_such_messageid if the message-id is not in the list
*/
- void insertMessageIdBefore(ref <messageId> beforeMid, ref <messageId> mid);
+ void insertMessageIdBefore(shared_ptr <messageId> beforeMid, shared_ptr <messageId> mid);
/** Insert a new message-id before the specified position.
*
@@ -72,7 +72,7 @@ public:
* the beginning of the list)
* @param mid message-id to insert
*/
- void insertMessageIdBefore(const size_t pos, ref <messageId> mid);
+ void insertMessageIdBefore(const size_t pos, shared_ptr <messageId> mid);
/** Insert a new message-id after the specified message-id.
*
@@ -80,21 +80,21 @@ public:
* @param mid message-id to insert
* @throw exceptions::no_such_message_id if the message-id is not in the list
*/
- void insertMessageIdAfter(ref <messageId> afterMid, ref <messageId> mid);
+ void insertMessageIdAfter(shared_ptr <messageId> afterMid, shared_ptr <messageId> mid);
/** Insert a new message-id after the specified position.
*
* @param pos position of the message-id before the new message-id
* @param mid message-id to insert
*/
- void insertMessageIdAfter(const size_t pos, ref <messageId> mid);
+ void insertMessageIdAfter(const size_t pos, shared_ptr <messageId> mid);
/** Remove the specified message-id from the list.
*
* @param mid message-id to remove
* @throw exceptions::no_such_message_id if the message-id is not in the list
*/
- void removeMessageId(ref <messageId> mid);
+ void removeMessageId(shared_ptr <messageId> mid);
/** Remove the message-id at the specified position.
*
@@ -123,30 +123,30 @@ public:
* @param pos position
* @return message-id at position 'pos'
*/
- const ref <messageId> getMessageIdAt(const size_t pos);
+ const shared_ptr <messageId> getMessageIdAt(const size_t pos);
/** Return the message-id at the specified position.
*
* @param pos position
* @return message-id at position 'pos'
*/
- const ref <const messageId> getMessageIdAt(const size_t pos) const;
+ const shared_ptr <const messageId> getMessageIdAt(const size_t pos) const;
/** Return the message-id list.
*
* @return list of message-ids
*/
- const std::vector <ref <const messageId> > getMessageIdList() const;
+ const std::vector <shared_ptr <const messageId> > getMessageIdList() const;
/** Return the message-id list.
*
* @return list of message-ids
*/
- const std::vector <ref <messageId> > getMessageIdList();
+ const std::vector <shared_ptr <messageId> > getMessageIdList();
private:
- std::vector <ref <messageId> > m_list;
+ std::vector <shared_ptr <messageId> > m_list;
protected:
diff --git a/vmime/messageParser.hpp b/vmime/messageParser.hpp
index d89170ad..c3a48f11 100644
--- a/vmime/messageParser.hpp
+++ b/vmime/messageParser.hpp
@@ -49,7 +49,7 @@ class VMIME_EXPORT messageParser
public:
messageParser(const string& buffer);
- messageParser(ref <const message> msg);
+ messageParser(shared_ptr <const message> msg);
~messageParser();
public:
@@ -101,19 +101,19 @@ public:
* @param pos position of the attachment
* @return attachment at position 'pos'
*/
- const ref <const attachment> getAttachmentAt(const size_t pos) const;
+ const shared_ptr <const attachment> getAttachmentAt(const size_t pos) const;
/** Return the attachments of the message.
*
* @return list of attachments in the message
*/
- const std::vector <ref <const attachment> > getAttachmentList() const;
+ const std::vector <shared_ptr <const attachment> > getAttachmentList() const;
/** Return the text parts of the message.
*
* @return list of text parts in the message
*/
- const std::vector <ref <const textPart> > getTextPartList() const;
+ const std::vector <shared_ptr <const textPart> > getTextPartList() const;
/** Return the number of text parts in the message.
*
@@ -126,7 +126,7 @@ public:
* @param pos position of the text part
* @return text part at position 'pos'
*/
- const ref <const textPart> getTextPartAt(const size_t pos) const;
+ const shared_ptr <const textPart> getTextPartAt(const size_t pos) const;
private:
@@ -140,16 +140,16 @@ private:
datetime m_date;
- std::vector <ref <const attachment> > m_attach;
+ std::vector <shared_ptr <const attachment> > m_attach;
- std::vector <ref <textPart> > m_textParts;
+ std::vector <shared_ptr <textPart> > m_textParts;
- void parse(ref <const message> msg);
+ void parse(shared_ptr <const message> msg);
- void findAttachments(ref <const message> msg);
+ void findAttachments(shared_ptr <const message> msg);
- void findTextParts(ref <const bodyPart> msg, ref <const bodyPart> part);
- bool findSubTextParts(ref <const bodyPart> msg, ref <const bodyPart> part);
+ void findTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part);
+ bool findSubTextParts(shared_ptr <const bodyPart> msg, shared_ptr <const bodyPart> part);
};
diff --git a/vmime/misc/importanceHelper.hpp b/vmime/misc/importanceHelper.hpp
index c5c48f50..ae8297fc 100644
--- a/vmime/misc/importanceHelper.hpp
+++ b/vmime/misc/importanceHelper.hpp
@@ -58,13 +58,13 @@ public:
*
* @param msg message on which to reset importance
*/
- static void resetImportance(ref <message> msg);
+ static void resetImportance(shared_ptr <message> msg);
/** Reset the importance of a message to the default importance.
*
* @param hdr message header on which to reset importance
*/
- static void resetImportanceHeader(ref <header> hdr);
+ static void resetImportanceHeader(shared_ptr <header> hdr);
/** Return the importance of the specified message.
*
@@ -72,7 +72,7 @@ public:
* @return importance of the message, or default importance is no
* information about importance is given in the message
*/
- static Importance getImportance(ref <const message> msg);
+ static Importance getImportance(shared_ptr <const message> msg);
/** Return the importance of a message, given its header.
*
@@ -80,21 +80,21 @@ public:
* @return importance of the message, or default importance is no
* information about importance is given in the message
*/
- static Importance getImportanceHeader(ref <const header> hdr);
+ static Importance getImportanceHeader(shared_ptr <const header> hdr);
/** Set the importance of the specified message.
*
* @param msg message on which to set importance
* @param i new message importance
*/
- static void setImportance(ref <message> msg, const Importance i);
+ static void setImportance(shared_ptr <message> msg, const Importance i);
/** Set the importance of a message, given its header.
*
* @param hdr message header on which to set importance
* @param i new message importance
*/
- static void setImportanceHeader(ref <header> hdr, const Importance i);
+ static void setImportanceHeader(shared_ptr <header> hdr, const Importance i);
};
diff --git a/vmime/net/events.hpp b/vmime/net/events.hpp
index 1e5fd7f3..a3e952d4 100644
--- a/vmime/net/events.hpp
+++ b/vmime/net/events.hpp
@@ -75,13 +75,13 @@ public:
};
- messageCountEvent(ref <folder> folder, const Types type, const std::vector <int>& nums);
+ messageCountEvent(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums);
/** Return the folder in which messages have been added/removed.
*
* @return folder in which message count changed
*/
- ref <folder> getFolder() const;
+ shared_ptr <folder> getFolder() const;
/** Return the event type.
*
@@ -106,7 +106,7 @@ public:
private:
- ref <folder> m_folder;
+ shared_ptr <folder> m_folder;
const Types m_type;
std::vector <int> m_nums;
};
@@ -123,8 +123,8 @@ protected:
public:
- virtual void messagesAdded(ref <messageCountEvent> event) = 0;
- virtual void messagesRemoved(ref <messageCountEvent> event) = 0;
+ virtual void messagesAdded(shared_ptr <messageCountEvent> event) = 0;
+ virtual void messagesRemoved(shared_ptr <messageCountEvent> event) = 0;
};
@@ -144,13 +144,13 @@ public:
};
- messageChangedEvent(ref <folder> folder, const Types type, const std::vector <int>& nums);
+ messageChangedEvent(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums);
/** Return the folder in which messages have changed.
*
* @return folder in which message count changed
*/
- ref <folder> getFolder() const;
+ shared_ptr <folder> getFolder() const;
/** Return the event type.
*
@@ -175,7 +175,7 @@ public:
private:
- ref <folder> m_folder;
+ shared_ptr <folder> m_folder;
const Types m_type;
std::vector <int> m_nums;
};
@@ -192,7 +192,7 @@ protected:
public:
- virtual void messageChanged(ref <messageChangedEvent> event) = 0;
+ virtual void messageChanged(shared_ptr <messageChangedEvent> event) = 0;
};
@@ -214,13 +214,13 @@ public:
};
- folderEvent(ref <folder> folder, const Types type, const utility::path& oldPath, const utility::path& newPath);
+ folderEvent(shared_ptr <folder> folder, const Types type, const utility::path& oldPath, const utility::path& newPath);
/** Return the folder on which the event occured.
*
* @return folder on which the event occured
*/
- ref <folder> getFolder() const;
+ shared_ptr <folder> getFolder() const;
/** Return the event type.
*
@@ -239,7 +239,7 @@ public:
private:
- ref <folder> m_folder;
+ shared_ptr <folder> m_folder;
const Types m_type;
const utility::path m_oldPath;
const utility::path m_newPath;
@@ -257,9 +257,9 @@ protected:
public:
- virtual void folderCreated(ref <folderEvent> event) = 0;
- virtual void folderRenamed(ref <folderEvent> event) = 0;
- virtual void folderDeleted(ref <folderEvent> event) = 0;
+ virtual void folderCreated(shared_ptr <folderEvent> event) = 0;
+ virtual void folderRenamed(shared_ptr <folderEvent> event) = 0;
+ virtual void folderDeleted(shared_ptr <folderEvent> event) = 0;
};
diff --git a/vmime/net/folder.hpp b/vmime/net/folder.hpp
index 643a323b..deefaf49 100644
--- a/vmime/net/folder.hpp
+++ b/vmime/net/folder.hpp
@@ -186,7 +186,7 @@ public:
* @return a new object referencing the specified message
* @throw exceptions::net_exception if an error occurs
*/
- virtual ref <message> getMessage(const int num) = 0;
+ virtual shared_ptr <message> getMessage(const int num) = 0;
/** Get new references to messages in this folder, given either their
* sequence numbers or UIDs.
@@ -215,7 +215,7 @@ public:
* @return new objects referencing the specified messages
* @throw exceptions::net_exception if an error occurs
*/
- virtual std::vector <ref <message> > getMessages(const messageSet& msgs) = 0;
+ virtual std::vector <shared_ptr <message> > getMessages(const messageSet& msgs) = 0;
/** Return the number of messages in this folder.
*
@@ -229,7 +229,7 @@ public:
* @return a new object referencing the specified folder
* @throw exceptions::net_exception if an error occurs
*/
- virtual ref <folder> getFolder(const folder::path::component& name) = 0;
+ virtual shared_ptr <folder> getFolder(const folder::path::component& name) = 0;
/** Get the list of all sub-folders in this folder.
*
@@ -238,7 +238,7 @@ public:
* @return list of sub-folders
* @throw exceptions::net_exception if an error occurs
*/
- virtual std::vector <ref <folder> > getFolders(const bool recursive = false) = 0;
+ virtual std::vector <shared_ptr <folder> > getFolders(const bool recursive = false) = 0;
/** Rename (move) this folder to another location.
*
@@ -271,7 +271,7 @@ public:
* @param progress progress listener, or NULL if not used
* @throw exceptions::net_exception if an error occurs
*/
- virtual void addMessage(ref <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL) = 0;
+ virtual void addMessage(shared_ptr <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL) = 0;
/** Add a message to this folder.
*
@@ -307,7 +307,7 @@ public:
* @return current folder status
* @throw exceptions::net_exception if an error occurs
*/
- virtual ref <folderStatus> getStatus() = 0;
+ virtual shared_ptr <folderStatus> getStatus() = 0;
/** Expunge deleted messages.
*
@@ -319,19 +319,19 @@ public:
*
* @return parent folder object
*/
- virtual ref <folder> getParent() = 0;
+ virtual shared_ptr <folder> getParent() = 0;
/** Return a reference to the store to which this folder belongs.
*
* @return the store object to which this folder is attached
*/
- virtual ref <const store> getStore() const = 0;
+ virtual shared_ptr <const store> getStore() const = 0;
/** Return a reference to the store to which this folder belongs.
*
* @return the store object to which this folder is attached
*/
- virtual ref <store> getStore() = 0;
+ virtual shared_ptr <store> getStore() = 0;
/** Fetch objects for the specified messages.
*
@@ -340,7 +340,7 @@ public:
* @param progress progress listener, or NULL if not used
* @throw exceptions::net_exception if an error occurs
*/
- virtual void fetchMessages(std::vector <ref <message> >& msg, const fetchAttributes& attribs, utility::progressListener* progress = NULL) = 0;
+ virtual void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& attribs, utility::progressListener* progress = NULL) = 0;
/** Fetch objects for the specified message.
*
@@ -348,7 +348,7 @@ public:
* @param attribs set of attributes to fetch
* @throw exceptions::net_exception if an error occurs
*/
- virtual void fetchMessage(ref <message> msg, const fetchAttributes& attribs) = 0;
+ virtual void fetchMessage(shared_ptr <message> msg, const fetchAttributes& attribs) = 0;
/** Return the list of fetchable objects supported by
* the underlying protocol (see folder::fetchAttributes).
@@ -377,10 +377,10 @@ public:
protected:
- void notifyMessageChanged(ref <events::messageChangedEvent> event);
- void notifyMessageCount(ref <events::messageCountEvent> event);
- void notifyFolder(ref <events::folderEvent> event);
- void notifyEvent(ref <events::event> event);
+ void notifyMessageChanged(shared_ptr <events::messageChangedEvent> event);
+ void notifyMessageCount(shared_ptr <events::messageCountEvent> event);
+ void notifyFolder(shared_ptr <events::folderEvent> event);
+ void notifyEvent(shared_ptr <events::event> event);
private:
diff --git a/vmime/net/folderStatus.hpp b/vmime/net/folderStatus.hpp
index f4cc62fc..b94db052 100644
--- a/vmime/net/folderStatus.hpp
+++ b/vmime/net/folderStatus.hpp
@@ -61,7 +61,7 @@ public:
*
* @return a copy of this object
*/
- virtual ref <folderStatus> clone() const = 0;
+ virtual shared_ptr <folderStatus> clone() const = 0;
};
diff --git a/vmime/net/imap/IMAPConnection.hpp b/vmime/net/imap/IMAPConnection.hpp
index ff95c611..bc5590ba 100644
--- a/vmime/net/imap/IMAPConnection.hpp
+++ b/vmime/net/imap/IMAPConnection.hpp
@@ -54,7 +54,7 @@ class VMIME_EXPORT IMAPConnection : public object
{
public:
- IMAPConnection(ref <IMAPStore> store, ref <security::authenticator> auth);
+ IMAPConnection(shared_ptr <IMAPStore> store, shared_ptr <security::authenticator> auth);
~IMAPConnection();
@@ -85,22 +85,22 @@ public:
IMAPParser::response* readResponse(IMAPParser::literalHandler* lh = NULL);
- ref <const IMAPStore> getStore() const;
- ref <IMAPStore> getStore();
+ shared_ptr <const IMAPStore> getStore() const;
+ shared_ptr <IMAPStore> getStore();
- ref <session> getSession();
+ shared_ptr <session> getSession();
void fetchCapabilities();
void invalidateCapabilities();
const std::vector <string> getCapabilities();
bool hasCapability(const string& capa);
- ref <security::authenticator> getAuthenticator();
+ shared_ptr <security::authenticator> getAuthenticator();
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
+ shared_ptr <connectionInfos> getConnectionInfos() const;
- ref <const socket> getSocket() const;
+ shared_ptr <const socket> getSocket() const;
bool isMODSEQDisabled() const;
void disableMODSEQ();
@@ -120,24 +120,24 @@ private:
void processCapabilityResponseData(const IMAPParser::capability_data* capaData);
- weak_ref <IMAPStore> m_store;
+ weak_ptr <IMAPStore> m_store;
- ref <security::authenticator> m_auth;
+ shared_ptr <security::authenticator> m_auth;
- ref <socket> m_socket;
+ shared_ptr <socket> m_socket;
- ref <IMAPParser> m_parser;
+ shared_ptr <IMAPParser> m_parser;
- ref <IMAPTag> m_tag;
+ shared_ptr <IMAPTag> m_tag;
char m_hierarchySeparator;
ProtocolStates m_state;
- ref <timeoutHandler> m_timeoutHandler;
+ shared_ptr <timeoutHandler> m_timeoutHandler;
bool m_secured;
- ref <connectionInfos> m_cntInfos;
+ shared_ptr <connectionInfos> m_cntInfos;
bool m_firstTag;
diff --git a/vmime/net/imap/IMAPFolder.hpp b/vmime/net/imap/IMAPFolder.hpp
index 7bb9c0af..5edbfb16 100644
--- a/vmime/net/imap/IMAPFolder.hpp
+++ b/vmime/net/imap/IMAPFolder.hpp
@@ -61,16 +61,15 @@ private:
friend class IMAPStore;
friend class IMAPMessage;
- friend class vmime::creator; // vmime::create <IMAPFolder>
-
- IMAPFolder(const folder::path& path, ref <IMAPStore> store, const int type = TYPE_UNDEFINED, const int flags = FLAG_UNDEFINED);
IMAPFolder(const IMAPFolder&);
- ~IMAPFolder();
-
public:
+ IMAPFolder(const folder::path& path, shared_ptr <IMAPStore> store, const int type = TYPE_UNDEFINED, const int flags = FLAG_UNDEFINED);
+
+ ~IMAPFolder();
+
int getMode() const;
int getType();
@@ -90,15 +89,15 @@ public:
bool isOpen() const;
- ref <message> getMessage(const int num);
- std::vector <ref <message> > getMessages(const messageSet& msgs);
+ shared_ptr <message> getMessage(const int num);
+ std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
std::vector <int> getMessageNumbersStartingOnUID(const message::uid& uid);
int getMessageCount();
- ref <folder> getFolder(const folder::path::component& name);
- std::vector <ref <folder> > getFolders(const bool recursive = false);
+ shared_ptr <folder> getFolder(const folder::path::component& name);
+ std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
void rename(const folder::path& newPath);
@@ -106,26 +105,26 @@ public:
void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET);
- void addMessage(ref <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
+ void addMessage(shared_ptr <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen);
- ref <folderStatus> getStatus();
+ shared_ptr <folderStatus> getStatus();
void noop();
void expunge();
- ref <folder> getParent();
+ shared_ptr <folder> getParent();
- ref <const store> getStore() const;
- ref <store> getStore();
+ shared_ptr <const store> getStore() const;
+ shared_ptr <store> getStore();
- void fetchMessages(std::vector <ref <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
- void fetchMessage(ref <message> msg, const fetchAttributes& options);
+ void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
+ void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options);
int getFetchCapabilities() const;
@@ -177,8 +176,8 @@ private:
void processStatusUpdate(const IMAPParser::response* resp);
- weak_ref <IMAPStore> m_store;
- ref <IMAPConnection> m_connection;
+ weak_ptr <IMAPStore> m_store;
+ shared_ptr <IMAPConnection> m_connection;
folder::path m_path;
folder::path::component m_name;
@@ -189,7 +188,7 @@ private:
int m_type;
int m_flags;
- ref <IMAPFolderStatus> m_status;
+ shared_ptr <IMAPFolderStatus> m_status;
std::vector <IMAPMessage*> m_messages;
};
diff --git a/vmime/net/imap/IMAPFolderStatus.hpp b/vmime/net/imap/IMAPFolderStatus.hpp
index bcd6415e..03ca5937 100644
--- a/vmime/net/imap/IMAPFolderStatus.hpp
+++ b/vmime/net/imap/IMAPFolderStatus.hpp
@@ -55,7 +55,7 @@ public:
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
- ref <folderStatus> clone() const;
+ shared_ptr <folderStatus> clone() const;
/** Returns the the number of messages with the Recent flag set.
*
diff --git a/vmime/net/imap/IMAPMessage.hpp b/vmime/net/imap/IMAPMessage.hpp
index b57ae332..272fe17b 100644
--- a/vmime/net/imap/IMAPMessage.hpp
+++ b/vmime/net/imap/IMAPMessage.hpp
@@ -54,16 +54,16 @@ private:
friend class IMAPFolder;
friend class IMAPMessagePartContentHandler;
- friend class vmime::creator; // vmime::create <IMAPMessage>
- IMAPMessage(ref <IMAPFolder> folder, const int num);
- IMAPMessage(ref <IMAPFolder> folder, const int num, const uid& uid);
IMAPMessage(const IMAPMessage&) : message() { }
- ~IMAPMessage();
-
public:
+ IMAPMessage(shared_ptr <IMAPFolder> folder, const int num);
+ IMAPMessage(shared_ptr <IMAPFolder> folder, const int num, const uid& uid);
+
+ ~IMAPMessage();
+
int getNumber() const;
const uid getUID() const;
@@ -84,20 +84,20 @@ public:
bool isExpunged() const;
- ref <const messageStructure> getStructure() const;
- ref <messageStructure> getStructure();
+ shared_ptr <const messageStructure> getStructure() const;
+ shared_ptr <messageStructure> getStructure();
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
int getFlags() const;
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
+ void extractPart(shared_ptr <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void fetchPartHeader(ref <messagePart> p);
+ void fetchPartHeader(shared_ptr <messagePart> p);
- ref <vmime::message> getParsedMessage();
+ shared_ptr <vmime::message> getParsedMessage();
private:
@@ -125,7 +125,7 @@ private:
*
* @param str structure for which to fetch parts headers
*/
- void fetchPartHeaderForStructure(ref <messageStructure> str);
+ void fetchPartHeaderForStructure(shared_ptr <messageStructure> str);
/** Recursively contruct parsed message from structure.
* Called by getParsedMessage().
@@ -134,7 +134,7 @@ private:
* @param str structure for which to construct part
* @param level current nesting level (0 is root)
*/
- void constructParsedMessage(ref <bodyPart> parentPart, ref <messageStructure> str, int level = 0);
+ void constructParsedMessage(shared_ptr <bodyPart> parentPart, shared_ptr <messageStructure> str, int level = 0);
enum ExtractFlags
@@ -144,16 +144,16 @@ private:
EXTRACT_PEEK = 0x10
};
- void extractImpl(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress,
+ void extractImpl(shared_ptr <const messagePart> p, utility::outputStream& os, utility::progressListener* progress,
const int start, const int length, const int extractFlags) const;
- ref <header> getOrCreateHeader();
+ shared_ptr <header> getOrCreateHeader();
void onFolderClosed();
- weak_ref <IMAPFolder> m_folder;
+ weak_ptr <IMAPFolder> m_folder;
int m_num;
int m_size;
@@ -162,8 +162,8 @@ private:
uid m_uid;
vmime_uint64 m_modseq;
- ref <header> m_header;
- ref <messageStructure> m_structure;
+ shared_ptr <header> m_header;
+ shared_ptr <messageStructure> m_structure;
};
diff --git a/vmime/net/imap/IMAPMessagePart.hpp b/vmime/net/imap/IMAPMessagePart.hpp
index 5c38501d..f71d7d43 100644
--- a/vmime/net/imap/IMAPMessagePart.hpp
+++ b/vmime/net/imap/IMAPMessagePart.hpp
@@ -46,38 +46,34 @@ class IMAPMessageStructure;
class VMIME_EXPORT IMAPMessagePart : public messagePart
{
-private:
-
- friend class vmime::creator;
-
- IMAPMessagePart(ref <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
- IMAPMessagePart(ref <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_1part* part);
-
public:
- ref <const messageStructure> getStructure() const;
- ref <messageStructure> getStructure();
+ IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_mpart* mpart);
+ IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_1part* part);
+
+ shared_ptr <const messageStructure> getStructure() const;
+ shared_ptr <messageStructure> getStructure();
- ref <const IMAPMessagePart> getParent() const;
+ shared_ptr <const IMAPMessagePart> getParent() const;
const mediaType& getType() const;
int getSize() const;
int getNumber() const;
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
- static ref <IMAPMessagePart> create
- (ref <IMAPMessagePart> parent, const int number, const IMAPParser::body* body);
+ static shared_ptr <IMAPMessagePart> create
+ (shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body* body);
header& getOrCreateHeader();
private:
- ref <IMAPMessageStructure> m_structure;
- weak_ref <IMAPMessagePart> m_parent;
- ref <header> m_header;
+ shared_ptr <IMAPMessageStructure> m_structure;
+ weak_ptr <IMAPMessagePart> m_parent;
+ shared_ptr <header> m_header;
int m_number;
int m_size;
diff --git a/vmime/net/imap/IMAPMessagePartContentHandler.hpp b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
index ac273151..80e1f0e5 100644
--- a/vmime/net/imap/IMAPMessagePartContentHandler.hpp
+++ b/vmime/net/imap/IMAPMessagePartContentHandler.hpp
@@ -44,9 +44,9 @@ class VMIME_EXPORT IMAPMessagePartContentHandler : public contentHandler
{
public:
- IMAPMessagePartContentHandler(ref <IMAPMessage> msg, ref <messagePart> part, const vmime::encoding& encoding);
+ IMAPMessagePartContentHandler(shared_ptr <IMAPMessage> msg, shared_ptr <messagePart> part, const vmime::encoding& encoding);
- ref <contentHandler> clone() const;
+ shared_ptr <contentHandler> clone() const;
void generate(utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength = lineLengthLimits::infinite) const;
@@ -68,8 +68,8 @@ public:
private:
- weak_ref <IMAPMessage> m_message;
- weak_ref <messagePart> m_part;
+ weak_ptr <IMAPMessage> m_message;
+ weak_ptr <messagePart> m_part;
vmime::encoding m_encoding;
vmime::mediaType m_contentType;
diff --git a/vmime/net/imap/IMAPMessageStructure.hpp b/vmime/net/imap/IMAPMessageStructure.hpp
index e2a9f169..44b6d6f0 100644
--- a/vmime/net/imap/IMAPMessageStructure.hpp
+++ b/vmime/net/imap/IMAPMessageStructure.hpp
@@ -50,17 +50,17 @@ public:
IMAPMessageStructure();
IMAPMessageStructure(const IMAPParser::body* body);
- IMAPMessageStructure(ref <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list);
+ IMAPMessageStructure(shared_ptr <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list);
- ref <const messagePart> getPartAt(const size_t x) const;
- ref <messagePart> getPartAt(const size_t x);
+ shared_ptr <const messagePart> getPartAt(const size_t x) const;
+ shared_ptr <messagePart> getPartAt(const size_t x);
size_t getPartCount() const;
- static ref <IMAPMessageStructure> emptyStructure();
+ static shared_ptr <IMAPMessageStructure> emptyStructure();
private:
- std::vector <ref <IMAPMessagePart> > m_parts;
+ std::vector <shared_ptr <IMAPMessagePart> > m_parts;
};
diff --git a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
index 63858b89..519cadd8 100644
--- a/vmime/net/imap/IMAPParser.hpp
+++ b/vmime/net/imap/IMAPParser.hpp
@@ -36,7 +36,6 @@
#include "vmime/charset.hpp"
#include "vmime/exception.hpp"
-#include "vmime/utility/smartPtr.hpp"
#include "vmime/utility/stringUtils.hpp"
#include "vmime/utility/progressListener.hpp"
@@ -55,6 +54,7 @@
#include <vector>
#include <stdexcept>
+#include <memory>
//#define DEBUG_RESPONSE 1
@@ -142,19 +142,19 @@ class VMIME_EXPORT IMAPParser : public object
{
public:
- IMAPParser(weak_ref <IMAPTag> tag, weak_ref <socket> sok, weak_ref <timeoutHandler> _timeoutHandler)
+ IMAPParser(weak_ptr <IMAPTag> tag, weak_ptr <socket> sok, weak_ptr <timeoutHandler> _timeoutHandler)
: m_tag(tag), m_socket(sok), m_progress(NULL), m_strict(false),
m_literalHandler(NULL), m_timeoutHandler(_timeoutHandler)
{
}
- ref <const IMAPTag> getTag() const
+ shared_ptr <const IMAPTag> getTag() const
{
- return m_tag.acquire();
+ return m_tag.lock();
}
- void setSocket(ref <socket> sok)
+ void setSocket(shared_ptr <socket> sok)
{
m_socket = sok;
}
@@ -871,7 +871,7 @@ public:
// quoted ::= <"> *QUOTED_CHAR <">
if (parser.check <one_char <'"'> >(line, &pos, true))
{
- utility::auto_ptr <quoted_text> text(parser.get <quoted_text>(line, &pos));
+ std::auto_ptr <quoted_text> text(parser.get <quoted_text>(line, &pos));
parser.check <one_char <'"'> >(line, &pos);
if (parser.m_literalHandler != NULL)
@@ -2189,28 +2189,28 @@ public:
parser.check <one_char <'"'> >(line, &pos);
parser.check <SPACE>(line, &pos, true);
- utility::auto_ptr <number> nd(parser.get <number>(line, &pos));
+ std::auto_ptr <number> nd(parser.get <number>(line, &pos));
parser.check <one_char <'-'> >(line, &pos);
- utility::auto_ptr <atom> amo(parser.get <atom>(line, &pos));
+ std::auto_ptr <atom> amo(parser.get <atom>(line, &pos));
parser.check <one_char <'-'> >(line, &pos);
- utility::auto_ptr <number> ny(parser.get <number>(line, &pos));
+ std::auto_ptr <number> ny(parser.get <number>(line, &pos));
parser.check <SPACE>(line, &pos, true);
// 2digit ":" 2digit ":" 2digit
- utility::auto_ptr <number> nh(parser.get <number>(line, &pos));
+ std::auto_ptr <number> nh(parser.get <number>(line, &pos));
parser.check <one_char <':'> >(line, &pos);
- utility::auto_ptr <number> nmi(parser.get <number>(line, &pos));
+ std::auto_ptr <number> nmi(parser.get <number>(line, &pos));
parser.check <one_char <':'> >(line, &pos);
- utility::auto_ptr <number> ns(parser.get <number>(line, &pos));
+ std::auto_ptr <number> ns(parser.get <number>(line, &pos));
parser.check <SPACE>(line, &pos, true);
@@ -2220,7 +2220,7 @@ public:
if (!(parser.check <one_char <'+'> >(line, &pos, true)))
parser.check <one_char <'-'> >(line, &pos);
- utility::auto_ptr <number> nz(parser.get <number>(line, &pos));
+ std::auto_ptr <number> nz(parser.get <number>(line, &pos));
parser.check <one_char <'"'> >(line, &pos);
@@ -5406,8 +5406,8 @@ public:
private:
- weak_ref <IMAPTag> m_tag;
- weak_ref <socket> m_socket;
+ weak_ptr <IMAPTag> m_tag;
+ weak_ptr <socket> m_socket;
utility::progressListener* m_progress;
@@ -5415,7 +5415,7 @@ private:
literalHandler* m_literalHandler;
- weak_ref <timeoutHandler> m_timeoutHandler;
+ weak_ptr <timeoutHandler> m_timeoutHandler;
string m_buffer;
@@ -5461,8 +5461,8 @@ public:
{
string receiveBuffer;
- ref <timeoutHandler> toh = m_timeoutHandler.acquire();
- ref <socket> sok = m_socket.acquire();
+ shared_ptr <timeoutHandler> toh = m_timeoutHandler.lock();
+ shared_ptr <socket> sok = m_socket.lock();
if (toh)
toh->resetTimeOut();
@@ -5499,8 +5499,8 @@ public:
string::size_type len = 0;
string receiveBuffer;
- ref <timeoutHandler> toh = m_timeoutHandler.acquire();
- ref <socket> sok = m_socket.acquire();
+ shared_ptr <timeoutHandler> toh = m_timeoutHandler.lock();
+ shared_ptr <socket> sok = m_socket.lock();
if (m_progress)
m_progress->start(count);
diff --git a/vmime/net/imap/IMAPSStore.hpp b/vmime/net/imap/IMAPSStore.hpp
index e7f05d3f..9d27bdd0 100644
--- a/vmime/net/imap/IMAPSStore.hpp
+++ b/vmime/net/imap/IMAPSStore.hpp
@@ -46,7 +46,7 @@ class VMIME_EXPORT IMAPSStore : public IMAPStore
{
public:
- IMAPSStore(ref <session> sess, ref <security::authenticator> auth);
+ IMAPSStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth);
~IMAPSStore();
const string getProtocolName() const;
diff --git a/vmime/net/imap/IMAPStore.hpp b/vmime/net/imap/IMAPStore.hpp
index e6b27d8d..f854fadf 100644
--- a/vmime/net/imap/IMAPStore.hpp
+++ b/vmime/net/imap/IMAPStore.hpp
@@ -60,14 +60,14 @@ class VMIME_EXPORT IMAPStore : public store
public:
- IMAPStore(ref <session> sess, ref <security::authenticator> auth, const bool secured = false);
+ IMAPStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false);
~IMAPStore();
const string getProtocolName() const;
- ref <folder> getDefaultFolder();
- ref <folder> getRootFolder();
- ref <folder> getFolder(const folder::path& path);
+ shared_ptr <folder> getDefaultFolder();
+ shared_ptr <folder> getRootFolder();
+ shared_ptr <folder> getFolder(const folder::path& path);
bool isValidFolderName(const folder::path::component& name) const;
@@ -85,17 +85,17 @@ public:
bool isIMAPS() const;
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
- ref <IMAPConnection> getConnection();
+ shared_ptr <connectionInfos> getConnectionInfos() const;
+ shared_ptr <IMAPConnection> getConnection();
protected:
// Connection
- ref <IMAPConnection> m_connection;
+ shared_ptr <IMAPConnection> m_connection;
- ref <IMAPConnection> connection();
+ shared_ptr <IMAPConnection> connection();
void registerFolder(IMAPFolder* folder);
diff --git a/vmime/net/imap/IMAPUtils.hpp b/vmime/net/imap/IMAPUtils.hpp
index 76c44494..988b6a2c 100644
--- a/vmime/net/imap/IMAPUtils.hpp
+++ b/vmime/net/imap/IMAPUtils.hpp
@@ -89,7 +89,7 @@ public:
* @return fetch request
*/
static const string buildFetchRequest
- (ref <IMAPConnection> cnt, const messageSet& msgs, const fetchAttributes& options);
+ (shared_ptr <IMAPConnection> cnt, const messageSet& msgs, const fetchAttributes& options);
/** Convert a parser-style address list to a mailbox list.
*
@@ -115,7 +115,7 @@ public:
private:
static const string buildFetchRequestImpl
- (ref <IMAPConnection> cnt, const string& mode, const string& set, const int options);
+ (shared_ptr <IMAPConnection> cnt, const string& mode, const string& set, const int options);
};
diff --git a/vmime/net/maildir/format/courierMaildirFormat.hpp b/vmime/net/maildir/format/courierMaildirFormat.hpp
index 6f47b7f8..b8443426 100644
--- a/vmime/net/maildir/format/courierMaildirFormat.hpp
+++ b/vmime/net/maildir/format/courierMaildirFormat.hpp
@@ -47,7 +47,7 @@ class VMIME_EXPORT courierMaildirFormat : public maildirFormat
{
public:
- courierMaildirFormat(ref <context> ctx);
+ courierMaildirFormat(shared_ptr <context> ctx);
/* Folder types:
diff --git a/vmime/net/maildir/format/kmailMaildirFormat.hpp b/vmime/net/maildir/format/kmailMaildirFormat.hpp
index ca73eba7..98ca212e 100644
--- a/vmime/net/maildir/format/kmailMaildirFormat.hpp
+++ b/vmime/net/maildir/format/kmailMaildirFormat.hpp
@@ -47,7 +47,7 @@ class VMIME_EXPORT kmailMaildirFormat : public maildirFormat
{
public:
- kmailMaildirFormat(ref <context> ctx);
+ kmailMaildirFormat(shared_ptr <context> ctx);
/* Folder types:
diff --git a/vmime/net/maildir/maildirFolder.hpp b/vmime/net/maildir/maildirFolder.hpp
index 92de4d0d..338c6f96 100644
--- a/vmime/net/maildir/maildirFolder.hpp
+++ b/vmime/net/maildir/maildirFolder.hpp
@@ -59,15 +59,15 @@ private:
friend class maildirStore;
friend class maildirMessage;
- friend class vmime::creator; // vmime::create <maildirFolder>
-
- maildirFolder(const folder::path& path, ref <maildirStore> store);
maildirFolder(const maildirFolder&) : folder() { }
+public:
+
+ maildirFolder(const folder::path& path, shared_ptr <maildirStore> store);
+
~maildirFolder();
-public:
int getMode() const;
@@ -88,13 +88,13 @@ public:
bool isOpen() const;
- ref <message> getMessage(const int num);
- std::vector <ref <message> > getMessages(const messageSet& msgs);
+ shared_ptr <message> getMessage(const int num);
+ std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
int getMessageCount();
- ref <folder> getFolder(const folder::path::component& name);
- std::vector <ref <folder> > getFolders(const bool recursive = false);
+ shared_ptr <folder> getFolder(const folder::path::component& name);
+ std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
void rename(const folder::path& newPath);
@@ -102,24 +102,24 @@ public:
void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET);
- void addMessage(ref <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
+ void addMessage(shared_ptr <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen);
- ref <folderStatus> getStatus();
+ shared_ptr <folderStatus> getStatus();
void expunge();
- ref <folder> getParent();
+ shared_ptr <folder> getParent();
- ref <const store> getStore() const;
- ref <store> getStore();
+ shared_ptr <const store> getStore() const;
+ shared_ptr <store> getStore();
- void fetchMessages(std::vector <ref <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
- void fetchMessage(ref <message> msg, const fetchAttributes& options);
+ void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
+ void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options);
int getFetchCapabilities() const;
@@ -129,7 +129,7 @@ private:
void scanFolder();
- void listFolders(std::vector <ref <folder> >& list, const bool recursive);
+ void listFolders(std::vector <shared_ptr <folder> >& list, const bool recursive);
void registerMessage(maildirMessage* msg);
void unregisterMessage(maildirMessage* msg);
@@ -149,7 +149,7 @@ private:
void notifyMessagesCopied(const folder::path& dest);
- weak_ref <maildirStore> m_store;
+ weak_ptr <maildirStore> m_store;
folder::path m_path;
folder::path::component m_name;
diff --git a/vmime/net/maildir/maildirFolderStatus.hpp b/vmime/net/maildir/maildirFolderStatus.hpp
index 28e01f11..155fb20f 100644
--- a/vmime/net/maildir/maildirFolderStatus.hpp
+++ b/vmime/net/maildir/maildirFolderStatus.hpp
@@ -53,7 +53,7 @@ public:
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
- ref <folderStatus> clone() const;
+ shared_ptr <folderStatus> clone() const;
void setMessageCount(const unsigned int count);
diff --git a/vmime/net/maildir/maildirFormat.hpp b/vmime/net/maildir/maildirFormat.hpp
index e2afea6d..c0daf288 100644
--- a/vmime/net/maildir/maildirFormat.hpp
+++ b/vmime/net/maildir/maildirFormat.hpp
@@ -55,13 +55,13 @@ public:
{
public:
- context(ref <maildirStore> store);
+ context(shared_ptr <maildirStore> store);
- ref <maildirStore> getStore() const;
+ shared_ptr <maildirStore> getStore() const;
private:
- weak_ref <maildirStore> m_store;
+ weak_ptr <maildirStore> m_store;
};
@@ -146,7 +146,7 @@ public:
* @param store of which to detect format
* @return a Maildir format implementation for the specified store
*/
- static ref <maildirFormat> detect(ref <maildirStore> store);
+ static shared_ptr <maildirFormat> detect(shared_ptr <maildirStore> store);
protected:
@@ -155,20 +155,20 @@ protected:
static const utility::file::path::component NEW_DIR; /**< Unread messages. */
- maildirFormat(ref <context> ctx);
+ maildirFormat(shared_ptr <context> ctx);
/** Returns the current context.
*
* @return current context
*/
- ref <context> getContext();
+ shared_ptr <context> getContext();
/** Returns the current context (const version).
*
* @return current context
*/
- ref <const context> getContext() const;
+ shared_ptr <const context> getContext() const;
/** Quick checks whether this implementation can read the Maildir
* format in the specified directory.
@@ -180,7 +180,7 @@ protected:
private:
- ref <context> m_context;
+ shared_ptr <context> m_context;
};
diff --git a/vmime/net/maildir/maildirMessage.hpp b/vmime/net/maildir/maildirMessage.hpp
index 527461ff..6218c812 100644
--- a/vmime/net/maildir/maildirMessage.hpp
+++ b/vmime/net/maildir/maildirMessage.hpp
@@ -49,16 +49,15 @@ class maildirFolder;
class VMIME_EXPORT maildirMessage : public message
{
friend class maildirFolder;
- friend class vmime::creator; // vmime::create <maildirMessage>
-private:
-
- maildirMessage(ref <maildirFolder> folder, const int num);
maildirMessage(const maildirMessage&) : message() { }
+public:
+
+ maildirMessage(shared_ptr <maildirFolder> folder, const int num);
+
~maildirMessage();
-public:
int getNumber() const;
@@ -68,33 +67,33 @@ public:
bool isExpunged() const;
- ref <const messageStructure> getStructure() const;
- ref <messageStructure> getStructure();
+ shared_ptr <const messageStructure> getStructure() const;
+ shared_ptr <messageStructure> getStructure();
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
int getFlags() const;
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
+ void extractPart(shared_ptr <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void fetchPartHeader(ref <messagePart> p);
+ void fetchPartHeader(shared_ptr <messagePart> p);
- ref <vmime::message> getParsedMessage();
+ shared_ptr <vmime::message> getParsedMessage();
private:
- void fetch(ref <maildirFolder> folder, const fetchAttributes& options);
+ void fetch(shared_ptr <maildirFolder> folder, const fetchAttributes& options);
void onFolderClosed();
- ref <header> getOrCreateHeader();
+ shared_ptr <header> getOrCreateHeader();
void extractImpl(utility::outputStream& os, utility::progressListener* progress, const int start, const int length, const int partialStart, const int partialLength, const bool peek) const;
- weak_ref <maildirFolder> m_folder;
+ weak_ptr <maildirFolder> m_folder;
int m_num;
int m_size;
@@ -102,8 +101,8 @@ private:
bool m_expunged;
uid m_uid;
- ref <header> m_header;
- ref <messageStructure> m_structure;
+ shared_ptr <header> m_header;
+ shared_ptr <messageStructure> m_structure;
};
diff --git a/vmime/net/maildir/maildirMessagePart.hpp b/vmime/net/maildir/maildirMessagePart.hpp
index f79804ca..00c931ec 100644
--- a/vmime/net/maildir/maildirMessagePart.hpp
+++ b/vmime/net/maildir/maildirMessagePart.hpp
@@ -46,20 +46,20 @@ class maildirMessagePart : public messagePart
{
public:
- maildirMessagePart(ref <maildirMessagePart> parent, const int number, const bodyPart& part);
+ maildirMessagePart(shared_ptr <maildirMessagePart> parent, const int number, const bodyPart& part);
~maildirMessagePart();
- ref <const messageStructure> getStructure() const;
- ref <messageStructure> getStructure();
+ shared_ptr <const messageStructure> getStructure() const;
+ shared_ptr <messageStructure> getStructure();
- weak_ref <const maildirMessagePart> getParent() const { return (m_parent); }
+ weak_ptr <const maildirMessagePart> getParent() const { return (m_parent); }
const mediaType& getType() const;
int getSize() const;
int getNumber() const;
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
header& getOrCreateHeader();
@@ -73,9 +73,9 @@ public:
private:
- ref <maildirMessageStructure> m_structure;
- weak_ref <maildirMessagePart> m_parent;
- ref <header> m_header;
+ shared_ptr <maildirMessageStructure> m_structure;
+ weak_ptr <maildirMessagePart> m_parent;
+ shared_ptr <header> m_header;
int m_number;
int m_size;
diff --git a/vmime/net/maildir/maildirMessageStructure.hpp b/vmime/net/maildir/maildirMessageStructure.hpp
index 6d62be2b..a43fc15c 100644
--- a/vmime/net/maildir/maildirMessageStructure.hpp
+++ b/vmime/net/maildir/maildirMessageStructure.hpp
@@ -47,22 +47,22 @@ class maildirMessageStructure : public messageStructure
public:
maildirMessageStructure();
- maildirMessageStructure(ref <maildirMessagePart> parent, const bodyPart& part);
- maildirMessageStructure(ref <maildirMessagePart> parent, const std::vector <ref <const vmime::bodyPart> >& list);
+ maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const bodyPart& part);
+ maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list);
- ref <const messagePart> getPartAt(const size_t x) const;
- ref <messagePart> getPartAt(const size_t x);
+ shared_ptr <const messagePart> getPartAt(const size_t x) const;
+ shared_ptr <messagePart> getPartAt(const size_t x);
size_t getPartCount() const;
- static ref <maildirMessageStructure> emptyStructure();
+ static shared_ptr <maildirMessageStructure> emptyStructure();
private:
- static ref <maildirMessageStructure> m_emptyStructure;
+ static shared_ptr <maildirMessageStructure> m_emptyStructure;
- std::vector <ref <maildirMessagePart> > m_parts;
+ std::vector <shared_ptr <maildirMessagePart> > m_parts;
};
diff --git a/vmime/net/maildir/maildirStore.hpp b/vmime/net/maildir/maildirStore.hpp
index b6ccd111..efadfdfe 100644
--- a/vmime/net/maildir/maildirStore.hpp
+++ b/vmime/net/maildir/maildirStore.hpp
@@ -60,14 +60,14 @@ class VMIME_EXPORT maildirStore : public store
public:
- maildirStore(ref <session> sess, ref <security::authenticator> auth);
+ maildirStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth);
~maildirStore();
const string getProtocolName() const;
- ref <folder> getDefaultFolder();
- ref <folder> getRootFolder();
- ref <folder> getFolder(const folder::path& path);
+ shared_ptr <folder> getDefaultFolder();
+ shared_ptr <folder> getRootFolder();
+ shared_ptr <folder> getFolder(const folder::path& path);
bool isValidFolderName(const folder::path::component& name) const;
@@ -85,10 +85,10 @@ public:
int getCapabilities() const;
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
+ shared_ptr <connectionInfos> getConnectionInfos() const;
- ref <maildirFormat> getFormat();
- ref <const maildirFormat> getFormat() const;
+ shared_ptr <maildirFormat> getFormat();
+ shared_ptr <const maildirFormat> getFormat() const;
private:
@@ -98,7 +98,7 @@ private:
std::list <maildirFolder*> m_folders;
- ref <maildirFormat> m_format;
+ shared_ptr <maildirFormat> m_format;
bool m_connected;
diff --git a/vmime/net/maildir/maildirUtils.hpp b/vmime/net/maildir/maildirUtils.hpp
index 072a2648..82deefbb 100644
--- a/vmime/net/maildir/maildirUtils.hpp
+++ b/vmime/net/maildir/maildirUtils.hpp
@@ -130,7 +130,7 @@ public:
*
* @param dir directory to delete
*/
- static void recursiveFSDelete(ref <utility::file> dir);
+ static void recursiveFSDelete(shared_ptr <utility::file> dir);
/** Returns a list of message numbers given a message set.
*
diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp
index 6bf4b492..4e291089 100644
--- a/vmime/net/message.hpp
+++ b/vmime/net/message.hpp
@@ -65,20 +65,20 @@ public:
*
* @return structure of the part
*/
- virtual ref <const messageStructure> getStructure() const = 0;
+ virtual shared_ptr <const messageStructure> getStructure() const = 0;
/** Return the structure of this part.
*
* @return structure of the part
*/
- virtual ref <messageStructure> getStructure() = 0;
+ virtual shared_ptr <messageStructure> getStructure() = 0;
/** Return the header section for this part (you must fetch header
* before using this function: see message::fetchPartHeader).
*
* @return header section
*/
- virtual ref <const header> getHeader() const = 0;
+ virtual shared_ptr <const header> getHeader() const = 0;
/** Return the media-type of the content in this part.
*
@@ -105,7 +105,7 @@ public:
* @param pos index of the sub-part
* @return sub-part at position 'pos'
*/
- ref <const messagePart> getPartAt(const size_t pos) const;
+ shared_ptr <const messagePart> getPartAt(const size_t pos) const;
/** Return the sub-part at the specified position (zero is the
* first part).
@@ -113,7 +113,7 @@ public:
* @param pos index of the sub-part
* @return sub-part at position 'pos'
*/
- ref <messagePart> getPartAt(const size_t pos);
+ shared_ptr <messagePart> getPartAt(const size_t pos);
/** Return the number of sub-parts in this part.
*
@@ -143,7 +143,7 @@ public:
* @param pos position
* @return part at position 'pos'
*/
- virtual ref <const messagePart> getPartAt(const size_t pos) const = 0;
+ virtual shared_ptr <const messagePart> getPartAt(const size_t pos) const = 0;
/** Return the part at the specified position (first
* part is at position 0).
@@ -151,7 +151,7 @@ public:
* @param pos position
* @return part at position 'pos'
*/
- virtual ref <messagePart> getPartAt(const size_t pos) = 0;
+ virtual shared_ptr <messagePart> getPartAt(const size_t pos) = 0;
/** Return the number of parts in this part.
*
@@ -206,19 +206,19 @@ public:
*
* @return MIME structure of the message
*/
- virtual ref <const messageStructure> getStructure() const = 0;
+ virtual shared_ptr <const messageStructure> getStructure() const = 0;
/** Return the MIME structure of the message (must fetch before).
*
* @return MIME structure of the message
*/
- virtual ref <messageStructure> getStructure() = 0;
+ virtual shared_ptr <messageStructure> getStructure() = 0;
/** Return a reference to the header fields of the message (must fetch before).
*
* @return header section of the message
*/
- virtual ref <const header> getHeader() const = 0;
+ virtual shared_ptr <const header> getHeader() const = 0;
/** Return the sequence number of this message. This number is
* used to reference the message in the folder.
@@ -313,7 +313,7 @@ public:
* an exception if not supported.
*/
virtual void extractPart
- (ref <const messagePart> p,
+ (shared_ptr <const messagePart> p,
utility::outputStream& os,
utility::progressListener* progress = NULL,
const int start = 0,
@@ -324,7 +324,7 @@ public:
*
* @param p the part for which to fetch the header
*/
- virtual void fetchPartHeader(ref <messagePart> p) = 0;
+ virtual void fetchPartHeader(shared_ptr <messagePart> p) = 0;
/** Get the RFC-822 message for this abstract message.
* Warning: This may require getting some data (ie: structure and headers) from
@@ -334,7 +334,7 @@ public:
*
* @return a RFC-822-parsed message
*/
- virtual ref <vmime::message> getParsedMessage() = 0;
+ virtual shared_ptr <vmime::message> getParsedMessage() = 0;
};
diff --git a/vmime/net/pop3/POP3Command.hpp b/vmime/net/pop3/POP3Command.hpp
index ef2b3ac4..cc3c4fd5 100644
--- a/vmime/net/pop3/POP3Command.hpp
+++ b/vmime/net/pop3/POP3Command.hpp
@@ -52,40 +52,38 @@ class POP3Connection;
*/
class VMIME_EXPORT POP3Command : public object
{
- friend class vmime::creator;
-
public:
- static ref <POP3Command> CAPA();
- static ref <POP3Command> NOOP();
- static ref <POP3Command> AUTH(const string& mechName);
- static ref <POP3Command> STLS();
- static ref <POP3Command> APOP(const string& username, const string& digest);
- static ref <POP3Command> USER(const string& username);
- static ref <POP3Command> PASS(const string& password);
- static ref <POP3Command> STAT();
- static ref <POP3Command> LIST();
- static ref <POP3Command> LIST(const unsigned long msg);
- static ref <POP3Command> UIDL();
- static ref <POP3Command> UIDL(const unsigned long msg);
- static ref <POP3Command> DELE(const unsigned long msg);
- static ref <POP3Command> RETR(const unsigned long msg);
- static ref <POP3Command> TOP(const unsigned long msg, const unsigned long lines);
- static ref <POP3Command> RSET();
- static ref <POP3Command> QUIT();
+ static shared_ptr <POP3Command> CAPA();
+ static shared_ptr <POP3Command> NOOP();
+ static shared_ptr <POP3Command> AUTH(const string& mechName);
+ static shared_ptr <POP3Command> STLS();
+ static shared_ptr <POP3Command> APOP(const string& username, const string& digest);
+ static shared_ptr <POP3Command> USER(const string& username);
+ static shared_ptr <POP3Command> PASS(const string& password);
+ static shared_ptr <POP3Command> STAT();
+ static shared_ptr <POP3Command> LIST();
+ static shared_ptr <POP3Command> LIST(const unsigned long msg);
+ static shared_ptr <POP3Command> UIDL();
+ static shared_ptr <POP3Command> UIDL(const unsigned long msg);
+ static shared_ptr <POP3Command> DELE(const unsigned long msg);
+ static shared_ptr <POP3Command> RETR(const unsigned long msg);
+ static shared_ptr <POP3Command> TOP(const unsigned long msg, const unsigned long lines);
+ static shared_ptr <POP3Command> RSET();
+ static shared_ptr <POP3Command> QUIT();
/** Creates a new POP3 command with the specified text.
*
* @param text command text
* @return a new POP3Command object
*/
- static ref <POP3Command> createCommand(const string& text);
+ static shared_ptr <POP3Command> createCommand(const string& text);
/** Sends this command over the specified connection.
*
* @param conn connection onto which the command will be sent
*/
- virtual void send(ref <POP3Connection> conn);
+ virtual void send(shared_ptr <POP3Connection> conn);
/** Returns the full text of the command, including command name
* and parameters (if any).
diff --git a/vmime/net/pop3/POP3Connection.hpp b/vmime/net/pop3/POP3Connection.hpp
index 96916bab..3622f745 100644
--- a/vmime/net/pop3/POP3Connection.hpp
+++ b/vmime/net/pop3/POP3Connection.hpp
@@ -62,11 +62,9 @@ class POP3Store;
*/
class VMIME_EXPORT POP3Connection : public object
{
- friend class vmime::creator;
-
public:
- POP3Connection(ref <POP3Store> store, ref <security::authenticator> auth);
+ POP3Connection(shared_ptr <POP3Store> store, shared_ptr <security::authenticator> auth);
virtual ~POP3Connection();
@@ -75,13 +73,13 @@ public:
virtual void disconnect();
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
+ shared_ptr <connectionInfos> getConnectionInfos() const;
- virtual ref <POP3Store> getStore();
- virtual ref <socket> getSocket();
- virtual ref <timeoutHandler> getTimeoutHandler();
- virtual ref <security::authenticator> getAuthenticator();
- virtual ref <session> getSession();
+ virtual shared_ptr <POP3Store> getStore();
+ virtual shared_ptr <socket> getSocket();
+ virtual shared_ptr <timeoutHandler> getTimeoutHandler();
+ virtual shared_ptr <security::authenticator> getAuthenticator();
+ virtual shared_ptr <session> getSession();
private:
@@ -101,16 +99,16 @@ private:
void internalDisconnect();
- weak_ref <POP3Store> m_store;
+ weak_ptr <POP3Store> m_store;
- ref <security::authenticator> m_auth;
- ref <socket> m_socket;
- ref <timeoutHandler> m_timeoutHandler;
+ shared_ptr <security::authenticator> m_auth;
+ shared_ptr <socket> m_socket;
+ shared_ptr <timeoutHandler> m_timeoutHandler;
bool m_authenticated;
bool m_secured;
- ref <connectionInfos> m_cntInfos;
+ shared_ptr <connectionInfos> m_cntInfos;
std::vector <string> m_capabilities;
bool m_capabilitiesFetched;
diff --git a/vmime/net/pop3/POP3Folder.hpp b/vmime/net/pop3/POP3Folder.hpp
index 5dbb8d1d..93a2bf35 100644
--- a/vmime/net/pop3/POP3Folder.hpp
+++ b/vmime/net/pop3/POP3Folder.hpp
@@ -57,15 +57,15 @@ private:
friend class POP3Store;
friend class POP3Message;
- friend class vmime::creator; // vmime::create <POP3Folder>
- POP3Folder(const folder::path& path, ref <POP3Store> store);
- POP3Folder(const POP3Folder&) : folder() { }
-
- ~POP3Folder();
+ POP3Folder(const POP3Folder&);
public:
+ POP3Folder(const folder::path& path, shared_ptr <POP3Store> store);
+
+ ~POP3Folder();
+
int getMode() const;
int getType();
@@ -85,13 +85,13 @@ public:
bool isOpen() const;
- ref <message> getMessage(const int num);
- std::vector <ref <message> > getMessages(const messageSet& msgs);
+ shared_ptr <message> getMessage(const int num);
+ std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
int getMessageCount();
- ref <folder> getFolder(const folder::path::component& name);
- std::vector <ref <folder> > getFolders(const bool recursive = false);
+ shared_ptr <folder> getFolder(const folder::path::component& name);
+ std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
void rename(const folder::path& newPath);
@@ -99,24 +99,24 @@ public:
void setMessageFlags(const messageSet& msgs, const int flags, const int mode = message::FLAG_MODE_SET);
- void addMessage(ref <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
+ void addMessage(shared_ptr <vmime::message> msg, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void addMessage(utility::inputStream& is, const int size, const int flags = message::FLAG_UNDEFINED, vmime::datetime* date = NULL, utility::progressListener* progress = NULL);
void copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen);
- ref <folderStatus> getStatus();
+ shared_ptr <folderStatus> getStatus();
void expunge();
- ref <folder> getParent();
+ shared_ptr <folder> getParent();
- ref <const store> getStore() const;
- ref <store> getStore();
+ shared_ptr <const store> getStore() const;
+ shared_ptr <store> getStore();
- void fetchMessages(std::vector <ref <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
- void fetchMessage(ref <message> msg, const fetchAttributes& options);
+ void fetchMessages(std::vector <shared_ptr <message> >& msg, const fetchAttributes& options, utility::progressListener* progress = NULL);
+ void fetchMessage(shared_ptr <message> msg, const fetchAttributes& options);
int getFetchCapabilities() const;
@@ -132,7 +132,7 @@ private:
void onClose();
- weak_ref <POP3Store> m_store;
+ weak_ptr <POP3Store> m_store;
folder::path m_path;
folder::path::component m_name;
diff --git a/vmime/net/pop3/POP3FolderStatus.hpp b/vmime/net/pop3/POP3FolderStatus.hpp
index d074ff47..70ba48b6 100644
--- a/vmime/net/pop3/POP3FolderStatus.hpp
+++ b/vmime/net/pop3/POP3FolderStatus.hpp
@@ -53,7 +53,7 @@ public:
unsigned int getMessageCount() const;
unsigned int getUnseenCount() const;
- ref <folderStatus> clone() const;
+ shared_ptr <folderStatus> clone() const;
void setMessageCount(const unsigned int count);
diff --git a/vmime/net/pop3/POP3Message.hpp b/vmime/net/pop3/POP3Message.hpp
index 573fe808..6cb3c719 100644
--- a/vmime/net/pop3/POP3Message.hpp
+++ b/vmime/net/pop3/POP3Message.hpp
@@ -51,14 +51,15 @@ class VMIME_EXPORT POP3Message : public message
private:
friend class POP3Folder;
- friend class vmime::creator; // vmime::create <POP3Message>
- POP3Message(ref <POP3Folder> folder, const int num);
- POP3Message(const POP3Message&) : message() { }
+ POP3Message(const POP3Message&);
+
+public:
+
+ POP3Message(shared_ptr <POP3Folder> folder, const int num);
~POP3Message();
-public:
int getNumber() const;
@@ -68,35 +69,35 @@ public:
bool isExpunged() const;
- ref <const messageStructure> getStructure() const;
- ref <messageStructure> getStructure();
+ shared_ptr <const messageStructure> getStructure() const;
+ shared_ptr <messageStructure> getStructure();
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
int getFlags() const;
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
void extract(utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void extractPart(ref <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
+ void extractPart(shared_ptr <const messagePart> p, utility::outputStream& os, utility::progressListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
- void fetchPartHeader(ref <messagePart> p);
+ void fetchPartHeader(shared_ptr <messagePart> p);
- ref <vmime::message> getParsedMessage();
+ shared_ptr <vmime::message> getParsedMessage();
private:
- void fetch(ref <POP3Folder> folder, const fetchAttributes& options);
+ void fetch(shared_ptr <POP3Folder> folder, const fetchAttributes& options);
void onFolderClosed();
- weak_ref <POP3Folder> m_folder;
+ weak_ptr <POP3Folder> m_folder;
int m_num;
uid m_uid;
int m_size;
bool m_deleted;
- ref <header> m_header;
+ shared_ptr <header> m_header;
};
diff --git a/vmime/net/pop3/POP3Response.hpp b/vmime/net/pop3/POP3Response.hpp
index efe72d05..4b69290f 100644
--- a/vmime/net/pop3/POP3Response.hpp
+++ b/vmime/net/pop3/POP3Response.hpp
@@ -57,8 +57,6 @@ class POP3Connection;
*/
class VMIME_EXPORT POP3Response : public object
{
- friend class vmime::creator;
-
public:
/** Possible response codes. */
@@ -78,7 +76,7 @@ public:
* @throws exceptions::operation_timed_out if no data
* has been received within the granted time
*/
- static ref <POP3Response> readResponse(ref <POP3Connection> conn);
+ static shared_ptr <POP3Response> readResponse(shared_ptr <POP3Connection> conn);
/** Receive and parse a multiline POP3 response from
* the specified connection.
@@ -88,7 +86,7 @@ public:
* @throws exceptions::operation_timed_out if no data
* has been received within the granted time
*/
- static ref <POP3Response> readMultilineResponse(ref <POP3Connection> conn);
+ static shared_ptr <POP3Response> readMultilineResponse(shared_ptr <POP3Connection> conn);
/** Receive and parse a large POP3 response (eg. message data)
* from the specified connection.
@@ -101,8 +99,8 @@ public:
* @throws exceptions::operation_timed_out if no data
* has been received within the granted time
*/
- static ref <POP3Response> readLargeResponse
- (ref <POP3Connection> conn, utility::outputStream& os,
+ static shared_ptr <POP3Response> readLargeResponse
+ (shared_ptr <POP3Connection> conn, utility::outputStream& os,
utility::progressListener* progress, const long predictedSize);
@@ -145,7 +143,7 @@ public:
private:
- POP3Response(ref <socket> sok, ref <timeoutHandler> toh);
+ POP3Response(shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh);
void readResponseImpl(string& buffer, const bool multiLine);
void readResponseImpl
@@ -163,8 +161,8 @@ private:
static bool checkOneTerminator(string& buffer, const string& term);
- ref <socket> m_socket;
- ref <timeoutHandler> m_timeoutHandler;
+ shared_ptr <socket> m_socket;
+ shared_ptr <timeoutHandler> m_timeoutHandler;
string m_firstLine;
ResponseCode m_code;
diff --git a/vmime/net/pop3/POP3SStore.hpp b/vmime/net/pop3/POP3SStore.hpp
index 3804d97c..e60b4ef8 100644
--- a/vmime/net/pop3/POP3SStore.hpp
+++ b/vmime/net/pop3/POP3SStore.hpp
@@ -46,7 +46,7 @@ class VMIME_EXPORT POP3SStore : public POP3Store
{
public:
- POP3SStore(ref <session> sess, ref <security::authenticator> auth);
+ POP3SStore(shared_ptr <session> sess, shared_ptr <security::authenticator> auth);
~POP3SStore();
const string getProtocolName() const;
diff --git a/vmime/net/pop3/POP3Store.hpp b/vmime/net/pop3/POP3Store.hpp
index 17dfdbb0..b35659a0 100644
--- a/vmime/net/pop3/POP3Store.hpp
+++ b/vmime/net/pop3/POP3Store.hpp
@@ -59,14 +59,14 @@ class VMIME_EXPORT POP3Store : public store
public:
- POP3Store(ref <session> sess, ref <security::authenticator> auth, const bool secured = false);
+ POP3Store(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false);
~POP3Store();
const string getProtocolName() const;
- ref <folder> getDefaultFolder();
- ref <folder> getRootFolder();
- ref <folder> getFolder(const folder::path& path);
+ shared_ptr <folder> getDefaultFolder();
+ shared_ptr <folder> getRootFolder();
+ shared_ptr <folder> getFolder(const folder::path& path);
bool isValidFolderName(const folder::path::component& name) const;
@@ -82,14 +82,14 @@ public:
int getCapabilities() const;
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
- ref <POP3Connection> getConnection();
+ shared_ptr <connectionInfos> getConnectionInfos() const;
+ shared_ptr <POP3Connection> getConnection();
bool isPOP3S() const;
private:
- ref <POP3Connection> m_connection;
+ shared_ptr <POP3Connection> m_connection;
void registerFolder(POP3Folder* folder);
diff --git a/vmime/net/pop3/POP3Utils.hpp b/vmime/net/pop3/POP3Utils.hpp
index 9d20431c..c7459efe 100644
--- a/vmime/net/pop3/POP3Utils.hpp
+++ b/vmime/net/pop3/POP3Utils.hpp
@@ -64,7 +64,7 @@ public:
* number to its corresponding data (either UID or size)
*/
static void parseMultiListOrUidlResponse
- (ref <POP3Response> response, std::map <int, string>& result);
+ (shared_ptr <POP3Response> response, std::map <int, string>& result);
/** Returns a list of message numbers given a message set.
*
diff --git a/vmime/net/sendmail/sendmailTransport.hpp b/vmime/net/sendmail/sendmailTransport.hpp
index 3ac4fec2..7967ab87 100644
--- a/vmime/net/sendmail/sendmailTransport.hpp
+++ b/vmime/net/sendmail/sendmailTransport.hpp
@@ -50,7 +50,7 @@ class VMIME_EXPORT sendmailTransport : public transport
{
public:
- sendmailTransport(ref <session> sess, ref <security::authenticator> auth);
+ sendmailTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth);
~sendmailTransport();
const string getProtocolName() const;
@@ -73,7 +73,7 @@ public:
const mailbox& sender = mailbox());
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
+ shared_ptr <connectionInfos> getConnectionInfos() const;
private:
diff --git a/vmime/net/service.hpp b/vmime/net/service.hpp
index 57b2c3a0..6969ac20 100644
--- a/vmime/net/service.hpp
+++ b/vmime/net/service.hpp
@@ -59,7 +59,7 @@ class VMIME_EXPORT service : public object
{
protected:
- service(ref <session> sess, const serviceInfos& infos, ref <security::authenticator> auth);
+ service(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth);
public:
@@ -88,13 +88,13 @@ public:
*
* @return session object
*/
- ref <const session> getSession() const;
+ shared_ptr <const session> getSession() const;
/** Return the session object associated with this service instance.
*
* @return session object
*/
- ref <session> getSession();
+ shared_ptr <session> getSession();
/** Return information about this service.
*
@@ -126,31 +126,31 @@ public:
*
* @return authenticator object
*/
- ref <const security::authenticator> getAuthenticator() const;
+ shared_ptr <const security::authenticator> getAuthenticator() const;
/** Return the authenticator object used with this service instance.
*
* @return authenticator object
*/
- ref <security::authenticator> getAuthenticator();
+ shared_ptr <security::authenticator> getAuthenticator();
/** Set the authenticator object used with this service instance.
*
* @param auth authenticator object
*/
- void setAuthenticator(ref <security::authenticator> auth);
+ void setAuthenticator(shared_ptr <security::authenticator> auth);
#if VMIME_HAVE_TLS_SUPPORT
/** Set the object responsible for verifying certificates when
* using secured connections (TLS/SSL).
*/
- void setCertificateVerifier(ref <security::cert::certificateVerifier> cv);
+ void setCertificateVerifier(shared_ptr <security::cert::certificateVerifier> cv);
/** Get the object responsible for verifying certificates when
* using secured connections (TLS/SSL).
*/
- ref <security::cert::certificateVerifier> getCertificateVerifier();
+ shared_ptr <security::cert::certificateVerifier> getCertificateVerifier();
#endif // VMIME_HAVE_TLS_SUPPORT
@@ -159,14 +159,14 @@ public:
*
* @param sf socket factory
*/
- void setSocketFactory(ref <socketFactory> sf);
+ void setSocketFactory(shared_ptr <socketFactory> sf);
/** Return the factory used to create socket objects for this
* service.
*
* @return socket factory
*/
- ref <socketFactory> getSocketFactory();
+ shared_ptr <socketFactory> getSocketFactory();
/** Set the factory used to create timeoutHandler objects for
* this service. By default, no timeout handler is used. Not all
@@ -174,14 +174,14 @@ public:
*
* @param thf timeoutHandler factory
*/
- void setTimeoutHandlerFactory(ref <timeoutHandlerFactory> thf);
+ void setTimeoutHandlerFactory(shared_ptr <timeoutHandlerFactory> thf);
/** Return the factory used to create timeoutHandler objects for
* this service.
*
* @return timeoutHandler factory
*/
- ref <timeoutHandlerFactory> getTimeoutHandlerFactory();
+ shared_ptr <timeoutHandlerFactory> getTimeoutHandlerFactory();
/** Set a property for this service (service prefix is added automatically).
*
@@ -207,20 +207,20 @@ public:
*
* @return information about the connection
*/
- virtual ref <connectionInfos> getConnectionInfos() const = 0;
+ virtual shared_ptr <connectionInfos> getConnectionInfos() const = 0;
private:
- ref <session> m_session;
- ref <security::authenticator> m_auth;
+ shared_ptr <session> m_session;
+ shared_ptr <security::authenticator> m_auth;
#if VMIME_HAVE_TLS_SUPPORT
- ref <security::cert::certificateVerifier> m_certVerifier;
+ shared_ptr <security::cert::certificateVerifier> m_certVerifier;
#endif // VMIME_HAVE_TLS_SUPPORT
- ref <socketFactory> m_socketFactory;
+ shared_ptr <socketFactory> m_socketFactory;
- ref <timeoutHandlerFactory> m_toHandlerFactory;
+ shared_ptr <timeoutHandlerFactory> m_toHandlerFactory;
};
diff --git a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp
index c2df141b..baf692a8 100644
--- a/vmime/net/serviceFactory.hpp
+++ b/vmime/net/serviceFactory.hpp
@@ -67,7 +67,7 @@ private:
public:
- static serviceFactory* getInstance();
+ static shared_ptr <serviceFactory> getInstance();
/** Information about a registered service. */
class registeredService : public object
@@ -80,9 +80,9 @@ public:
public:
- virtual ref <service> create
- (ref <session> sess,
- ref <security::authenticator> auth) const = 0;
+ virtual shared_ptr <service> create
+ (shared_ptr <session> sess,
+ shared_ptr <security::authenticator> auth) const = 0;
virtual int getType() const = 0;
virtual const string& getName() const = 0;
@@ -94,7 +94,7 @@ public:
*
* @param reg service registration infos
*/
- void registerService(ref <registeredService> reg);
+ void registerService(shared_ptr <registeredService> reg);
/** Create a new service instance from a protocol name.
*
@@ -105,10 +105,10 @@ public:
* @throw exceptions::no_service_available if no service is registered
* for this protocol
*/
- ref <service> create
- (ref <session> sess,
+ shared_ptr <service> create
+ (shared_ptr <session> sess,
const string& protocol,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Create a new service instance from a URL.
*
@@ -120,10 +120,10 @@ public:
* @throw exceptions::no_service_available if no service is registered
* for this protocol
*/
- ref <service> create
- (ref <session> sess,
+ shared_ptr <service> create
+ (shared_ptr <session> sess,
const utility::url& u,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Return information about a registered protocol.
*
@@ -132,7 +132,7 @@ public:
* @throw exceptions::no_service_available if no service is registered
* for this protocol
*/
- ref <const registeredService> getServiceByProtocol(const string& protocol) const;
+ shared_ptr <const registeredService> getServiceByProtocol(const string& protocol) const;
/** Return the number of registered services.
*
@@ -145,17 +145,17 @@ public:
* @param pos position of the registered service to return
* @return registered service at the specified position
*/
- ref <const registeredService> getServiceAt(const size_t pos) const;
+ shared_ptr <const registeredService> getServiceAt(const size_t pos) const;
/** Return a list of all registered services.
*
* @return list of registered services
*/
- const std::vector <ref <const registeredService> > getServiceList() const;
+ const std::vector <shared_ptr <const registeredService> > getServiceList() const;
private:
- std::vector <ref <registeredService> > m_services;
+ std::vector <shared_ptr <registeredService> > m_services;
};
diff --git a/vmime/net/serviceInfos.hpp b/vmime/net/serviceInfos.hpp
index efdc8456..6e3209ca 100644
--- a/vmime/net/serviceInfos.hpp
+++ b/vmime/net/serviceInfos.hpp
@@ -217,7 +217,7 @@ public:
* @return value of the property
*/
template <typename TYPE>
- const TYPE getPropertyValue(ref <session> s, const property& p) const
+ const TYPE getPropertyValue(shared_ptr <session> s, const property& p) const
{
if (p.getFlags() & property::FLAG_REQUIRED)
return s->getProperties()[getPropertyPrefix() + p.getName()].template getValue <TYPE>();
@@ -233,7 +233,7 @@ public:
* @param p property to test
* @return true if the property is set, false otherwise
*/
- bool hasProperty(ref <session> s, const property& p) const;
+ bool hasProperty(shared_ptr <session> s, const property& p) const;
};
diff --git a/vmime/net/session.hpp b/vmime/net/session.hpp
index b92c2ac7..59337879 100644
--- a/vmime/net/session.hpp
+++ b/vmime/net/session.hpp
@@ -72,8 +72,8 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new transport service
*/
- ref <transport> getTransport
- (ref <security::authenticator> auth = NULL);
+ shared_ptr <transport> getTransport
+ (shared_ptr <security::authenticator> auth = null);
/** Return a transport service instance for the specified protocol.
*
@@ -83,9 +83,9 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new transport service
*/
- ref <transport> getTransport
+ shared_ptr <transport> getTransport
(const string& protocol,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Return a transport service instance for the specified URL.
*
@@ -95,9 +95,9 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new transport service
*/
- ref <transport> getTransport
+ shared_ptr <transport> getTransport
(const utility::url& url,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Return a transport service instance for the protocol specified
* in the session properties.
@@ -109,7 +109,7 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new store service
*/
- ref <store> getStore(ref <security::authenticator> auth = NULL);
+ shared_ptr <store> getStore(shared_ptr <security::authenticator> auth = null);
/** Return a store service instance for the specified protocol.
*
@@ -119,9 +119,9 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new store service
*/
- ref <store> getStore
+ shared_ptr <store> getStore
(const string& protocol,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Return a store service instance for the specified URL.
*
@@ -131,9 +131,9 @@ public:
* credentials by reading the session properties "auth.username" and "auth.password".
* @return a new store service
*/
- ref <store> getStore
+ shared_ptr <store> getStore
(const utility::url& url,
- ref <security::authenticator> auth = NULL);
+ shared_ptr <security::authenticator> auth = null);
/** Properties for the session and for the services.
*/
@@ -147,19 +147,19 @@ public:
*
* @param tlsProps SSL/TLS properties
*/
- void setTLSProperties(ref <tls::TLSProperties> tlsProps);
+ void setTLSProperties(shared_ptr <tls::TLSProperties> tlsProps);
/** Get properties for SSL/TLS secured connections in this session.
*
* @return SSL/TLS properties
*/
- ref <tls::TLSProperties> getTLSProperties() const;
+ shared_ptr <tls::TLSProperties> getTLSProperties() const;
private:
propertySet m_props;
- ref <tls::TLSProperties> m_tlsProps;
+ shared_ptr <tls::TLSProperties> m_tlsProps;
};
diff --git a/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp b/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp
index a29fbfb4..6ca6c527 100644
--- a/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp
+++ b/vmime/net/smtp/SMTPChunkingOutputStreamAdapter.hpp
@@ -46,11 +46,9 @@ class SMTPConnection;
*/
class VMIME_EXPORT SMTPChunkingOutputStreamAdapter : public utility::outputStream
{
- friend class vmime::creator;
-
public:
- SMTPChunkingOutputStreamAdapter(ref <SMTPConnection> conn);
+ SMTPChunkingOutputStreamAdapter(shared_ptr <SMTPConnection> conn);
void write(const value_type* const data, const size_type count);
void flush();
@@ -65,7 +63,7 @@ private:
void sendChunk(const value_type* const data, const size_type count, const bool last);
- ref <SMTPConnection> m_connection;
+ shared_ptr <SMTPConnection> m_connection;
value_type m_buffer[262144]; // 256 KB
size_type m_bufferSize;
diff --git a/vmime/net/smtp/SMTPCommand.hpp b/vmime/net/smtp/SMTPCommand.hpp
index c4001f85..4005dcdf 100644
--- a/vmime/net/smtp/SMTPCommand.hpp
+++ b/vmime/net/smtp/SMTPCommand.hpp
@@ -55,35 +55,33 @@ namespace smtp {
*/
class VMIME_EXPORT SMTPCommand : public object
{
- friend class vmime::creator;
-
public:
- static ref <SMTPCommand> HELO(const string& hostname);
- static ref <SMTPCommand> EHLO(const string& hostname);
- static ref <SMTPCommand> AUTH(const string& mechName);
- static ref <SMTPCommand> STARTTLS();
- static ref <SMTPCommand> MAIL(const mailbox& mbox, const bool utf8);
- static ref <SMTPCommand> MAIL(const mailbox& mbox, const bool utf8, const unsigned long size);
- static ref <SMTPCommand> RCPT(const mailbox& mbox, const bool utf8);
- static ref <SMTPCommand> RSET();
- static ref <SMTPCommand> DATA();
- static ref <SMTPCommand> BDAT(const unsigned long chunkSize, const bool last);
- static ref <SMTPCommand> NOOP();
- static ref <SMTPCommand> QUIT();
+ static shared_ptr <SMTPCommand> HELO(const string& hostname);
+ static shared_ptr <SMTPCommand> EHLO(const string& hostname);
+ static shared_ptr <SMTPCommand> AUTH(const string& mechName);
+ static shared_ptr <SMTPCommand> STARTTLS();
+ static shared_ptr <SMTPCommand> MAIL(const mailbox& mbox, const bool utf8);
+ static shared_ptr <SMTPCommand> MAIL(const mailbox& mbox, const bool utf8, const unsigned long size);
+ static shared_ptr <SMTPCommand> RCPT(const mailbox& mbox, const bool utf8);
+ static shared_ptr <SMTPCommand> RSET();
+ static shared_ptr <SMTPCommand> DATA();
+ static shared_ptr <SMTPCommand> BDAT(const unsigned long chunkSize, const bool last);
+ static shared_ptr <SMTPCommand> NOOP();
+ static shared_ptr <SMTPCommand> QUIT();
/** Creates a new SMTP command with the specified text.
*
* @param text command text
* @return a new SMTPCommand object
*/
- static ref <SMTPCommand> createCommand(const string& text);
+ static shared_ptr <SMTPCommand> createCommand(const string& text);
/** Sends this command to the specified socket.
*
* @param sok socket to which the command will be written
*/
- virtual void writeToSocket(ref <socket> sok);
+ virtual void writeToSocket(shared_ptr <socket> sok);
/** Returns the full text of the command, including command name
* and parameters (if any).
diff --git a/vmime/net/smtp/SMTPCommandSet.hpp b/vmime/net/smtp/SMTPCommandSet.hpp
index e6c5be94..8e744c2b 100644
--- a/vmime/net/smtp/SMTPCommandSet.hpp
+++ b/vmime/net/smtp/SMTPCommandSet.hpp
@@ -46,8 +46,6 @@ namespace smtp {
*/
class VMIME_EXPORT SMTPCommandSet : public SMTPCommand
{
- friend class vmime::creator;
-
public:
/** Creates a new set of SMTP commands.
@@ -55,7 +53,7 @@ public:
* @param pipeline set to true if the server supports pipelining
* @return a new SMTPCommandSet object
*/
- static ref <SMTPCommandSet> create(const bool pipeline);
+ static shared_ptr <SMTPCommandSet> create(const bool pipeline);
/** Adds a new command to this set.
* If one or more comments have already been sent to the server,
@@ -63,7 +61,7 @@ public:
*
* @param cmd command to add
*/
- void addCommand(ref <SMTPCommand> cmd);
+ void addCommand(shared_ptr <SMTPCommand> cmd);
/** Tests whether all commands have been sent.
*
@@ -77,10 +75,10 @@ public:
* @return a pointer to a SMTPCommand, of NULL if no command
* has been sent yet
*/
- ref <SMTPCommand> getLastCommandSent() const;
+ shared_ptr <SMTPCommand> getLastCommandSent() const;
- void writeToSocket(ref <socket> sok);
+ void writeToSocket(shared_ptr <socket> sok);
const string getText() const;
@@ -92,8 +90,8 @@ private:
bool m_pipeline;
bool m_started;
- std::list <ref <SMTPCommand> > m_commands;
- ref <SMTPCommand> m_lastCommandSent;
+ std::list <shared_ptr <SMTPCommand> > m_commands;
+ shared_ptr <SMTPCommand> m_lastCommandSent;
};
diff --git a/vmime/net/smtp/SMTPConnection.hpp b/vmime/net/smtp/SMTPConnection.hpp
index 96469ab1..cc59ef34 100644
--- a/vmime/net/smtp/SMTPConnection.hpp
+++ b/vmime/net/smtp/SMTPConnection.hpp
@@ -62,11 +62,9 @@ class SMTPTransport;
*/
class VMIME_EXPORT SMTPConnection : public object
{
- friend class vmime::creator;
-
public:
- SMTPConnection(ref <SMTPTransport> transport, ref <security::authenticator> auth);
+ SMTPConnection(shared_ptr <SMTPTransport> transport, shared_ptr <security::authenticator> auth);
virtual ~SMTPConnection();
@@ -75,16 +73,16 @@ public:
virtual void disconnect();
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
+ shared_ptr <connectionInfos> getConnectionInfos() const;
- virtual ref <SMTPTransport> getTransport();
- virtual ref <socket> getSocket();
- virtual ref <timeoutHandler> getTimeoutHandler();
- virtual ref <security::authenticator> getAuthenticator();
- virtual ref <session> getSession();
+ virtual shared_ptr <SMTPTransport> getTransport();
+ virtual shared_ptr <socket> getSocket();
+ virtual shared_ptr <timeoutHandler> getTimeoutHandler();
+ virtual shared_ptr <security::authenticator> getAuthenticator();
+ virtual shared_ptr <session> getSession();
- void sendRequest(ref <SMTPCommand> cmd);
- ref <SMTPResponse> readResponse();
+ void sendRequest(shared_ptr <SMTPCommand> cmd);
+ shared_ptr <SMTPResponse> readResponse();
bool hasExtension(const std::string& extName, std::vector <string>* params = NULL) const;
@@ -103,18 +101,18 @@ private:
#endif // VMIME_HAVE_TLS_SUPPORT
- weak_ref <SMTPTransport> m_transport;
+ weak_ptr <SMTPTransport> m_transport;
- ref <security::authenticator> m_auth;
- ref <socket> m_socket;
- ref <timeoutHandler> m_timeoutHandler;
+ shared_ptr <security::authenticator> m_auth;
+ shared_ptr <socket> m_socket;
+ shared_ptr <timeoutHandler> m_timeoutHandler;
SMTPResponse::state m_responseState;
bool m_authenticated;
bool m_secured;
- ref <connectionInfos> m_cntInfos;
+ shared_ptr <connectionInfos> m_cntInfos;
bool m_extendedSMTP;
std::map <string, std::vector <string> > m_extensions;
diff --git a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp
index e0a5e1cd..000448ac 100644
--- a/vmime/net/smtp/SMTPResponse.hpp
+++ b/vmime/net/smtp/SMTPResponse.hpp
@@ -50,8 +50,6 @@ namespace smtp {
*/
class VMIME_EXPORT SMTPResponse : public object
{
- friend class vmime::creator;
-
public:
/** Current state of response parser. */
@@ -104,7 +102,7 @@ public:
* @throws exceptions::operation_timed_out if no data
* has been received within the granted time
*/
- static ref <SMTPResponse> readResponse(ref <socket> sok, ref <timeoutHandler> toh, const state& st);
+ static shared_ptr <SMTPResponse> readResponse(shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh, const state& st);
/** Return the SMTP response code.
*
@@ -152,7 +150,7 @@ public:
private:
- SMTPResponse(ref <socket> sok, ref <timeoutHandler> toh, const state& st);
+ SMTPResponse(shared_ptr <socket> sok, shared_ptr <timeoutHandler> toh, const state& st);
SMTPResponse(const SMTPResponse&);
void readResponse();
@@ -166,8 +164,8 @@ private:
std::vector <responseLine> m_lines;
- ref <socket> m_socket;
- ref <timeoutHandler> m_timeoutHandler;
+ shared_ptr <socket> m_socket;
+ shared_ptr <timeoutHandler> m_timeoutHandler;
string m_responseBuffer;
bool m_responseContinues;
diff --git a/vmime/net/smtp/SMTPSTransport.hpp b/vmime/net/smtp/SMTPSTransport.hpp
index cbc6a168..7782f711 100644
--- a/vmime/net/smtp/SMTPSTransport.hpp
+++ b/vmime/net/smtp/SMTPSTransport.hpp
@@ -46,7 +46,7 @@ class VMIME_EXPORT SMTPSTransport : public SMTPTransport
{
public:
- SMTPSTransport(ref <session> sess, ref <security::authenticator> auth);
+ SMTPSTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth);
~SMTPSTransport();
const string getProtocolName() const;
diff --git a/vmime/net/smtp/SMTPTransport.hpp b/vmime/net/smtp/SMTPTransport.hpp
index 962f4406..90ad447c 100644
--- a/vmime/net/smtp/SMTPTransport.hpp
+++ b/vmime/net/smtp/SMTPTransport.hpp
@@ -54,7 +54,7 @@ class VMIME_EXPORT SMTPTransport : public transport
{
public:
- SMTPTransport(ref <session> sess, ref <security::authenticator> auth, const bool secured = false);
+ SMTPTransport(shared_ptr <session> sess, shared_ptr <security::authenticator> auth, const bool secured = false);
~SMTPTransport();
const string getProtocolName() const;
@@ -77,15 +77,15 @@ public:
const mailbox& sender = mailbox());
void send
- (ref <vmime::message> msg,
+ (shared_ptr <vmime::message> msg,
const mailbox& expeditor,
const mailboxList& recipients,
utility::progressListener* progress = NULL,
const mailbox& sender = mailbox());
bool isSecuredConnection() const;
- ref <connectionInfos> getConnectionInfos() const;
- ref <SMTPConnection> getConnection();
+ shared_ptr <connectionInfos> getConnectionInfos() const;
+ shared_ptr <SMTPConnection> getConnection();
bool isSMTPS() const;
@@ -109,7 +109,7 @@ private:
const utility::stream::size_type size);
- ref <SMTPConnection> m_connection;
+ shared_ptr <SMTPConnection> m_connection;
const bool m_isSMTPS;
diff --git a/vmime/net/socket.hpp b/vmime/net/socket.hpp
index 5662da23..3dadc72b 100644
--- a/vmime/net/socket.hpp
+++ b/vmime/net/socket.hpp
@@ -162,14 +162,14 @@ public:
*
* @return a new socket
*/
- virtual ref <socket> create() = 0;
+ virtual shared_ptr <socket> create() = 0;
/** Creates a socket with the specified timeout handler.
*
* @param th timeout handler
* @return a new socket
*/
- virtual ref <socket> create(ref <timeoutHandler> th) = 0;
+ virtual shared_ptr <socket> create(shared_ptr <timeoutHandler> th) = 0;
};
diff --git a/vmime/net/store.hpp b/vmime/net/store.hpp
index 92a43feb..37dcadbc 100644
--- a/vmime/net/store.hpp
+++ b/vmime/net/store.hpp
@@ -47,7 +47,7 @@ class VMIME_EXPORT store : public service
{
protected:
- store(ref <session> sess, const serviceInfos& infos, ref <security::authenticator> auth)
+ store(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth)
: service(sess, infos, auth) { }
public:
@@ -57,21 +57,21 @@ public:
*
* @return default folder
*/
- virtual ref <folder> getDefaultFolder() = 0;
+ virtual shared_ptr <folder> getDefaultFolder() = 0;
/** Return the root folder. This is protocol dependent
* and usually is the user's mail drop root folder.
*
* @return root folder
*/
- virtual ref <folder> getRootFolder() = 0;
+ virtual shared_ptr <folder> getRootFolder() = 0;
/** Return the folder specified by the path.
*
* @param path absolute folder path
* @return folder at the specified path
*/
- virtual ref <folder> getFolder(const folder::path& path) = 0;
+ virtual shared_ptr <folder> getFolder(const folder::path& path) = 0;
/** Test whether the specified folder name is a syntactically
* a valid name.
diff --git a/vmime/net/timeoutHandler.hpp b/vmime/net/timeoutHandler.hpp
index f49ece0c..24129701 100644
--- a/vmime/net/timeoutHandler.hpp
+++ b/vmime/net/timeoutHandler.hpp
@@ -76,7 +76,7 @@ public:
virtual ~timeoutHandlerFactory() { }
- virtual ref <timeoutHandler> create() = 0;
+ virtual shared_ptr <timeoutHandler> create() = 0;
};
diff --git a/vmime/net/tls/TLSProperties.hpp b/vmime/net/tls/TLSProperties.hpp
index 23540eeb..0dbc8f05 100644
--- a/vmime/net/tls/TLSProperties.hpp
+++ b/vmime/net/tls/TLSProperties.hpp
@@ -91,7 +91,7 @@ public:
private:
- ref <object> m_data;
+ shared_ptr <object> m_data;
};
diff --git a/vmime/net/tls/TLSSecuredConnectionInfos.hpp b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
index be0fb41a..e552d6f9 100644
--- a/vmime/net/tls/TLSSecuredConnectionInfos.hpp
+++ b/vmime/net/tls/TLSSecuredConnectionInfos.hpp
@@ -52,7 +52,7 @@ class VMIME_EXPORT TLSSecuredConnectionInfos : public securedConnectionInfos
public:
TLSSecuredConnectionInfos(const string& host, const port_t port,
- ref <TLSSession> tlsSession, ref <TLSSocket> tlsSocket);
+ shared_ptr <TLSSession> tlsSession, shared_ptr <TLSSocket> tlsSocket);
const string getHost() const;
port_t getPort() const;
@@ -61,15 +61,15 @@ public:
*
* @return server certificate chain
*/
- ref <const security::cert::certificateChain> getPeerCertificates() const;
+ shared_ptr <const security::cert::certificateChain> getPeerCertificates() const;
private:
string m_host;
port_t m_port;
- ref <TLSSession> m_tlsSession;
- ref <TLSSocket> m_tlsSocket;
+ shared_ptr <TLSSession> m_tlsSession;
+ shared_ptr <TLSSocket> m_tlsSocket;
};
diff --git a/vmime/net/tls/TLSSession.hpp b/vmime/net/tls/TLSSession.hpp
index faca9d11..9e061f89 100644
--- a/vmime/net/tls/TLSSession.hpp
+++ b/vmime/net/tls/TLSSession.hpp
@@ -57,7 +57,7 @@ public:
* @param props TLS properties for this session
* @return a new TLS session
*/
- static ref <TLSSession> create(ref <security::cert::certificateVerifier> cv, ref <TLSProperties> props);
+ static shared_ptr <TLSSession> create(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props);
/** Create a new socket that adds a TLS security layer around
* an existing socket. You should create only one socket
@@ -66,12 +66,12 @@ public:
* @param sok socket to wrap
* @return TLS socket wrapper
*/
- virtual ref <TLSSocket> getSocket(ref <socket> sok) = 0;
+ virtual shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok) = 0;
/** Get the object responsible for verifying certificates when
* using secured connections (TLS/SSL).
*/
- virtual ref <security::cert::certificateVerifier> getCertificateVerifier() = 0;
+ virtual shared_ptr <security::cert::certificateVerifier> getCertificateVerifier() = 0;
protected:
diff --git a/vmime/net/tls/TLSSocket.hpp b/vmime/net/tls/TLSSocket.hpp
index 68ed1963..e2668ad4 100644
--- a/vmime/net/tls/TLSSocket.hpp
+++ b/vmime/net/tls/TLSSocket.hpp
@@ -59,7 +59,7 @@ public:
* @param session TLS session
* @param sok socket to wrap
*/
- static ref <TLSSocket> wrap(ref <TLSSession> session, ref <socket> sok);
+ static shared_ptr <TLSSocket> wrap(shared_ptr <TLSSession> session, shared_ptr <socket> sok);
/** Starts a TLS handshake on this connection.
*
@@ -67,14 +67,14 @@ public:
* during the negociation process, exceptions::operation_timed_out
* if a time-out occurs
*/
- virtual void handshake(ref <timeoutHandler> toHandler = NULL) = 0;
+ virtual void handshake(shared_ptr <timeoutHandler> toHandler = null) = 0;
/** Return the peer's certificate (chain) as sent by the peer.
*
* @return server certificate chain, or NULL if the handshake
* has not been performed yet
*/
- virtual ref <security::cert::certificateChain> getPeerCertificates() const = 0;
+ virtual shared_ptr <security::cert::certificateChain> getPeerCertificates() const = 0;
};
diff --git a/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp b/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp
index 45fee070..7f762b58 100644
--- a/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp
+++ b/vmime/net/tls/gnutls/TLSSession_GnuTLS.hpp
@@ -52,13 +52,13 @@ class TLSSession_GnuTLS : public TLSSession
public:
- TLSSession_GnuTLS(ref <security::cert::certificateVerifier> cv, ref <TLSProperties> props);
+ TLSSession_GnuTLS(shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props);
~TLSSession_GnuTLS();
- ref <TLSSocket> getSocket(ref <socket> sok);
+ shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok);
- ref <security::cert::certificateVerifier> getCertificateVerifier();
+ shared_ptr <security::cert::certificateVerifier> getCertificateVerifier();
private:
@@ -73,8 +73,8 @@ private:
void* m_gnutlsSession;
#endif // LIBGNUTLS_VERSION
- ref <security::cert::certificateVerifier> m_certVerifier;
- ref <TLSProperties> m_props;
+ shared_ptr <security::cert::certificateVerifier> m_certVerifier;
+ shared_ptr <TLSProperties> m_props;
};
diff --git a/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp b/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp
index 4cce9832..43848ec9 100644
--- a/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp
+++ b/vmime/net/tls/gnutls/TLSSocket_GnuTLS.hpp
@@ -48,17 +48,15 @@ class TLSSession_GnuTLS;
class TLSSocket_GnuTLS : public TLSSocket
{
- friend class vmime::creator;
-
public:
- TLSSocket_GnuTLS(ref <TLSSession_GnuTLS> session, ref <socket> sok);
+ TLSSocket_GnuTLS(shared_ptr <TLSSession_GnuTLS> session, shared_ptr <socket> sok);
~TLSSocket_GnuTLS();
- void handshake(ref <timeoutHandler> toHandler = NULL);
+ void handshake(shared_ptr <timeoutHandler> toHandler = null);
- ref <security::cert::certificateChain> getPeerCertificates() const;
+ shared_ptr <security::cert::certificateChain> getPeerCertificates() const;
// Implementation of 'socket'
void connect(const string& address, const port_t port);
@@ -92,15 +90,15 @@ private:
#endif // LIBGNUTLS_VERSION
- ref <TLSSession_GnuTLS> m_session;
- ref <socket> m_wrapped;
+ shared_ptr <TLSSession_GnuTLS> m_session;
+ shared_ptr <socket> m_wrapped;
bool m_connected;
char m_buffer[65536];
bool m_handshaking;
- ref <timeoutHandler> m_toHandler;
+ shared_ptr <timeoutHandler> m_toHandler;
exception* m_ex;
diff --git a/vmime/net/tls/openssl/OpenSSLInitializer.hpp b/vmime/net/tls/openssl/OpenSSLInitializer.hpp
index 5277d4ff..d7595aa8 100644
--- a/vmime/net/tls/openssl/OpenSSLInitializer.hpp
+++ b/vmime/net/tls/openssl/OpenSSLInitializer.hpp
@@ -80,7 +80,7 @@ protected:
static void uninitialize();
- static ref <vmime::utility::sync::criticalSection> getMutex();
+ static shared_ptr <vmime::utility::sync::criticalSection> getMutex();
enum
{
@@ -94,7 +94,7 @@ protected:
private:
- static ref <vmime::utility::sync::criticalSection >* sm_mutexes;
+ static shared_ptr <vmime::utility::sync::criticalSection >* sm_mutexes;
};
diff --git a/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp b/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp
index 85f018f1..5a2b60a8 100644
--- a/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp
+++ b/vmime/net/tls/openssl/TLSSession_OpenSSL.hpp
@@ -55,13 +55,13 @@ class TLSSession_OpenSSL : public TLSSession
public:
- TLSSession_OpenSSL(const ref <security::cert::certificateVerifier> cv, ref <TLSProperties> props);
+ TLSSession_OpenSSL(const shared_ptr <security::cert::certificateVerifier> cv, shared_ptr <TLSProperties> props);
~TLSSession_OpenSSL();
- ref <TLSSocket> getSocket(ref <socket> sok);
+ shared_ptr <TLSSocket> getSocket(shared_ptr <socket> sok);
- ref <security::cert::certificateVerifier> getCertificateVerifier();
+ shared_ptr <security::cert::certificateVerifier> getCertificateVerifier();
/** Set the private key to use if server requires a client certificate.
@@ -90,8 +90,8 @@ private:
SSL_CTX* m_sslctx;
- ref <security::cert::certificateVerifier> m_certVerifier;
- ref <TLSProperties> m_props;
+ shared_ptr <security::cert::certificateVerifier> m_certVerifier;
+ shared_ptr <TLSProperties> m_props;
};
diff --git a/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp b/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp
index 5bf27804..b4ff5872 100644
--- a/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp
+++ b/vmime/net/tls/openssl/TLSSocket_OpenSSL.hpp
@@ -52,17 +52,15 @@ class TLSSession_OpenSSL;
class TLSSocket_OpenSSL : public TLSSocket
{
- friend class vmime::creator;
-
public:
- TLSSocket_OpenSSL(ref <TLSSession_OpenSSL> session, ref <socket> sok);
+ TLSSocket_OpenSSL(shared_ptr <TLSSession_OpenSSL> session, shared_ptr <socket> sok);
~TLSSocket_OpenSSL();
- void handshake(ref <timeoutHandler> toHandler = NULL);
+ void handshake(shared_ptr <timeoutHandler> toHandler = null);
- ref <security::cert::certificateChain> getPeerCertificates() const;
+ shared_ptr <security::cert::certificateChain> getPeerCertificates() const;
// Implementation of 'socket'
void connect(const string& address, const port_t port);
@@ -101,15 +99,15 @@ private:
void handleError(int rc);
- ref <TLSSession_OpenSSL> m_session;
+ shared_ptr <TLSSession_OpenSSL> m_session;
- ref <socket> m_wrapped;
+ shared_ptr <socket> m_wrapped;
bool m_connected;
char m_buffer[65536];
- ref <timeoutHandler> m_toHandler;
+ shared_ptr <timeoutHandler> m_toHandler;
SSL* m_ssl;
diff --git a/vmime/net/transport.hpp b/vmime/net/transport.hpp
index 3acb2266..96e37669 100644
--- a/vmime/net/transport.hpp
+++ b/vmime/net/transport.hpp
@@ -56,7 +56,7 @@ class VMIME_EXPORT transport : public service
{
protected:
- transport(ref <session> sess, const serviceInfos& infos, ref <security::authenticator> auth);
+ transport(shared_ptr <session> sess, const serviceInfos& infos, shared_ptr <security::authenticator> auth);
public:
@@ -67,7 +67,7 @@ public:
* @param msg message to send
* @param progress progress listener, or NULL if not used
*/
- virtual void send(ref <vmime::message> msg, utility::progressListener* progress = NULL);
+ virtual void send(shared_ptr <vmime::message> msg, utility::progressListener* progress = NULL);
/** Send a message over this transport service.
*
@@ -97,7 +97,7 @@ public:
* @param sender envelope sender (if empty, expeditor will be used)
*/
virtual void send
- (ref <vmime::message> msg,
+ (shared_ptr <vmime::message> msg,
const mailbox& expeditor,
const mailboxList& recipients,
utility::progressListener* progress = NULL,
@@ -115,7 +115,7 @@ protected:
* if the field is to be replaced, or a reference to the same headerField
* that was passed if the field should be left as is
*/
- ref <headerField> processHeaderField(ref <headerField> field);
+ shared_ptr <headerField> processHeaderField(shared_ptr <headerField> field);
/** Prepares the header before transmitting the message.
* Removes headers that should not be present (eg. "Bcc", "Return-Path"),
@@ -124,7 +124,7 @@ protected:
*
* @param header headers to process
*/
- void processHeader(ref <header> header);
+ void processHeader(shared_ptr <header> header);
};
diff --git a/vmime/object.hpp b/vmime/object.hpp
index 192ab050..0b12df3c 100644
--- a/vmime/object.hpp
+++ b/vmime/object.hpp
@@ -28,24 +28,15 @@
#include "vmime/types.hpp"
-#include <vector>
-
-
namespace vmime
{
-/** Base object for all objects in the library. This implements
- * reference counting and auto-deletion.
+/** Base object for all objects in the library.
*/
-class VMIME_EXPORT object
+class VMIME_EXPORT object : public enable_shared_from_this <object>
{
- template <class T> friend class utility::ref;
- template <class T> friend class utility::weak_ref;
-
- friend class utility::refManager;
-
protected:
object();
@@ -54,42 +45,6 @@ protected:
object& operator=(const object&);
virtual ~object();
-
-#ifndef VMIME_BUILDING_DOC
-
- /** Return a reference to this object.
- *
- * @return reference to self
- */
- ref <object> thisRef();
-
- /** Return a reference to this object (const version).
- *
- * @return reference to self
- */
- ref <const object> thisRef() const;
-
- /** Return a weak reference to this object.
- *
- * @return weak reference to self
- */
- weak_ref <object> thisWeakRef();
-
- /** Return a weak reference to this object (const version).
- *
- * @return weak reference to self
- */
- weak_ref <const object> thisWeakRef() const;
-
-
- void setRefManager(utility::refManager* mgr);
- utility::refManager* getRefManager() const;
-
-#endif // VMIME_BUILDING_DOC
-
-private:
-
- mutable utility::refManager* m_refMgr;
};
diff --git a/vmime/parameter.hpp b/vmime/parameter.hpp
index a3d0f0f8..d872b312 100644
--- a/vmime/parameter.hpp
+++ b/vmime/parameter.hpp
@@ -63,11 +63,11 @@ public:
#endif // VMIME_BUILDING_DOC
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
parameter& operator=(const parameter& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Return the name of this parameter.
*
@@ -91,7 +91,7 @@ public:
* is equivalent to:
*
* <pre>
- * ref <vmime::word> rawValue = getParameter("creation-date");
+ * shared_ptr <vmime::word> rawValue = getParameter("creation-date");
*
* vmime::dateTime theDate;
* theDate.parse(rawValue->getBuffer());
@@ -143,7 +143,7 @@ private:
string m_name;
- ref <word> m_value;
+ shared_ptr <word> m_value;
};
diff --git a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp
index 1a80073e..efe9c81e 100644
--- a/vmime/parameterizedHeaderField.hpp
+++ b/vmime/parameterizedHeaderField.hpp
@@ -41,7 +41,7 @@ namespace vmime
class VMIME_EXPORT parameterizedHeaderField : virtual public headerField
{
- friend class vmime::creator; // create ref
+ friend class headerFieldFactory;
protected:
@@ -69,7 +69,7 @@ public:
* @throw exceptions::no_such_parameter if no parameter with this name exists
* @return first parameter with the specified name
*/
- ref <parameter> findParameter(const string& paramName) const;
+ shared_ptr <parameter> findParameter(const string& paramName) const;
/** Find the first parameter that matches the specified name.
* If no parameter is found, one will be created and inserted into
@@ -78,13 +78,13 @@ public:
* @return first parameter with the specified name or a new field
* if no parameter is found
*/
- ref <parameter> getParameter(const string& paramName);
+ shared_ptr <parameter> getParameter(const string& paramName);
/** Add a parameter at the end of the list.
*
* @param param parameter to append
*/
- void appendParameter(ref <parameter> param);
+ void appendParameter(shared_ptr <parameter> param);
/** Insert a new parameter before the specified parameter.
*
@@ -92,7 +92,7 @@ public:
* @param param parameter to insert
* @throw exceptions::no_such_parameter if the parameter is not in the list
*/
- void insertParameterBefore(ref <parameter> beforeParam, ref <parameter> param);
+ void insertParameterBefore(shared_ptr <parameter> beforeParam, shared_ptr <parameter> param);
/** Insert a new parameter before the specified position.
*
@@ -100,7 +100,7 @@ public:
* the beginning of the list)
* @param param parameter to insert
*/
- void insertParameterBefore(const size_t pos, ref <parameter> param);
+ void insertParameterBefore(const size_t pos, shared_ptr <parameter> param);
/** Insert a new parameter after the specified parameter.
*
@@ -108,21 +108,21 @@ public:
* @param param parameter to insert
* @throw exceptions::no_such_parameter if the parameter is not in the list
*/
- void insertParameterAfter(ref <parameter> afterParam, ref <parameter> param);
+ void insertParameterAfter(shared_ptr <parameter> afterParam, shared_ptr <parameter> param);
/** Insert a new parameter after the specified position.
*
* @param pos position of the parameter before the new parameter
* @param param parameter to insert
*/
- void insertParameterAfter(const size_t pos, ref <parameter> param);
+ void insertParameterAfter(const size_t pos, shared_ptr <parameter> param);
/** Remove the specified parameter from the list.
*
* @param param parameter to remove
* @throw exceptions::no_such_parameter if the parameter is not in the list
*/
- void removeParameter(ref <parameter> param);
+ void removeParameter(shared_ptr <parameter> param);
/** Remove the parameter at the specified position.
*
@@ -151,32 +151,32 @@ public:
* @param pos position
* @return parameter at position 'pos'
*/
- const ref <parameter> getParameterAt(const size_t pos);
+ const shared_ptr <parameter> getParameterAt(const size_t pos);
/** Return the parameter at the specified position.
*
* @param pos position
* @return parameter at position 'pos'
*/
- const ref <const parameter> getParameterAt(const size_t pos) const;
+ const shared_ptr <const parameter> getParameterAt(const size_t pos) const;
/** Return the parameter list.
*
* @return list of parameters
*/
- const std::vector <ref <const parameter> > getParameterList() const;
+ const std::vector <shared_ptr <const parameter> > getParameterList() const;
/** Return the parameter list.
*
* @return list of parameters
*/
- const std::vector <ref <parameter> > getParameterList();
+ const std::vector <shared_ptr <parameter> > getParameterList();
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
private:
- std::vector <ref <parameter> > m_params;
+ std::vector <shared_ptr <parameter> > m_params;
protected:
diff --git a/vmime/parsedMessageAttachment.hpp b/vmime/parsedMessageAttachment.hpp
index d37c84a6..6c96f80a 100644
--- a/vmime/parsedMessageAttachment.hpp
+++ b/vmime/parsedMessageAttachment.hpp
@@ -41,30 +41,30 @@ class VMIME_EXPORT parsedMessageAttachment : public messageAttachment
{
public:
- parsedMessageAttachment(ref <message> msg);
+ parsedMessageAttachment(shared_ptr <message> msg);
const mediaType getType() const;
const text getDescription() const;
const word getName() const;
- const ref <const contentHandler> getData() const;
+ const shared_ptr <const contentHandler> getData() const;
const encoding getEncoding() const;
- ref <const object> getPart() const;
+ shared_ptr <const object> getPart() const;
- ref <const header> getHeader() const;
+ shared_ptr <const header> getHeader() const;
- ref <message> getMessage() const;
+ shared_ptr <message> getMessage() const;
protected:
- void generateIn(ref <bodyPart> parent) const;
+ void generateIn(shared_ptr <bodyPart> parent) const;
private:
- ref <message> m_msg;
- mutable ref <contentHandler> m_data;
+ shared_ptr <message> m_msg;
+ mutable shared_ptr <contentHandler> m_data;
};
diff --git a/vmime/path.hpp b/vmime/path.hpp
index cb6e4ed4..87409413 100644
--- a/vmime/path.hpp
+++ b/vmime/path.hpp
@@ -73,10 +73,10 @@ public:
// Assignment
void copyFrom(const component& other);
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
path& operator=(const path& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
protected:
diff --git a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp
index a68b5306..72a8a71c 100644
--- a/vmime/plainTextPart.hpp
+++ b/vmime/plainTextPart.hpp
@@ -47,17 +47,17 @@ public:
const charset& getCharset() const;
void setCharset(const charset& ch);
- const ref <const contentHandler> getText() const;
- void setText(ref <contentHandler> text);
+ const shared_ptr <const contentHandler> getText() const;
+ void setText(shared_ptr <contentHandler> text);
size_t getPartCount() const;
- void generateIn(ref <bodyPart> message, ref <bodyPart> parent) const;
- void parse(ref <const bodyPart> message, ref <const bodyPart> parent, ref <const bodyPart> textPart);
+ void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const;
+ void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart);
private:
- ref <contentHandler> m_text;
+ shared_ptr <contentHandler> m_text;
charset m_charset;
};
diff --git a/vmime/platform.hpp b/vmime/platform.hpp
index f10e5c9c..c72f160e 100644
--- a/vmime/platform.hpp
+++ b/vmime/platform.hpp
@@ -117,7 +117,7 @@ public:
*
* @return socket factory
*/
- virtual ref <net::socketFactory> getSocketFactory() = 0;
+ virtual shared_ptr <net::socketFactory> getSocketFactory() = 0;
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
@@ -125,14 +125,14 @@ public:
*
* @return file-system factory
*/
- virtual ref <utility::fileSystemFactory> getFileSystemFactory() = 0;
+ virtual shared_ptr <utility::fileSystemFactory> getFileSystemFactory() = 0;
/** Return a pointer to a factory that creates child process objects,
* which are used to spawn processes (run executable files).
*
* @return child process factory
*/
- virtual ref <utility::childProcessFactory> getChildProcessFactory() = 0;
+ virtual shared_ptr <utility::childProcessFactory> getChildProcessFactory() = 0;
#endif
/** Fills a buffer with cryptographically random bytes.
@@ -144,22 +144,22 @@ public:
/** Creates and initializes a critical section.
*/
- virtual ref <utility::sync::criticalSection> createCriticalSection() = 0;
+ virtual shared_ptr <utility::sync::criticalSection> createCriticalSection() = 0;
};
template <class TYPE>
static void setHandler()
{
- sm_handler = vmime::create <TYPE>();
+ sm_handler = vmime::make_shared <TYPE>();
}
- static ref <handler> getDefaultHandler();
- static ref <handler> getHandler();
+ static shared_ptr <handler> getDefaultHandler();
+ static shared_ptr <handler> getHandler();
private:
- static ref <handler> sm_handler;
+ static shared_ptr <handler> sm_handler;
};
diff --git a/vmime/platforms/posix/posixChildProcess.hpp b/vmime/platforms/posix/posixChildProcess.hpp
index 9e60ef19..5b9fa021 100644
--- a/vmime/platforms/posix/posixChildProcess.hpp
+++ b/vmime/platforms/posix/posixChildProcess.hpp
@@ -51,8 +51,8 @@ public:
void start(const std::vector <string> args, const int flags = 0);
- ref <utility::outputStream> getStdIn();
- ref <utility::inputStream> getStdOut();
+ shared_ptr <utility::outputStream> getStdIn();
+ shared_ptr <utility::inputStream> getStdOut();
void waitForFinish();
@@ -61,8 +61,8 @@ private:
utility::file::path m_processPath;
bool m_started;
- ref <utility::outputStream> m_stdIn;
- ref <utility::inputStream> m_stdOut;
+ shared_ptr <utility::outputStream> m_stdIn;
+ shared_ptr <utility::inputStream> m_stdOut;
sigset_t m_oldProcMask;
pid_t m_pid;
@@ -77,7 +77,7 @@ class posixChildProcessFactory : public utility::childProcessFactory
{
public:
- ref <utility::childProcess> create(const utility::file::path& path) const;
+ shared_ptr <utility::childProcess> create(const utility::file::path& path) const;
};
diff --git a/vmime/platforms/posix/posixFile.hpp b/vmime/platforms/posix/posixFile.hpp
index c19f1674..a1353841 100644
--- a/vmime/platforms/posix/posixFile.hpp
+++ b/vmime/platforms/posix/posixFile.hpp
@@ -95,7 +95,7 @@ public:
posixFileWriter(const vmime::utility::file::path& path, const vmime::string& nativePath);
- ref <vmime::utility::outputStream> getOutputStream();
+ shared_ptr <vmime::utility::outputStream> getOutputStream();
private:
@@ -111,7 +111,7 @@ public:
posixFileReader(const vmime::utility::file::path& path, const vmime::string& nativePath);
- ref <vmime::utility::inputStream> getInputStream();
+ shared_ptr <vmime::utility::inputStream> getInputStream();
private:
@@ -129,7 +129,7 @@ public:
~posixFileIterator();
bool hasMoreElements() const;
- ref <vmime::utility::file> nextElement();
+ shared_ptr <vmime::utility::file> nextElement();
private:
@@ -165,16 +165,16 @@ public:
bool exists() const;
- ref <vmime::utility::file> getParent() const;
+ shared_ptr <vmime::utility::file> getParent() const;
void rename(const path& newName);
void remove();
- ref <vmime::utility::fileWriter> getFileWriter();
- ref <vmime::utility::fileReader> getFileReader();
+ shared_ptr <vmime::utility::fileWriter> getFileWriter();
+ shared_ptr <vmime::utility::fileReader> getFileReader();
- ref <vmime::utility::fileIterator> getFiles() const;
+ shared_ptr <vmime::utility::fileIterator> getFiles() const;
private:
@@ -192,7 +192,7 @@ class posixFileSystemFactory : public vmime::utility::fileSystemFactory
{
public:
- ref <vmime::utility::file> create(const vmime::utility::file::path& path) const;
+ shared_ptr <vmime::utility::file> create(const vmime::utility::file::path& path) const;
const vmime::utility::file::path stringToPath(const vmime::string& str) const;
const vmime::string pathToString(const vmime::utility::file::path& path) const;
diff --git a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp
index 34453916..0bba372b 100644
--- a/vmime/platforms/posix/posixHandler.hpp
+++ b/vmime/platforms/posix/posixHandler.hpp
@@ -67,30 +67,30 @@ public:
unsigned int getThreadId() const;
#if VMIME_HAVE_MESSAGING_FEATURES
- ref <vmime::net::socketFactory> getSocketFactory();
+ shared_ptr <vmime::net::socketFactory> getSocketFactory();
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+ shared_ptr <vmime::utility::fileSystemFactory> getFileSystemFactory();
- ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ shared_ptr <vmime::utility::childProcessFactory> getChildProcessFactory();
#endif
void wait() const;
void generateRandomBytes(unsigned char* buffer, const unsigned int count);
- ref <utility::sync::criticalSection> createCriticalSection();
+ shared_ptr <utility::sync::criticalSection> createCriticalSection();
private:
#if VMIME_HAVE_MESSAGING_FEATURES
- ref <posixSocketFactory> m_socketFactory;
+ shared_ptr <posixSocketFactory> m_socketFactory;
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- ref <posixFileSystemFactory> m_fileSysFactory;
- ref <posixChildProcessFactory> m_childProcFactory;
+ shared_ptr <posixFileSystemFactory> m_fileSysFactory;
+ shared_ptr <posixChildProcessFactory> m_childProcFactory;
#endif
};
diff --git a/vmime/platforms/posix/posixSocket.hpp b/vmime/platforms/posix/posixSocket.hpp
index ebbf551e..10df657e 100644
--- a/vmime/platforms/posix/posixSocket.hpp
+++ b/vmime/platforms/posix/posixSocket.hpp
@@ -43,7 +43,7 @@ class posixSocket : public vmime::net::socket
{
public:
- posixSocket(ref <vmime::net::timeoutHandler> th);
+ posixSocket(shared_ptr <vmime::net::timeoutHandler> th);
~posixSocket();
void connect(const vmime::string& address, const vmime::port_t port);
@@ -70,7 +70,7 @@ protected:
private:
- ref <vmime::net::timeoutHandler> m_timeoutHandler;
+ shared_ptr <vmime::net::timeoutHandler> m_timeoutHandler;
char m_buffer[65536];
int m_desc;
@@ -86,8 +86,8 @@ class posixSocketFactory : public vmime::net::socketFactory
{
public:
- ref <vmime::net::socket> create();
- ref <vmime::net::socket> create(ref <vmime::net::timeoutHandler> th);
+ shared_ptr <vmime::net::socket> create();
+ shared_ptr <vmime::net::socket> create(shared_ptr <vmime::net::timeoutHandler> th);
};
diff --git a/vmime/platforms/windows/windowsFile.hpp b/vmime/platforms/windows/windowsFile.hpp
index 1dae064c..65049b8f 100644
--- a/vmime/platforms/windows/windowsFile.hpp
+++ b/vmime/platforms/windows/windowsFile.hpp
@@ -46,7 +46,7 @@ class windowsFileSystemFactory : public vmime::utility::fileSystemFactory
{
public:
- ref <vmime::utility::file> create(const vmime::utility::file::path& path) const;
+ shared_ptr <vmime::utility::file> create(const vmime::utility::file::path& path) const;
const vmime::utility::file::path stringToPath(const vmime::string& str) const;
const vmime::string pathToString(const vmime::utility::file::path& path) const;
@@ -84,16 +84,16 @@ public:
bool exists() const;
- ref <file> getParent() const;
+ shared_ptr <file> getParent() const;
void rename(const path& newName);
void remove();
- ref <vmime::utility::fileWriter> getFileWriter();
+ shared_ptr <vmime::utility::fileWriter> getFileWriter();
- ref <vmime::utility::fileReader> getFileReader();
+ shared_ptr <vmime::utility::fileReader> getFileReader();
- ref <vmime::utility::fileIterator> getFiles() const;
+ shared_ptr <vmime::utility::fileIterator> getFiles() const;
private:
@@ -114,7 +114,7 @@ public:
~windowsFileIterator();
bool hasMoreElements() const;
- vmime::ref <vmime::utility::file> nextElement();
+ shared_ptr <vmime::utility::file> nextElement();
private:
@@ -140,7 +140,7 @@ public:
public:
- ref <vmime::utility::inputStream> getInputStream();
+ shared_ptr <vmime::utility::inputStream> getInputStream();
private:
@@ -180,7 +180,7 @@ public:
public:
- ref <vmime::utility::outputStream> getOutputStream();
+ shared_ptr <vmime::utility::outputStream> getOutputStream();
private:
diff --git a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp
index d3ac434c..4a3678eb 100644
--- a/vmime/platforms/windows/windowsHandler.hpp
+++ b/vmime/platforms/windows/windowsHandler.hpp
@@ -66,29 +66,29 @@ public:
unsigned int getThreadId() const;
#if VMIME_HAVE_MESSAGING_FEATURES
- ref <vmime::net::socketFactory> getSocketFactory();
+ shared_ptr <vmime::net::socketFactory> getSocketFactory();
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- ref <vmime::utility::fileSystemFactory> getFileSystemFactory();
+ shared_ptr <vmime::utility::fileSystemFactory> getFileSystemFactory();
- ref <vmime::utility::childProcessFactory> getChildProcessFactory();
+ shared_ptr <vmime::utility::childProcessFactory> getChildProcessFactory();
#endif
void wait() const;
void generateRandomBytes(unsigned char* buffer, const unsigned int count);
- ref <utility::sync::criticalSection> createCriticalSection();
+ shared_ptr <utility::sync::criticalSection> createCriticalSection();
private:
#if VMIME_HAVE_MESSAGING_FEATURES
- ref <windowsSocketFactory> m_socketFactory;
+ shared_ptr <windowsSocketFactory> m_socketFactory;
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- ref <windowsFileSystemFactory> m_fileSysFactory;
+ shared_ptr <windowsFileSystemFactory> m_fileSysFactory;
#endif
};
diff --git a/vmime/platforms/windows/windowsSocket.hpp b/vmime/platforms/windows/windowsSocket.hpp
index db3e6323..4c4344d8 100644
--- a/vmime/platforms/windows/windowsSocket.hpp
+++ b/vmime/platforms/windows/windowsSocket.hpp
@@ -45,7 +45,7 @@ class windowsSocket : public vmime::net::socket
public:
windowsSocket();
- windowsSocket(ref <vmime::net::timeoutHandler> th);
+ windowsSocket(shared_ptr <vmime::net::timeoutHandler> th);
~windowsSocket();
public:
@@ -83,7 +83,7 @@ protected:
private:
- ref <vmime::net::timeoutHandler> m_timeoutHandler;
+ shared_ptr <vmime::net::timeoutHandler> m_timeoutHandler;
char m_buffer[65536];
SOCKET m_desc;
@@ -99,8 +99,8 @@ class windowsSocketFactory : public vmime::net::socketFactory
{
public:
- ref <vmime::net::socket> create();
- ref <vmime::net::socket> create(ref <vmime::net::timeoutHandler> th);
+ shared_ptr <vmime::net::socket> create();
+ shared_ptr <vmime::net::socket> create(shared_ptr <vmime::net::timeoutHandler> th);
};
diff --git a/vmime/propertySet.hpp b/vmime/propertySet.hpp
index eefdbcc3..bf1c39bf 100644
--- a/vmime/propertySet.hpp
+++ b/vmime/propertySet.hpp
@@ -276,7 +276,7 @@ public:
template <class TYPE>
const TYPE getProperty(const string& name) const
{
- const ref <property> prop = find(name);
+ const shared_ptr <property> prop = find(name);
if (!prop) throw exceptions::no_such_property(name);
//return (prop->getValue <TYPE>()); // BUG: with g++ < 3.4
@@ -295,7 +295,7 @@ public:
template <class TYPE>
const TYPE getProperty(const string& name, const TYPE defaultValue) const
{
- const ref <property> prop = find(name);
+ const shared_ptr <property> prop = find(name);
//return (prop ? prop->getValue <TYPE>() : defaultValue); // BUG: with g++ < 3.4
return (prop ? prop->template getValue <TYPE>() : defaultValue);
}
@@ -335,13 +335,13 @@ private:
void parse(const string& props);
- class propFinder : public std::unary_function <ref <property>, bool>
+ class propFinder : public std::unary_function <shared_ptr <property>, bool>
{
public:
propFinder(const string& name) : m_name(utility::stringUtils::toLower(name)) { }
- bool operator()(ref <property> p) const
+ bool operator()(shared_ptr <property> p) const
{
return (utility::stringUtils::toLower(p->getName()) == m_name);
}
@@ -351,10 +351,10 @@ private:
const string m_name;
};
- ref <property> find(const string& name) const;
- ref <property> findOrCreate(const string& name);
+ shared_ptr <property> find(const string& name) const;
+ shared_ptr <property> findOrCreate(const string& name);
- typedef std::list <ref <property> > list_type;
+ typedef std::list <shared_ptr <property> > list_type;
list_type m_props;
public:
@@ -427,13 +427,13 @@ public:
*
* @return list of properties
*/
- const std::vector <ref <const property> > getPropertyList() const;
+ const std::vector <shared_ptr <const property> > getPropertyList() const;
/** Return the property list.
*
* @return list of properties
*/
- const std::vector <ref <property> > getPropertyList();
+ const std::vector <shared_ptr <property> > getPropertyList();
};
diff --git a/vmime/relay.hpp b/vmime/relay.hpp
index f778a0bc..62ed5bf0 100644
--- a/vmime/relay.hpp
+++ b/vmime/relay.hpp
@@ -47,11 +47,11 @@ public:
public:
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
relay& operator=(const relay& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
const string& getFrom() const;
void setFrom(const string& from);
diff --git a/vmime/security/authenticator.hpp b/vmime/security/authenticator.hpp
index 5efdb321..bef07b4a 100644
--- a/vmime/security/authenticator.hpp
+++ b/vmime/security/authenticator.hpp
@@ -114,7 +114,7 @@ public:
*
* @param serv messaging service instance
*/
- virtual void setService(ref <net::service> serv) = 0;
+ virtual void setService(shared_ptr <net::service> serv) = 0;
};
diff --git a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Certificate.hpp
index 20ebfe5a..215a86cf 100644
--- a/vmime/security/cert/X509Certificate.hpp
+++ b/vmime/security/cert/X509Certificate.hpp
@@ -74,7 +74,7 @@ public:
* @return a X.509 certificate, or NULL if the given data does not
* represent a valid certificate
*/
- static ref <X509Certificate> import(utility::inputStream& is);
+ static shared_ptr <X509Certificate> import(utility::inputStream& is);
/** Imports a DER or PEM encoded X.509 certificate.
*
@@ -83,7 +83,7 @@ public:
* @return a X.509 certificate, or NULL if the given data does not
* represent a valid certificate
*/
- static ref <X509Certificate> import(const byte_t* data, const size_t length);
+ static shared_ptr <X509Certificate> import(const byte_t* data, const size_t length);
/** Exports this X.509 certificate to the specified format.
*
@@ -107,14 +107,14 @@ public:
* @return true if this certificate was issued by the given issuer,
* false otherwise
*/
- virtual bool checkIssuer(ref <const X509Certificate> issuer) const = 0;
+ virtual bool checkIssuer(shared_ptr <const X509Certificate> issuer) const = 0;
/** Verifies this certificate against a given trusted one.
*
* @param caCert a certificate that is considered to be trusted one
* @return true if the verification succeeded, false otherwise
*/
- virtual bool verify(ref <const X509Certificate> caCert) const = 0;
+ virtual bool verify(shared_ptr <const X509Certificate> caCert) const = 0;
/** Verify certificate's subject name against the given hostname.
*
diff --git a/vmime/security/cert/certificate.hpp b/vmime/security/cert/certificate.hpp
index e4a57fb4..aef1f1f9 100644
--- a/vmime/security/cert/certificate.hpp
+++ b/vmime/security/cert/certificate.hpp
@@ -64,7 +64,7 @@ public:
* @return true if the two certificates are the same,
* false otherwise
*/
- virtual bool equals(ref <const certificate> other) const = 0;
+ virtual bool equals(shared_ptr <const certificate> other) const = 0;
/** Returns a pointer to internal binary data for this certificate.
* The actual type of data depends on the library used for TLS support.
diff --git a/vmime/security/cert/certificateChain.hpp b/vmime/security/cert/certificateChain.hpp
index 8daa4cb5..0ce6bda3 100644
--- a/vmime/security/cert/certificateChain.hpp
+++ b/vmime/security/cert/certificateChain.hpp
@@ -47,7 +47,7 @@ public:
*
* @param certs chain of certificates
*/
- certificateChain(const std::vector <ref <certificate> >& certs);
+ certificateChain(const std::vector <shared_ptr <certificate> >& certs);
/** Return the number of certificates in the chain.
*
@@ -62,11 +62,11 @@ public:
* @param index position at which to retrieve certificate
* @return certificate at the specified position
*/
- ref <certificate> getAt(const unsigned int index);
+ shared_ptr <certificate> getAt(const unsigned int index);
protected:
- std::vector <ref <certificate> > m_certs;
+ std::vector <shared_ptr <certificate> > m_certs;
};
diff --git a/vmime/security/cert/certificateVerifier.hpp b/vmime/security/cert/certificateVerifier.hpp
index 349ab46d..c72c84cb 100644
--- a/vmime/security/cert/certificateVerifier.hpp
+++ b/vmime/security/cert/certificateVerifier.hpp
@@ -49,7 +49,7 @@ public:
* or more certificates can not be trusted, or the server identity
* cannot be verified
*/
- virtual void verify(ref <certificateChain> chain, const string& hostname) = 0;
+ virtual void verify(shared_ptr <certificateChain> chain, const string& hostname) = 0;
};
diff --git a/vmime/security/cert/defaultCertificateVerifier.hpp b/vmime/security/cert/defaultCertificateVerifier.hpp
index 84e08e64..fddcc4f5 100644
--- a/vmime/security/cert/defaultCertificateVerifier.hpp
+++ b/vmime/security/cert/defaultCertificateVerifier.hpp
@@ -53,17 +53,17 @@ public:
*
* @param trustedCerts list of trusted certificates
*/
- void setX509TrustedCerts(const std::vector <ref <X509Certificate> >& trustedCerts);
+ void setX509TrustedCerts(const std::vector <shared_ptr <X509Certificate> >& trustedCerts);
/** Sets the X.509 root CAs used for certificate verification.
*
* @param caCerts list of root CAs
*/
- void setX509RootCAs(const std::vector <ref <X509Certificate> >& caCerts);
+ void setX509RootCAs(const std::vector <shared_ptr <X509Certificate> >& caCerts);
// Implementation of 'certificateVerifier'
- void verify(ref <certificateChain> chain, const string& hostname);
+ void verify(shared_ptr <certificateChain> chain, const string& hostname);
private:
@@ -72,11 +72,11 @@ private:
* @param chain list of X.509 certificates
* @param hostname server hostname
*/
- void verifyX509(ref <certificateChain> chain, const string& hostname);
+ void verifyX509(shared_ptr <certificateChain> chain, const string& hostname);
- std::vector <ref <X509Certificate> > m_x509RootCAs;
- std::vector <ref <X509Certificate> > m_x509TrustedCerts;
+ std::vector <shared_ptr <X509Certificate> > m_x509RootCAs;
+ std::vector <shared_ptr <X509Certificate> > m_x509TrustedCerts;
};
diff --git a/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp b/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp
index bd38342d..76ee6d4d 100644
--- a/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp
+++ b/vmime/security/cert/gnutls/X509Certificate_GnuTLS.hpp
@@ -41,16 +41,14 @@ namespace cert {
class X509Certificate_GnuTLS : public X509Certificate
{
- friend class vmime::creator;
friend class X509Certificate;
-protected:
-
- X509Certificate_GnuTLS();
X509Certificate_GnuTLS(const X509Certificate&);
public:
+ X509Certificate_GnuTLS();
+
~X509Certificate_GnuTLS();
@@ -58,9 +56,9 @@ public:
const byteArray getSerialNumber() const;
- bool checkIssuer(ref <const X509Certificate> issuer) const;
+ bool checkIssuer(shared_ptr <const X509Certificate> issuer) const;
- bool verify(ref <const X509Certificate> caCert) const;
+ bool verify(shared_ptr <const X509Certificate> caCert) const;
bool verifyHostName(const string& hostname) const;
@@ -74,7 +72,7 @@ public:
const byteArray getEncoded() const;
const string getType() const;
int getVersion() const;
- bool equals(ref <const certificate> other) const;
+ bool equals(shared_ptr <const certificate> other) const;
void* getInternalData();
private:
diff --git a/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp b/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp
index 60ecda08..bddb4b6c 100644
--- a/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp
+++ b/vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp
@@ -43,17 +43,15 @@ namespace cert {
class X509Certificate_OpenSSL : public X509Certificate
{
- friend class vmime::creator;
friend class X509Certificate;
-protected:
-
- X509Certificate_OpenSSL();
- X509Certificate_OpenSSL(X509* cert);
X509Certificate_OpenSSL(const X509Certificate_OpenSSL&);
public:
+ X509Certificate_OpenSSL();
+ X509Certificate_OpenSSL(X509* cert);
+
~X509Certificate_OpenSSL();
@@ -61,9 +59,9 @@ public:
const byteArray getSerialNumber() const;
- bool checkIssuer(ref <const X509Certificate> issuer) const;
+ bool checkIssuer(shared_ptr <const X509Certificate> issuer) const;
- bool verify(ref <const X509Certificate> caCert) const;
+ bool verify(shared_ptr <const X509Certificate> caCert) const;
bool verifyHostName(const string& hostname) const;
@@ -73,14 +71,14 @@ public:
const byteArray getFingerprint(const DigestAlgorithm algo) const;
- static ref <X509Certificate> importInternal(X509* cert);
+ static shared_ptr <X509Certificate> importInternal(X509* cert);
// Implementation of 'certificate'
const byteArray getEncoded() const;
const string getType() const;
int getVersion() const;
- bool equals(ref <const certificate> other) const;
+ bool equals(shared_ptr <const certificate> other) const;
void* getInternalData();
private:
diff --git a/vmime/security/defaultAuthenticator.hpp b/vmime/security/defaultAuthenticator.hpp
index 780dc310..eead3d14 100644
--- a/vmime/security/defaultAuthenticator.hpp
+++ b/vmime/security/defaultAuthenticator.hpp
@@ -54,12 +54,12 @@ public:
const string getAnonymousToken() const;
const string getServiceName() const;
- void setService(ref <net::service> serv);
- weak_ref <net::service> getService() const;
+ void setService(shared_ptr <net::service> serv);
+ weak_ptr <net::service> getService() const;
private:
- weak_ref <net::service> m_service;
+ weak_ptr <net::service> m_service;
};
diff --git a/vmime/security/digest/messageDigestFactory.hpp b/vmime/security/digest/messageDigestFactory.hpp
index 2a1a4083..15fd8a28 100644
--- a/vmime/security/digest/messageDigestFactory.hpp
+++ b/vmime/security/digest/messageDigestFactory.hpp
@@ -55,7 +55,7 @@ private:
{
public:
- virtual ref <messageDigest> create() const = 0;
+ virtual shared_ptr <messageDigest> create() const = 0;
};
template <class E>
@@ -63,14 +63,14 @@ private:
{
public:
- ref <messageDigest> create() const
+ shared_ptr <messageDigest> create() const
{
- return vmime::create <E>();
+ return vmime::make_shared <E>();
}
};
- typedef std::map <string, ref <digestAlgorithmFactory> > MapType;
+ typedef std::map <string, shared_ptr <digestAlgorithmFactory> > MapType;
MapType m_algos;
public:
@@ -83,7 +83,7 @@ public:
void registerAlgorithm(const string& name)
{
m_algos.insert(MapType::value_type(utility::stringUtils::toLower(name),
- vmime::create <digestAlgorithmFactoryImpl <E> >()));
+ vmime::make_shared <digestAlgorithmFactoryImpl <E> >()));
}
/** Create a new algorithm instance from its name.
@@ -93,7 +93,7 @@ public:
* @throw exceptions::no_digest_algorithm_available if no algorithm is
* registered with this name
*/
- ref <messageDigest> create(const string& name);
+ shared_ptr <messageDigest> create(const string& name);
/** Return a list of supported digest algorithms.
*
diff --git a/vmime/security/sasl/SASLAuthenticator.hpp b/vmime/security/sasl/SASLAuthenticator.hpp
index 56588fc8..9f1881f5 100644
--- a/vmime/security/sasl/SASLAuthenticator.hpp
+++ b/vmime/security/sasl/SASLAuthenticator.hpp
@@ -64,15 +64,15 @@ public:
* @return ordered list of mechanism to use among the available
* mechanisms (from the first to try to the last)
*/
- virtual const std::vector <ref <SASLMechanism> > getAcceptableMechanisms
- (const std::vector <ref <SASLMechanism> >& available,
- ref <SASLMechanism> suggested) const = 0;
+ virtual const std::vector <shared_ptr <SASLMechanism> > getAcceptableMechanisms
+ (const std::vector <shared_ptr <SASLMechanism> >& available,
+ shared_ptr <SASLMechanism> suggested) const = 0;
/** Set the SASL session which is using this authenticator.
*
* @param sess SASL session
*/
- virtual void setSASLSession(ref <SASLSession> sess) = 0;
+ virtual void setSASLSession(shared_ptr <SASLSession> sess) = 0;
/** Set the SASL mechanism which has been selected for the
* SASL authentication process. This may be called several times
@@ -81,7 +81,7 @@ public:
*
* @param mech SASL mechanism
*/
- virtual void setSASLMechanism(ref <SASLMechanism> mech) = 0;
+ virtual void setSASLMechanism(shared_ptr <SASLMechanism> mech) = 0;
};
diff --git a/vmime/security/sasl/SASLContext.hpp b/vmime/security/sasl/SASLContext.hpp
index 8f6e177c..7afcddf2 100644
--- a/vmime/security/sasl/SASLContext.hpp
+++ b/vmime/security/sasl/SASLContext.hpp
@@ -64,9 +64,9 @@ public:
* @param mech SASL mechanism
* @return a new SASL session
*/
- ref <SASLSession> createSession
+ shared_ptr <SASLSession> createSession
(const string& serviceName,
- ref <authenticator> auth, ref <SASLMechanism> mech);
+ shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech);
/** Create an instance of an SASL mechanism.
*
@@ -75,7 +75,7 @@ public:
* @throw exceptions::no_such_mechanism if no mechanism is
* registered for the specified name
*/
- ref <SASLMechanism> createMechanism(const string& name);
+ shared_ptr <SASLMechanism> createMechanism(const string& name);
/** Suggests an SASL mechanism among a set of mechanisms
* supported by the server.
@@ -84,8 +84,8 @@ public:
* @return suggested mechanism (usually the safest mechanism
* supported by both the client and the server)
*/
- ref <SASLMechanism> suggestMechanism
- (const std::vector <ref <SASLMechanism> >& mechs);
+ shared_ptr <SASLMechanism> suggestMechanism
+ (const std::vector <shared_ptr <SASLMechanism> >& mechs);
/** Helper function for decoding Base64-encoded challenge.
*
diff --git a/vmime/security/sasl/SASLMechanism.hpp b/vmime/security/sasl/SASLMechanism.hpp
index 56566a42..623069d5 100644
--- a/vmime/security/sasl/SASLMechanism.hpp
+++ b/vmime/security/sasl/SASLMechanism.hpp
@@ -71,7 +71,7 @@ public:
* 'responseLen' are undetermined)
*/
virtual bool step
- (ref <SASLSession> sess,
+ (shared_ptr <SASLSession> sess,
const byte_t* challenge, const long challengeLen,
byte_t** response, long* responseLen) = 0;
@@ -97,7 +97,7 @@ public:
* the encoding of data (in this case, the values in 'output' and
* 'outputLen' are undetermined)
*/
- virtual void encode(ref <SASLSession> sess,
+ virtual void encode(shared_ptr <SASLSession> sess,
const byte_t* input, const long inputLen,
byte_t** output, long* outputLen) = 0;
@@ -114,7 +114,7 @@ public:
* the encoding of data (in this case, the values in 'output' and
* 'outputLen' are undetermined)
*/
- virtual void decode(ref <SASLSession> sess,
+ virtual void decode(shared_ptr <SASLSession> sess,
const byte_t* input, const long inputLen,
byte_t** output, long* outputLen) = 0;
};
diff --git a/vmime/security/sasl/SASLMechanismFactory.hpp b/vmime/security/sasl/SASLMechanismFactory.hpp
index 920b78fc..3503f71b 100644
--- a/vmime/security/sasl/SASLMechanismFactory.hpp
+++ b/vmime/security/sasl/SASLMechanismFactory.hpp
@@ -61,8 +61,8 @@ private:
{
public:
- virtual ref <SASLMechanism> create
- (ref <SASLContext> ctx, const string& name) = 0;
+ virtual shared_ptr <SASLMechanism> create
+ (shared_ptr <SASLContext> ctx, const string& name) = 0;
};
template <typename T>
@@ -70,13 +70,13 @@ private:
{
public:
- ref <SASLMechanism> create(ref <SASLContext> ctx, const string& name)
+ shared_ptr <SASLMechanism> create(shared_ptr <SASLContext> ctx, const string& name)
{
- return vmime::create <T>(ctx, name);
+ return vmime::make_shared <T>(ctx, name);
}
};
- typedef std::map <string, ref <registeredMechanism> > MapType;
+ typedef std::map <string, shared_ptr <registeredMechanism> > MapType;
MapType m_mechs;
public:
@@ -92,7 +92,7 @@ public:
void registerMechanism(const string& name)
{
m_mechs.insert(MapType::value_type(name,
- vmime::create <registeredMechanismImpl <MECH_CLASS> >()));
+ vmime::make_shared <registeredMechanismImpl <MECH_CLASS> >()));
}
/** Create a mechanism object given its name.
@@ -103,7 +103,7 @@ public:
* @throw exceptions::no_such_mechanism if no mechanism is
* registered for the specified name
*/
- ref <SASLMechanism> create(ref <SASLContext> ctx, const string& name);
+ shared_ptr <SASLMechanism> create(shared_ptr <SASLContext> ctx, const string& name);
/** Return a list of supported mechanisms. This includes mechanisms
* registered using registerMechanism() as well as the ones that
diff --git a/vmime/security/sasl/SASLSession.hpp b/vmime/security/sasl/SASLSession.hpp
index a196e06d..830d9970 100644
--- a/vmime/security/sasl/SASLSession.hpp
+++ b/vmime/security/sasl/SASLSession.hpp
@@ -64,8 +64,8 @@ public:
* @param auth authenticator to use for this session
* @param mech SASL mechanism
*/
- SASLSession(const string& serviceName, ref <SASLContext> ctx,
- ref <authenticator> auth, ref <SASLMechanism> mech);
+ SASLSession(const string& serviceName, shared_ptr <SASLContext> ctx,
+ shared_ptr <authenticator> auth, shared_ptr <SASLMechanism> mech);
/** Initialize this SASL session. This must be called before
* calling any other method on this object (except accessors).
@@ -78,19 +78,19 @@ public:
*
* @return authenticator object
*/
- ref <authenticator> getAuthenticator();
+ shared_ptr <authenticator> getAuthenticator();
/** Return the mechanism used for this session.
*
* @return SASL mechanism
*/
- ref <SASLMechanism> getMechanism();
+ shared_ptr <SASLMechanism> getMechanism();
/** Return the SASL context.
*
* @return SASL context
*/
- ref <SASLContext> getContext();
+ shared_ptr <SASLContext> getContext();
/** Perform one step of SASL authentication. Accept data from the
* server (challenge), process it and return data to be returned
@@ -118,7 +118,7 @@ public:
* @param sok socket to wrap
* @return secured socket
*/
- ref <net::socket> getSecuredSocket(ref <net::socket> sok);
+ shared_ptr <net::socket> getSecuredSocket(shared_ptr <net::socket> sok);
/** Return the name of the service which is using this
* SASL session (eg. "imap"). This value should be returned
@@ -132,9 +132,9 @@ private:
const string m_serviceName;
- ref <SASLContext> m_context;
- ref <authenticator> m_auth;
- ref <SASLMechanism> m_mech;
+ shared_ptr <SASLContext> m_context;
+ shared_ptr <authenticator> m_auth;
+ shared_ptr <SASLMechanism> m_mech;
#ifdef GSASL_VERSION
Gsasl* m_gsaslContext;
diff --git a/vmime/security/sasl/SASLSocket.hpp b/vmime/security/sasl/SASLSocket.hpp
index 3c1cf12c..33487eba 100644
--- a/vmime/security/sasl/SASLSocket.hpp
+++ b/vmime/security/sasl/SASLSocket.hpp
@@ -50,7 +50,7 @@ class VMIME_EXPORT SASLSocket : public net::socket
{
public:
- SASLSocket(ref <SASLSession> sess, ref <net::socket> wrapped);
+ SASLSocket(shared_ptr <SASLSession> sess, shared_ptr <net::socket> wrapped);
~SASLSocket();
void connect(const string& address, const port_t port);
@@ -74,8 +74,8 @@ public:
private:
- ref <SASLSession> m_session;
- ref <net::socket> m_wrapped;
+ shared_ptr <SASLSession> m_session;
+ shared_ptr <net::socket> m_wrapped;
byte_t* m_pendingBuffer;
size_type m_pendingPos;
diff --git a/vmime/security/sasl/builtinSASLMechanism.hpp b/vmime/security/sasl/builtinSASLMechanism.hpp
index 3507dc45..e7081a27 100644
--- a/vmime/security/sasl/builtinSASLMechanism.hpp
+++ b/vmime/security/sasl/builtinSASLMechanism.hpp
@@ -49,30 +49,30 @@ class VMIME_EXPORT builtinSASLMechanism : public SASLMechanism
{
public:
- builtinSASLMechanism(ref <SASLContext> ctx, const string& name);
+ builtinSASLMechanism(shared_ptr <SASLContext> ctx, const string& name);
~builtinSASLMechanism();
const string getName() const;
- bool step(ref <SASLSession> sess,
+ bool step(shared_ptr <SASLSession> sess,
const byte_t* challenge, const long challengeLen,
byte_t** response, long* responseLen);
bool isComplete() const;
- void encode(ref <SASLSession> sess,
+ void encode(shared_ptr <SASLSession> sess,
const byte_t* input, const long inputLen,
byte_t** output, long* outputLen);
- void decode(ref <SASLSession> sess,
+ void decode(shared_ptr <SASLSession> sess,
const byte_t* input, const long inputLen,
byte_t** output, long* outputLen);
private:
/** SASL context */
- ref <SASLContext> m_context;
+ shared_ptr <SASLContext> m_context;
/** Mechanism name */
const string m_name;
diff --git a/vmime/security/sasl/defaultSASLAuthenticator.hpp b/vmime/security/sasl/defaultSASLAuthenticator.hpp
index 68ae7946..6ea9af80 100644
--- a/vmime/security/sasl/defaultSASLAuthenticator.hpp
+++ b/vmime/security/sasl/defaultSASLAuthenticator.hpp
@@ -50,9 +50,9 @@ public:
defaultSASLAuthenticator();
~defaultSASLAuthenticator();
- const std::vector <ref <SASLMechanism> > getAcceptableMechanisms
- (const std::vector <ref <SASLMechanism> >& available,
- ref <SASLMechanism> suggested) const;
+ const std::vector <shared_ptr <SASLMechanism> > getAcceptableMechanisms
+ (const std::vector <shared_ptr <SASLMechanism> >& available,
+ shared_ptr <SASLMechanism> suggested) const;
const string getUsername() const;
const string getPassword() const;
@@ -60,22 +60,22 @@ public:
const string getAnonymousToken() const;
const string getServiceName() const;
- void setService(ref <net::service> serv);
- weak_ref <net::service> getService() const;
+ void setService(shared_ptr <net::service> serv);
+ weak_ptr <net::service> getService() const;
- void setSASLSession(ref <SASLSession> sess);
- ref <SASLSession> getSASLSession() const;
+ void setSASLSession(shared_ptr <SASLSession> sess);
+ shared_ptr <SASLSession> getSASLSession() const;
- void setSASLMechanism(ref <SASLMechanism> mech);
- ref <SASLMechanism> getSASLMechanism() const;
+ void setSASLMechanism(shared_ptr <SASLMechanism> mech);
+ shared_ptr <SASLMechanism> getSASLMechanism() const;
private:
defaultAuthenticator m_default;
- weak_ref <net::service> m_service;
- weak_ref <SASLSession> m_saslSession;
- ref <SASLMechanism> m_saslMech;
+ weak_ptr <net::service> m_service;
+ weak_ptr <SASLSession> m_saslSession;
+ shared_ptr <SASLMechanism> m_saslMech;
};
diff --git a/vmime/streamContentHandler.hpp b/vmime/streamContentHandler.hpp
index bf2eb449..52f6718a 100644
--- a/vmime/streamContentHandler.hpp
+++ b/vmime/streamContentHandler.hpp
@@ -58,7 +58,7 @@ public:
* @return a reference to a new content handler
*/
streamContentHandler
- (ref <utility::inputStream> is,
+ (shared_ptr <utility::inputStream> is,
const utility::stream::size_type length,
const vmime::encoding& enc = NO_ENCODING);
@@ -67,7 +67,7 @@ public:
streamContentHandler(const streamContentHandler& cts);
streamContentHandler& operator=(const streamContentHandler& cts);
- ref <contentHandler> clone() const;
+ shared_ptr <contentHandler> clone() const;
/** Sets the data managed by this content handler.
*
@@ -79,7 +79,7 @@ public:
* from the stream is already encoded with the specified encoding
*/
void setData
- (ref <utility::inputStream> is,
+ (shared_ptr <utility::inputStream> is,
const utility::stream::size_type length,
const vmime::encoding& enc = NO_ENCODING);
@@ -111,7 +111,7 @@ private:
vmime::encoding m_encoding;
// Actual data
- mutable ref <utility::inputStream> m_stream;
+ mutable shared_ptr <utility::inputStream> m_stream;
string::size_type m_length;
};
diff --git a/vmime/stringContentHandler.hpp b/vmime/stringContentHandler.hpp
index 4565ceb8..b8fdaa71 100644
--- a/vmime/stringContentHandler.hpp
+++ b/vmime/stringContentHandler.hpp
@@ -46,7 +46,7 @@ public:
stringContentHandler(const stringContentHandler& cts);
stringContentHandler& operator=(const stringContentHandler& cts);
- ref <contentHandler> clone() const;
+ shared_ptr <contentHandler> clone() const;
// Set the data contained in the body.
//
diff --git a/vmime/text.hpp b/vmime/text.hpp
index be55bf08..98e2459a 100644
--- a/vmime/text.hpp
+++ b/vmime/text.hpp
@@ -53,18 +53,18 @@ public:
bool operator==(const text& t) const;
bool operator!=(const text& t) const;
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
void copyFrom(const component& other);
text& operator=(const component& other);
text& operator=(const text& other);
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
/** Add a word at the end of the list.
*
* @param w word to append
*/
- void appendWord(ref <word> w);
+ void appendWord(shared_ptr <word> w);
/** Insert a new word before the specified position.
*
@@ -72,14 +72,14 @@ public:
* the beginning of the list)
* @param w word to insert
*/
- void insertWordBefore(const size_t pos, ref <word> w);
+ void insertWordBefore(const size_t pos, shared_ptr <word> w);
/** Insert a new word after the specified position.
*
* @param pos position of the word before the new word
* @param w word to insert
*/
- void insertWordAfter(const size_t pos, ref <word> w);
+ void insertWordAfter(const size_t pos, shared_ptr <word> w);
/** Remove the word at the specified position.
*
@@ -108,26 +108,26 @@ public:
* @param pos position
* @return word at position 'pos'
*/
- const ref <word> getWordAt(const size_t pos);
+ const shared_ptr <word> getWordAt(const size_t pos);
/** Return the word at the specified position.
*
* @param pos position
* @return word at position 'pos'
*/
- const ref <const word> getWordAt(const size_t pos) const;
+ const shared_ptr <const word> getWordAt(const size_t pos) const;
/** Return the word list.
*
* @return list of words
*/
- const std::vector <ref <const word> > getWordList() const;
+ const std::vector <shared_ptr <const word> > getWordList() const;
/** Return the word list.
*
* @return list of words
*/
- const std::vector <ref <word> > getWordList();
+ const std::vector <shared_ptr <word> > getWordList();
/** Return the text converted into the specified charset.
@@ -166,7 +166,7 @@ public:
* @param ch input charset
* @return new text object
*/
- static ref <text> newFromString(const string& in, const charset& ch);
+ static shared_ptr <text> newFromString(const string& in, const charset& ch);
/** This function can be used to make several encoded words from a text.
* All the characters in the text must be in the same specified charset.
@@ -216,7 +216,7 @@ public:
* @param in input string
* @return new text object
*/
- static ref <text> decodeAndUnfold(const string& in);
+ static shared_ptr <text> decodeAndUnfold(const string& in);
/** Decode and unfold text (RFC-2047).
*
@@ -224,7 +224,7 @@ public:
* @param in input string
* @return new text object
*/
- static ref <text> decodeAndUnfold(const parsingContext& ctx, const string& in);
+ static shared_ptr <text> decodeAndUnfold(const parsingContext& ctx, const string& in);
/** Decode and unfold text (RFC-2047), using the default parsing context.
*
@@ -267,7 +267,7 @@ protected:
private:
- std::vector <ref <word> > m_words;
+ std::vector <shared_ptr <word> > m_words;
};
diff --git a/vmime/textPart.hpp b/vmime/textPart.hpp
index 0548de3f..6348f8d7 100644
--- a/vmime/textPart.hpp
+++ b/vmime/textPart.hpp
@@ -73,13 +73,13 @@ public:
*
* @return text of the part
*/
- virtual const ref <const contentHandler> getText() const = 0;
+ virtual const shared_ptr <const contentHandler> getText() const = 0;
/** Set the text contained in the part.
*
* @param text text of the part
*/
- virtual void setText(ref <contentHandler> text) = 0;
+ virtual void setText(shared_ptr <contentHandler> text) = 0;
/** Return the actual body parts this text part is composed of.
* For example, HTML parts are composed of two parts: one "text/html"
@@ -94,7 +94,7 @@ public:
* @param message the message
* @param parent body part into which generate this part
*/
- virtual void generateIn(ref <bodyPart> message, ref <bodyPart> parent) const = 0;
+ virtual void generateIn(shared_ptr <bodyPart> message, shared_ptr <bodyPart> parent) const = 0;
/** Parse the text part(s) from the specified message.
*
@@ -102,7 +102,7 @@ public:
* @param parent part containing the text part
* @param textPart actual text part
*/
- virtual void parse(ref <const bodyPart> message, ref <const bodyPart> parent, ref <const bodyPart> textPart) = 0;
+ virtual void parse(shared_ptr <const bodyPart> message, shared_ptr <const bodyPart> parent, shared_ptr <const bodyPart> textPart) = 0;
};
diff --git a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
index 4112f1ba..f5ce3774 100644
--- a/vmime/textPartFactory.hpp
+++ b/vmime/textPartFactory.hpp
@@ -40,7 +40,7 @@ protected:
textPartFactory();
~textPartFactory();
- typedef ref <textPart> (*AllocFunc)(void);
+ typedef shared_ptr <textPart> (*AllocFunc)(void);
typedef std::vector <std::pair <mediaType, AllocFunc> > MapType;
MapType m_map;
@@ -51,10 +51,10 @@ protected:
{
public:
- static ref <textPart> creator()
+ static shared_ptr <textPart> creator()
{
// Allocate a new object
- return vmime::create <TYPE>();
+ return vmime::make_shared <TYPE>();
}
};
#endif // VMIME_BUILDING_DOC
@@ -69,7 +69,7 @@ public:
m_map.push_back(MapType::value_type(type, &registerer<T>::creator));
}
- ref <textPart> create(const mediaType& type);
+ shared_ptr <textPart> create(const mediaType& type);
};
diff --git a/vmime/types.hpp b/vmime/types.hpp
index d9f5bec6..1a36ea7a 100644
--- a/vmime/types.hpp
+++ b/vmime/types.hpp
@@ -30,7 +30,51 @@
#include <vector>
#include "vmime/config.hpp"
-#include "vmime/utility/smartPtr.hpp"
+
+
+#ifndef VMIME_BUILDING_DOC
+
+#if VMIME_SHARED_PTR_USE_CXX
+ // If we are compiling with C++11, use shared_ptr<> from the standard lib
+ #include <memory>
+
+ #define VMIME_SHARED_PTR_NAMESPACE std
+#elif VMIME_SHARED_PTR_USE_BOOST
+ // Else, use boost's shared_ptr<>
+ #include <boost/shared_ptr.hpp>
+ #include <boost/weak_ptr.hpp>
+ #include <boost/make_shared.hpp>
+ #include <boost/enable_shared_from_this.hpp>
+ #include <boost/shared_ptr.hpp>
+
+ #define VMIME_SHARED_PTR_NAMESPACE boost
+#else
+ #error Either VMIME_SHAREDPTR_USE_CXX or VMIME_SHAREDPTR_USE_BOOST must be set to ON
+#endif
+
+namespace vmime
+{
+ using VMIME_SHARED_PTR_NAMESPACE::shared_ptr;
+ using VMIME_SHARED_PTR_NAMESPACE::weak_ptr;
+ using VMIME_SHARED_PTR_NAMESPACE::make_shared;
+ using VMIME_SHARED_PTR_NAMESPACE::enable_shared_from_this;
+ using VMIME_SHARED_PTR_NAMESPACE::dynamic_pointer_cast;
+ using VMIME_SHARED_PTR_NAMESPACE::const_pointer_cast;
+
+ /** Custom deleter to be used with shared_ptr.
+ * This is does not actually delete the pointer, and is used
+ * only for the singleton classes allocated on the stack.
+ */
+ template <typename T>
+ struct noop_shared_ptr_deleter
+ {
+ void operator()(T*) const {}
+ };
+}
+
+#undef VMIME_SHARED_PTR_NAMESPACE
+
+#endif // VMIME_BUILDING_DOC
namespace vmime
@@ -48,22 +92,12 @@ namespace vmime
typedef unsigned long size_t;
#endif // !VMIME_HAVE_SIZE_T
- // Some aliases
- namespace utils = utility;
-
- using vmime::utility::ref;
- using vmime::utility::weak_ref;
- using vmime::utility::null_ref;
-
- extern const null_ref VMIME_EXPORT null;
-
// For compatibility with versions <= 0.7.1 (deprecated)
namespace net { }
namespace messaging = net;
}
-// This is here because 'vmime::ref' need to be declared...
#include "vmime/object.hpp"
diff --git a/vmime/utility/childProcess.hpp b/vmime/utility/childProcess.hpp
index 637240c1..ebefcf0a 100644
--- a/vmime/utility/childProcess.hpp
+++ b/vmime/utility/childProcess.hpp
@@ -65,13 +65,13 @@ public:
*
* @return output stream wrapper for child's stdin
*/
- virtual ref <utility::outputStream> getStdIn() = 0;
+ virtual shared_ptr <utility::outputStream> getStdIn() = 0;
/** Return a wrapper to the child process standard output.
*
* @return input stream wrapper for child's stdout
*/
- virtual ref <utility::inputStream> getStdOut() = 0;
+ virtual shared_ptr <utility::inputStream> getStdOut() = 0;
/** Wait for the process to finish.
*
@@ -95,7 +95,7 @@ public:
*
* @param path full path of the process executable file
*/
- virtual ref <childProcess> create(const utility::file::path& path) const = 0;
+ virtual shared_ptr <childProcess> create(const utility::file::path& path) const = 0;
};
diff --git a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/encoderFactory.hpp
index 9324ba57..763cbd5c 100644
--- a/vmime/utility/encoder/encoderFactory.hpp
+++ b/vmime/utility/encoder/encoderFactory.hpp
@@ -46,10 +46,10 @@ private:
public:
- static encoderFactory* getInstance();
+ static shared_ptr <encoderFactory> getInstance();
/** Information about a registered encoder. */
- class registeredEncoder : public object
+ class VMIME_EXPORT registeredEncoder : public object
{
protected:
@@ -57,7 +57,7 @@ public:
public:
- virtual ref <encoder> create() const = 0;
+ virtual shared_ptr <encoder> create() const = 0;
virtual const string& getName() const = 0;
};
@@ -67,17 +67,13 @@ private:
template <class E>
class registeredEncoderImpl : public registeredEncoder
{
- friend class vmime::creator;
-
- protected:
+ public:
registeredEncoderImpl(const string& name) : m_name(name) { }
- public:
-
- ref <encoder> create() const
+ shared_ptr <encoder> create() const
{
- return vmime::create <E>();
+ return vmime::make_shared <E>();
}
const string& getName() const
@@ -91,7 +87,7 @@ private:
};
- std::vector <ref <registeredEncoder> > m_encoders;
+ std::vector <shared_ptr <registeredEncoder> > m_encoders;
public:
@@ -102,7 +98,7 @@ public:
template <class E>
void registerName(const string& name)
{
- m_encoders.push_back(vmime::create <registeredEncoderImpl <E> >(utility::stringUtils::toLower(name)));
+ m_encoders.push_back(vmime::make_shared <registeredEncoderImpl <E> >(utility::stringUtils::toLower(name)));
}
/** Create a new encoder instance from an encoding name.
@@ -112,7 +108,7 @@ public:
* @throw exceptions::no_encoder_available if no encoder is registered
* for this encoding
*/
- ref <encoder> create(const string& name);
+ shared_ptr <encoder> create(const string& name);
/** Return information about a registered encoder.
*
@@ -121,7 +117,7 @@ public:
* @throw exceptions::no_encoder_available if no encoder is registered
* for this encoding
*/
- const ref <const registeredEncoder> getEncoderByName(const string& name) const;
+ const shared_ptr <const registeredEncoder> getEncoderByName(const string& name) const;
/** Return the number of registered encoders.
*
@@ -134,13 +130,13 @@ public:
* @param pos position of the registered encoder to return
* @return registered encoder at the specified position
*/
- const ref <const registeredEncoder> getEncoderAt(const size_t pos) const;
+ const shared_ptr <const registeredEncoder> getEncoderAt(const size_t pos) const;
/** Return a list of all registered encoders.
*
* @return list of registered encoders
*/
- const std::vector <ref <const registeredEncoder> > getEncoderList() const;
+ const std::vector <shared_ptr <const registeredEncoder> > getEncoderList() const;
};
diff --git a/vmime/utility/file.hpp b/vmime/utility/file.hpp
index df7962e9..c0ba2c5b 100644
--- a/vmime/utility/file.hpp
+++ b/vmime/utility/file.hpp
@@ -61,7 +61,7 @@ public:
*
* @return next file or NULL
*/
- virtual ref <file> nextElement() = 0;
+ virtual shared_ptr <file> nextElement() = 0;
};
@@ -74,7 +74,7 @@ public:
virtual ~fileWriter() { }
- virtual ref <utility::outputStream> getOutputStream() = 0;
+ virtual shared_ptr <utility::outputStream> getOutputStream() = 0;
};
@@ -87,7 +87,7 @@ public:
virtual ~fileReader() { }
- virtual ref <utility::inputStream> getInputStream() = 0;
+ virtual shared_ptr <utility::inputStream> getInputStream() = 0;
};
@@ -165,7 +165,7 @@ public:
*
* @return parent directory (or NULL if root)
*/
- virtual ref <file> getParent() const = 0;
+ virtual shared_ptr <file> getParent() const = 0;
/** Rename the file/directory.
*
@@ -185,13 +185,13 @@ public:
*
* @return file writer object
*/
- virtual ref <fileWriter> getFileWriter() = 0;
+ virtual shared_ptr <fileWriter> getFileWriter() = 0;
/** Return an object capable of reading from this file.
*
* @return file reader object
*/
- virtual ref <fileReader> getFileReader() = 0;
+ virtual shared_ptr <fileReader> getFileReader() = 0;
/** Enumerate files contained in this directory.
*
@@ -199,7 +199,7 @@ public:
* @throw exceptions::not_a_directory if this is not a directory,
* exceptions::filesystem_exception if another error occurs
*/
- virtual ref <fileIterator> getFiles() const = 0;
+ virtual shared_ptr <fileIterator> getFiles() const = 0;
protected:
@@ -225,7 +225,7 @@ public:
* @param path full path (absolute) of the file
* @return new file object for the path
*/
- virtual ref <file> create(const file::path& path) const = 0;
+ virtual shared_ptr <file> create(const file::path& path) const = 0;
/** Parse a path contained in a string.
*
diff --git a/vmime/utility/parserInputStreamAdapter.hpp b/vmime/utility/parserInputStreamAdapter.hpp
index 00d38279..16ed6f68 100644
--- a/vmime/utility/parserInputStreamAdapter.hpp
+++ b/vmime/utility/parserInputStreamAdapter.hpp
@@ -43,9 +43,9 @@ public:
/** @param stream input stream to wrap
*/
- parserInputStreamAdapter(ref <seekableInputStream> stream);
+ parserInputStreamAdapter(shared_ptr <seekableInputStream> stream);
- ref <seekableInputStream> getUnderlyingStream();
+ shared_ptr <seekableInputStream> getUnderlyingStream();
bool eof() const;
void reset();
@@ -161,7 +161,7 @@ public:
private:
- mutable ref <seekableInputStream> m_stream;
+ mutable shared_ptr <seekableInputStream> m_stream;
};
diff --git a/vmime/utility/seekableInputStreamRegionAdapter.hpp b/vmime/utility/seekableInputStreamRegionAdapter.hpp
index 8947dfc8..ce73b456 100644
--- a/vmime/utility/seekableInputStreamRegionAdapter.hpp
+++ b/vmime/utility/seekableInputStreamRegionAdapter.hpp
@@ -45,7 +45,7 @@ public:
* @param begin start position in source stream
* @param length region length in source stream
*/
- seekableInputStreamRegionAdapter(ref <seekableInputStream> stream,
+ seekableInputStreamRegionAdapter(shared_ptr <seekableInputStream> stream,
const size_type begin, const size_type length);
bool eof() const;
@@ -57,7 +57,7 @@ public:
private:
- ref <seekableInputStream> m_stream;
+ shared_ptr <seekableInputStream> m_stream;
size_type m_begin;
size_type m_length;
size_type m_position;
diff --git a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp
deleted file mode 100644
index 791dbc7f..00000000
--- a/vmime/utility/smartPtr.hpp
+++ /dev/null
@@ -1,550 +0,0 @@
-//
-// VMime library (http://www.vmime.org)
-// Copyright (C) 2002-2013 Vincent Richard <[email protected]>
-//
-// 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 3 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.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// Linking this library statically or dynamically with other modules is making
-// a combined work based on this library. Thus, the terms and conditions of
-// the GNU General Public License cover the whole combination.
-//
-
-#ifndef VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
-#define VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
-
-
-#include <map>
-
-#include "vmime/config.hpp"
-
-
-// Forward reference to 'object'
-namespace vmime { class object; }
-
-
-namespace vmime {
-namespace utility {
-
-
-/** Simple auto-delete pointer.
- */
-
-template <class T>
-class VMIME_EXPORT auto_ptr
-{
-private:
-
- T* const m_ptr;
-
-public:
-
- auto_ptr(T* const ptr) : m_ptr(ptr) { }
- ~auto_ptr() { delete (m_ptr); }
-
- operator T*() { return (m_ptr); }
-
- T* operator ->() { return (m_ptr); }
- T& operator *() { return (*m_ptr); }
-};
-
-
-/** Manage the life cycle of an object.
- */
-
-class VMIME_EXPORT refManager
-{
-protected:
-
- refManager() {}
-
-public:
-
- virtual ~refManager() {}
-
- /** Create a ref manager for the specified object.
- *
- * @return a new manager
- */
- static refManager* create(object* obj);
-
- /** Add a strong reference to the managed object.
- */
- virtual bool addStrong() = 0;
-
- /** Release a strong reference to the managed object.
- * If it is the last reference, the object is destroyed.
- */
- virtual void releaseStrong() = 0;
-
- /** Add a weak reference to the managed object.
- */
- virtual void addWeak() = 0;
-
- /** Release a weak reference to the managed object.
- * If it is the last weak reference, the manager is destroyed.
- */
- virtual void releaseWeak() = 0;
-
- /** Return a raw pointer to the managed object.
- *
- * @return pointer to the managed object
- */
- virtual object* getObject() = 0;
-
- /** Return the number of strong refs to this object.
- * For debugging purposes only.
- *
- * @return strong reference count
- */
- virtual long getStrongRefCount() const = 0;
-
- /** Return the number of weak refs to this object.
- * For debugging purposes only.
- *
- * @return weak reference count
- */
- virtual long getWeakRefCount() const = 0;
-
-protected:
-
- void deleteObjectImpl(object* obj);
-};
-
-
-/** Null reference.
- */
-
-class VMIME_EXPORT null_ref
-{
-};
-
-
-template <class T>
-class weak_ref;
-
-
-/** Shared ownership (strong reference to an object).
- */
-
-template <class T>
-class VMIME_EXPORT ref
-{
-public:
-
- template <class U> friend class ref;
- template <class U> friend class weak_ref;
-
-
- ref() : m_ptr(0) { }
- ref(const ref& r) : m_ptr(0) { attach(r); }
- ref(const null_ref&) : m_ptr(0) { }
-
- virtual ~ref() throw() { detach(); }
-
- // Allow creating NULL ref (NULL casts to anything*)
- ref(class null_pointer*) : m_ptr(0) { }
-
-
- // Access to wrapped object
-// operator const T*() const { return m_ptr; }
- operator const void*() const { return m_ptr; }
-
- T& operator *() { return *m_ptr; }
- const T& operator *() const { return *m_ptr; }
-
- T* operator ->() { return m_ptr; }
- const T* operator ->() const { return m_ptr; }
-
- const T* get() const { return m_ptr; }
- T* get() { return m_ptr; }
-
-
- // dynamic_cast
- template <class U>
- ref <U> dynamicCast() const
- {
- U* p = dynamic_cast <U*>(const_cast <T*>(m_ptr));
- if (!p) return ref <U>();
-
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
- return ref <U>::fromPtrImpl(p);
- }
-
- // static_cast
- template <class U>
- ref <U> staticCast() const
- {
- U* p = static_cast <U*>(const_cast <T*>(m_ptr));
- if (!p) return ref <U>();
-
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
- return ref <U>::fromPtrImpl(p);
- }
-
- // const_cast
- template <class U>
- ref <U> constCast() const
- {
- U* p = const_cast <U*>(m_ptr);
- if (!p) return ref <U>();
-
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
- return ref <U>::fromPtrImpl(p);
- }
-
- // Implicit downcast
- template <class U>
- operator ref <const U>() const
- {
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
- ref <const U> r;
- r.m_ptr = m_ptr; // will type check at compile-time (prevent from implicit upcast)
-
- return r;
- }
-
- template <class U>
- operator ref <U>()
- {
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
- ref <U> r;
- r.m_ptr = m_ptr; // will type check at compile-time (prevent from implicit upcast)
-
- return r;
- }
-
- template <class U>
- ref <T>& operator=(const ref <U>& other)
- {
- U* ptr = other.m_ptr; // will type check at compile-time (prevent from implicit upcast)
-
- if (ptr)
- ptr->getRefManager()->addStrong();
-
- detach();
-
- m_ptr = ptr;
-
- return *this;
- }
-
- // Implicit non-const => const conversion
- operator ref <const T>() const
- {
- if (m_ptr)
- m_ptr->getRefManager()->addStrong();
-
-#if defined(_MSC_VER) // VC++ compiler bug (stack overflow)
- ref <const T> r;
- r.m_ptr = m_ptr;
- return r;
-#else
- return ref <const T>::fromPtrImpl(m_ptr);
-#endif // defined(_MSC_VER)
-
- }
-
- // Copy
- ref& operator=(const ref& p)
- {
- attach(p);
- return *this;
- }
-
- // NULL-pointer comparison
- bool operator==(const class null_pointer*) const { return m_ptr == 0; }
- bool operator!=(const class null_pointer*) const { return m_ptr != 0; }
-
- bool operator==(const null_ref&) const { return m_ptr == 0; }
- bool operator!=(const null_ref&) const { return m_ptr != 0; }
-
- /** Create a ref<> from a raw pointer.
- *
- * WARNING: you should use this function only if you know what
- * you are doing. In general, you should create ref objects using
- * vmime::create().
- *
- * When this function returns, the pointer is owned by the ref,
- * you should not attempt to delete it manually.
- *
- * @param ptr raw pointer to encapsulate
- * @return a ref which encapsulates the specified raw pointer
- */
- static ref <T> fromPtr(T* const ptr)
- {
- return ref <T>::fromPtrImpl(ptr);
- }
-
- static ref <const T> fromPtrConst(const T* const ptr)
- {
- return ref <const T>::fromPtrImpl(ptr);
- }
-
- static ref <T> fromWeak(weak_ref <T> wr)
- {
- refManager* mgr = wr.getManager();
-
- if (mgr && mgr->addStrong())
- return ref <T>::fromPtrImpl(dynamic_cast <T*>(mgr->getObject()));
- else
- return ref <T>();
- }
-
- static ref <const T> fromWeakConst(weak_ref <const T> wr)
- {
- refManager* mgr = wr.getManager();
-
- if (mgr && mgr->addStrong())
- return ref <const T>::fromPtrImpl(dynamic_cast <const T*>(mgr->getObject()));
- else
- return ref <const T>();
- }
-
-protected:
-
- template <class U>
- static ref <U> fromPtrImpl(U* ptr)
- {
- ref <U> r;
- r.m_ptr = ptr;
-
- return r;
- }
-
- void detach()
- {
- if (m_ptr)
- {
- if (m_ptr->getRefManager())
- m_ptr->getRefManager()->releaseStrong();
-
- m_ptr = 0;
- }
- }
-
- template <class U>
- void attach(U* const ptr)
- {
- if (ptr)
- ptr->getRefManager()->addStrong();
-
- detach();
-
- m_ptr = ptr;
- }
-
- template <class U>
- void attach(const ref <U>& r)
- {
- if (r.m_ptr)
- r.m_ptr->getRefManager()->addStrong();
-
- detach();
-
- m_ptr = r.m_ptr;
- }
-
-private:
-
- T* m_ptr;
-};
-
-
-
-template <class T, class U>
-bool operator==(const ref <T>& a, const ref <U>& b)
-{
- return (a.get() == b.get());
-}
-
-template <class T, class U>
-bool operator!=(const ref <T>& a, const ref <U>& b)
-{
- return (a.get() != b.get());
-}
-
-template <class T>
-bool operator==(const ref <T>& a, T* const p)
-{
- return (a.get() == p);
-}
-
-template <class T>
-bool operator!=(const ref <T>& a, T* const p)
-{
- return (a.get() != p);
-}
-
-template <class T>
-bool operator==(T* const p, const ref <T>& a)
-{
- return (a.get() == p);
-}
-
-template <class T>
-bool operator!=(T* const p, const ref <T>& a)
-{
- return (a.get() != p);
-}
-
-template <class T>
-bool operator==(const null_ref&, const ref <T>& r)
-{
- return (r.get() == 0);
-}
-
-template <class T>
-bool operator!=(const null_ref&, const ref <T>& r)
-{
- return (r.get() != 0);
-}
-
-
-
-/** Weak reference.
- * Avoid circular references.
- */
-
-template <class T>
-class VMIME_EXPORT weak_ref
-{
-public:
-
- template <class U> friend class weak_ref;
-
-
- weak_ref() : m_mgr(0) { }
- weak_ref(const ref <T>& r) : m_mgr(0) { attach(r); }
- weak_ref(const weak_ref& r) : m_mgr(0) { attach(r); }
- weak_ref(const null_ref&) : m_mgr(0) { }
- weak_ref(class null_pointer*) : m_mgr(0) { }
-
- ~weak_ref() { detach(); }
-
- /** Return the manager for the object.
- *
- * @return pointer to the object which manages the object
- * or NULL if the weak reference points to nothing
- */
- refManager* getManager()
- {
- return m_mgr;
- }
-
- /** Try to acquire a strong reference to the object (const version).
- *
- * @return strong reference or null reference if the
- * object is not available anymore
- */
- ref <const T> acquire() const
- {
- return ref <const T>::fromWeakConst(*this);
- }
-
- /** Try to acquire a strong reference to the object.
- *
- * @return strong reference or null reference if the
- * object is not available anymore
- */
- ref <T> acquire()
- {
- return ref <T>::fromWeak(*this);
- }
-
- // Implicit non-const => const conversion
- operator weak_ref <const T>() const
- {
- if (m_mgr)
- m_mgr->addWeak();
-
- weak_ref <const T> r;
- r.m_mgr = m_mgr;
-
- return r;
- }
-
- template <class U>
- operator weak_ref <const U>() const
- {
- if (m_mgr)
- m_mgr->addWeak();
-
- weak_ref <const U> r;
- r.m_mgr = m_mgr;
-
- return r;
- }
-
- // Copy
- weak_ref& operator=(const weak_ref& p)
- {
- attach(p);
- return *this;
- }
-
-private:
-
- void detach()
- {
- if (m_mgr)
- {
- m_mgr->releaseWeak();
- m_mgr = 0;
- }
- }
-
- void attach(const ref <T>& r)
- {
- if (r.m_ptr)
- r.m_ptr->getRefManager()->addWeak();
-
- detach();
-
- if (r.m_ptr)
- m_mgr = r.m_ptr->getRefManager();
- else
- m_mgr = 0;
- }
-
- void attach(const weak_ref& r)
- {
- if (r.m_mgr)
- r.m_mgr->addWeak();
-
- detach();
-
- m_mgr = r.m_mgr;
- }
-
-
- refManager* m_mgr;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_SMARTPTR_HPP_INCLUDED
diff --git a/vmime/utility/smartPtrInt.hpp b/vmime/utility/smartPtrInt.hpp
deleted file mode 100644
index 36c4ff01..00000000
--- a/vmime/utility/smartPtrInt.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// VMime library (http://www.vmime.org)
-// Copyright (C) 2002-2013 Vincent Richard <[email protected]>
-//
-// 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 3 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.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// Linking this library statically or dynamically with other modules is making
-// a combined work based on this library. Thus, the terms and conditions of
-// the GNU General Public License cover the whole combination.
-//
-
-#ifndef VMIME_UTILITY_SMARTPTRIMPL_HPP_INCLUDED
-#define VMIME_UTILITY_SMARTPTRIMPL_HPP_INCLUDED
-
-
-#include "vmime/config.hpp"
-#include "vmime/utility/smartPtr.hpp"
-
-#if defined(_WIN32)
-# include <windows.h>
-#elif defined(VMIME_HAVE_PTHREAD)
-# include <pthread.h>
-#endif
-
-
-namespace vmime {
-namespace utility {
-
-
-/** Reference counter for shared pointers.
- */
-
-class refCounter
-{
-public:
-
- refCounter(const long initialValue);
- ~refCounter();
-
- long increment();
- long decrement();
-
- operator long() const;
-
-private:
-
-#if defined(_WIN32)
- long m_value;
-#elif defined(__GNUC__) && (defined(__GLIBCPP__) || defined(__GLIBCXX__))
- mutable volatile int m_value;
-#elif defined (VMIME_HAVE_PTHREAD)
- volatile long m_value;
- pthread_mutex_t m_mutex;
-#else // not thread-safe implementation
- long m_value;
-#endif
-
-};
-
-
-/** Separate implementation of refManager, to avoid polluting global
- * namespace with system-specific inclusions/definitions.
- */
-
-class refManagerImpl : public refManager
-{
-public:
-
- refManagerImpl(object* obj);
- ~refManagerImpl();
-
- bool addStrong();
- void releaseStrong();
-
- void addWeak();
- void releaseWeak();
-
- object* getObject();
-
- long getStrongRefCount() const;
- long getWeakRefCount() const;
-
-private:
-
- void deleteManager();
- void deleteObject();
-
-
- object* m_object;
-
- refCounter m_strongCount;
- refCounter m_weakCount;
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_SMARTPTRIMPL_HPP_INCLUDED
-
diff --git a/vmime/utility/sync/autoLock.hpp b/vmime/utility/sync/autoLock.hpp
index 3f1231b7..c058429d 100644
--- a/vmime/utility/sync/autoLock.hpp
+++ b/vmime/utility/sync/autoLock.hpp
@@ -41,7 +41,7 @@ class VMIME_EXPORT autoLock : public object
{
public:
- autoLock(ref <M> mutex)
+ autoLock(shared_ptr <M> mutex)
: m_mutex(mutex)
{
m_mutex->lock();
@@ -54,7 +54,7 @@ public:
private:
- ref <M> m_mutex;
+ shared_ptr <M> m_mutex;
};
diff --git a/vmime/word.hpp b/vmime/word.hpp
index d460ccad..29d2969c 100644
--- a/vmime/word.hpp
+++ b/vmime/word.hpp
@@ -111,7 +111,7 @@ public:
*
* @return a copy of this word
*/
- ref <component> clone() const;
+ shared_ptr <component> clone() const;
#ifndef VMIME_BUILDING_DOC
@@ -160,11 +160,11 @@ public:
generatorState* state) const;
#endif
- const std::vector <ref <component> > getChildComponents();
+ const std::vector <shared_ptr <component> > getChildComponents();
private:
- static ref <word> parseNext
+ static shared_ptr <word> parseNext
(const parsingContext& ctx,
const string& buffer,
const string::size_type position,
@@ -174,7 +174,7 @@ private:
bool* isEncoded,
bool isFirst);
- static const std::vector <ref <word> > parseMultiple
+ static const std::vector <shared_ptr <word> > parseMultiple
(const parsingContext& ctx,
const string& buffer,
const string::size_type position,
diff --git a/vmime/wordEncoder.hpp b/vmime/wordEncoder.hpp
index b2003ac7..557578fa 100644
--- a/vmime/wordEncoder.hpp
+++ b/vmime/wordEncoder.hpp
@@ -101,7 +101,7 @@ private:
charset m_charset;
Encoding m_encoding;
- ref <utility::encoder::encoder> m_encoder;
+ shared_ptr <utility::encoder::encoder> m_encoder;
};