Content handler constness.

This commit is contained in:
Vincent Richard 2005-08-17 14:17:18 +00:00
parent bd925cef1c
commit 8de88d9e37
5 changed files with 14 additions and 14 deletions

View File

@ -417,7 +417,7 @@ static void connectStore()
case 3: case 3:
f->fetchMessage(msg, vmime::messaging::folder::FETCH_FULL_HEADER); f->fetchMessage(msg, vmime::messaging::folder::FETCH_FULL_HEADER);
std::cout << msg->getHeader().generate() << std::endl; std::cout << msg->getHeader()->generate() << std::endl;
break; break;
// Show message envelope // Show message envelope
@ -426,7 +426,7 @@ static void connectStore()
f->fetchMessage(msg, vmime::messaging::folder::FETCH_ENVELOPE); f->fetchMessage(msg, vmime::messaging::folder::FETCH_ENVELOPE);
#define ENV_HELPER(x) \ #define ENV_HELPER(x) \
try { std::cout << msg->getHeader().x()->generate() << std::endl; } \ try { std::cout << msg->getHeader()->x()->generate() << std::endl; } \
catch (vmime::exception) { /* In case the header field does not exist. */ } catch (vmime::exception) { /* In case the header field does not exist. */ }
ENV_HELPER(From) ENV_HELPER(From)

View File

@ -515,7 +515,7 @@ const ref <const contentHandler> body::getContents() const
} }
void body::setContents(ref <contentHandler> contents) void body::setContents(ref <const contentHandler> contents)
{ {
m_contents = contents; m_contents = contents;
} }

View File

@ -30,14 +30,14 @@ defaultAttachment::defaultAttachment()
} }
defaultAttachment::defaultAttachment(ref <contentHandler> data, defaultAttachment::defaultAttachment(ref <const contentHandler> data,
const encoding& enc, const mediaType& type, const text& desc, const word& name) const encoding& enc, const mediaType& type, const text& desc, const word& name)
: m_type(type), m_desc(desc), m_data(data), m_encoding(enc), m_name(name) : m_type(type), m_desc(desc), m_data(data), m_encoding(enc), m_name(name)
{ {
} }
defaultAttachment::defaultAttachment(ref <contentHandler> data, defaultAttachment::defaultAttachment(ref <const contentHandler> data,
const mediaType& type, const text& desc, const word& name) const mediaType& type, const text& desc, const word& name)
: m_type(type), m_desc(desc), m_data(data), : m_type(type), m_desc(desc), m_data(data),
m_encoding(encoding::decide(data)), m_name(name) m_encoding(encoding::decide(data)), m_name(name)

View File

@ -178,7 +178,7 @@ public:
* *
* @param contents new body contents * @param contents new body contents
*/ */
void setContents(ref <contentHandler> contents); void setContents(ref <const contentHandler> contents);
/** Return the media type of the data contained in the body contents. /** Return the media type of the data contained in the body contents.
* This is a shortcut for getHeader()->ContentType()->getValue() * This is a shortcut for getHeader()->ContentType()->getValue()
@ -231,7 +231,7 @@ private:
string m_prologText; string m_prologText;
string m_epilogText; string m_epilogText;
ref <contentHandler> m_contents; ref <const contentHandler> m_contents;
weak_ref <bodyPart> m_part; weak_ref <bodyPart> m_part;
weak_ref <header> m_header; weak_ref <header> m_header;

View File

@ -41,8 +41,8 @@ protected:
public: public:
defaultAttachment(ref <contentHandler> data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD); defaultAttachment(ref <const contentHandler> data, const encoding& enc, const mediaType& type, const text& desc = NULL_TEXT, const word& name = NULL_WORD);
defaultAttachment(ref <contentHandler> data, 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(const defaultAttachment& attach); defaultAttachment(const defaultAttachment& attach);
~defaultAttachment(); ~defaultAttachment();
@ -57,11 +57,11 @@ public:
protected: protected:
mediaType m_type; // Media type (eg. "application/octet-stream") mediaType m_type; /**< Media type (eg. "application/octet-stream") */
text m_desc; // Description (eg. "The image you requested") text m_desc; /**< Description (eg. "The image you requested") */
ref <contentHandler> m_data; // Attachment data (eg. the file contents) ref <const contentHandler> m_data; /**< Attachment data (eg. the file contents) */
encoding m_encoding; // Encoding encoding m_encoding; /**< Encoding */
word m_name; // Name/filename (eg. "sunset.jpg") word m_name; /**< Name/filename (eg. "sunset.jpg") */
private: private: