2004-10-05 10:28:21 +00:00
|
|
|
//
|
2005-03-18 21:33:11 +00:00
|
|
|
// VMime library (http://www.vmime.org)
|
2009-09-06 12:02:10 +00:00
|
|
|
// Copyright (C) 2002-2009 Vincent Richard <vincent@vincent-richard.net>
|
2004-10-05 10:28:21 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
2009-09-06 12:02:10 +00:00
|
|
|
// published by the Free Software Foundation; either version 3 of
|
2004-10-05 10:28:21 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2005-09-17 10:10:29 +00:00
|
|
|
// 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.
|
2004-10-05 10:28:21 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef VMIME_ATTACHMENT_HPP_INCLUDED
|
|
|
|
#define VMIME_ATTACHMENT_HPP_INCLUDED
|
|
|
|
|
|
|
|
|
2004-12-26 20:23:29 +00:00
|
|
|
#include "vmime/base.hpp"
|
2004-10-05 10:28:21 +00:00
|
|
|
|
2004-12-26 20:23:29 +00:00
|
|
|
#include "vmime/bodyPart.hpp"
|
|
|
|
#include "vmime/mediaType.hpp"
|
|
|
|
#include "vmime/text.hpp"
|
|
|
|
#include "vmime/contentHandler.hpp"
|
|
|
|
#include "vmime/encoding.hpp"
|
2004-10-05 10:28:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace vmime
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2004-12-22 14:55:43 +00:00
|
|
|
/** Base class for all types of attachment.
|
|
|
|
*/
|
|
|
|
|
2005-07-12 22:28:02 +00:00
|
|
|
class attachment : public object
|
2004-10-05 10:28:21 +00:00
|
|
|
{
|
|
|
|
friend class messageBuilder;
|
|
|
|
friend class messageParser;
|
2005-10-13 21:27:46 +00:00
|
|
|
friend class attachmentHelper;
|
2004-10-05 10:28:21 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
attachment() { }
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual ~attachment() { }
|
|
|
|
|
|
|
|
/** Return the media type of this attachment.
|
2005-10-13 18:50:00 +00:00
|
|
|
*
|
2004-10-05 10:28:21 +00:00
|
|
|
* @return content type of the attachment
|
|
|
|
*/
|
2005-10-13 18:50:00 +00:00
|
|
|
virtual const mediaType getType() const = 0;
|
2004-10-05 10:28:21 +00:00
|
|
|
|
|
|
|
/** Return the description of this attachment.
|
2005-10-13 18:50:00 +00:00
|
|
|
*
|
|
|
|
* @return attachment description, or an empty text
|
|
|
|
* if no description is available
|
2004-10-05 10:28:21 +00:00
|
|
|
*/
|
2005-10-13 18:50:00 +00:00
|
|
|
virtual const text getDescription() const = 0;
|
2004-10-05 10:28:21 +00:00
|
|
|
|
2005-10-13 18:50:00 +00:00
|
|
|
/** Return the (file) name of this attachment.
|
|
|
|
*
|
|
|
|
* @return attachment name, or an empty word if no
|
|
|
|
* name is available
|
2005-07-15 09:51:55 +00:00
|
|
|
*/
|
2005-10-13 18:50:00 +00:00
|
|
|
virtual const word getName() const = 0;
|
2005-07-15 09:51:55 +00:00
|
|
|
|
2004-10-05 10:28:21 +00:00
|
|
|
/** Return the data contained in this attachment.
|
2005-10-13 18:50:00 +00:00
|
|
|
*
|
2004-10-05 10:28:21 +00:00
|
|
|
* @return attachment data
|
|
|
|
*/
|
2005-07-12 22:28:02 +00:00
|
|
|
virtual const ref <const contentHandler> getData() const = 0;
|
2004-10-05 10:28:21 +00:00
|
|
|
|
|
|
|
/** Return the encoding used for this attachment.
|
2005-10-13 18:50:00 +00:00
|
|
|
*
|
2004-10-05 10:28:21 +00:00
|
|
|
* @return attachment data encoding
|
|
|
|
*/
|
2005-10-13 18:50:00 +00:00
|
|
|
virtual const encoding getEncoding() const = 0;
|
|
|
|
|
2005-10-13 18:58:33 +00:00
|
|
|
/** Return the part in which the attachment has been found.
|
|
|
|
* This can be a vmime::bodyPart or a vmime::net::part object.
|
|
|
|
*
|
|
|
|
* @return attachment part or NULL if the attachment is not
|
|
|
|
* attached to a part
|
|
|
|
*/
|
|
|
|
virtual ref <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;
|
|
|
|
|
2005-10-13 18:50:00 +00:00
|
|
|
protected:
|
2004-10-05 10:28:21 +00:00
|
|
|
|
|
|
|
/** Generate the attachment in the specified body part.
|
2005-10-13 18:50:00 +00:00
|
|
|
*
|
2004-10-05 10:28:21 +00:00
|
|
|
* @param parent body part in which to generate the attachment
|
|
|
|
*/
|
2006-07-14 08:28:35 +00:00
|
|
|
virtual void generateIn(ref <bodyPart> parent) const = 0;
|
2004-10-05 10:28:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // vmime
|
|
|
|
|
|
|
|
|
|
|
|
#endif // VMIME_ATTACHMENT_HPP_INCLUDED
|