Updated code to use smart pointers.
This commit is contained in:
parent
2dd861c907
commit
df140bb13e
@ -108,21 +108,21 @@ static std::ostream& operator<<(std::ostream& os, const vmime::exception& e)
|
|||||||
* @param s structure object
|
* @param s structure object
|
||||||
* @param level current depth
|
* @param level current depth
|
||||||
*/
|
*/
|
||||||
static void printStructure(const vmime::net::structure& s, const int level = 0)
|
static void printStructure(vmime::ref <const vmime::net::structure> s, const int level = 0)
|
||||||
{
|
{
|
||||||
for (int i = 1 ; i <= s.getCount() ; ++i)
|
for (int i = 0 ; i < s->getPartCount() ; ++i)
|
||||||
{
|
{
|
||||||
const vmime::net::part& part = s[i];
|
vmime::ref <const vmime::net::part> part = s->getPartAt(i);
|
||||||
|
|
||||||
for (int j = 0 ; j < level * 2 ; ++j)
|
for (int j = 0 ; j < level * 2 ; ++j)
|
||||||
std::cout << " ";
|
std::cout << " ";
|
||||||
|
|
||||||
std::cout << part.getNumber() << ". "
|
std::cout << (part->getNumber() + 1) << ". "
|
||||||
<< part.getType().generate()
|
<< part->getType().generate()
|
||||||
<< " [" << part.getSize() << " byte(s)]"
|
<< " [" << part->getSize() << " byte(s)]"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
printStructure(part.getStructure(), level + 1);
|
printStructure(part->getStructure(), level + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const structure& getStructure() const;
|
ref <const structure> getStructure() const;
|
||||||
structure& getStructure();
|
ref <structure> getStructure();
|
||||||
|
|
||||||
weak_ref <const IMAPpart> getParent() const { return (m_parent); }
|
weak_ref <const IMAPpart> getParent() const { return (m_parent); }
|
||||||
|
|
||||||
@ -59,12 +59,12 @@ public:
|
|||||||
const int getSize() const { return (m_size); }
|
const int getSize() const { return (m_size); }
|
||||||
const int getNumber() const { return (m_number); }
|
const int getNumber() const { return (m_number); }
|
||||||
|
|
||||||
const header& getHeader() const
|
ref <const header> getHeader() const
|
||||||
{
|
{
|
||||||
if (m_header == NULL)
|
if (m_header == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
else
|
else
|
||||||
return (*m_header);
|
return m_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,22 +112,20 @@ private:
|
|||||||
|
|
||||||
class IMAPstructure : public structure
|
class IMAPstructure : public structure
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
|
||||||
IMAPstructure()
|
IMAPstructure()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
IMAPstructure(const IMAPParser::body* body)
|
IMAPstructure(const IMAPParser::body* body)
|
||||||
{
|
{
|
||||||
m_parts.push_back(IMAPpart::create(NULL, 1, body));
|
m_parts.push_back(IMAPpart::create(NULL, 0, body));
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAPstructure(ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
|
IMAPstructure(ref <IMAPpart> parent, const std::vector <IMAPParser::body*>& list)
|
||||||
{
|
{
|
||||||
int number = 1;
|
int number = 0;
|
||||||
|
|
||||||
for (std::vector <IMAPParser::body*>::const_iterator
|
for (std::vector <IMAPParser::body*>::const_iterator
|
||||||
it = list.begin() ; it != list.end() ; ++it, ++number)
|
it = list.begin() ; it != list.end() ; ++it, ++number)
|
||||||
@ -137,36 +135,36 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const part& operator[](const int x) const
|
ref <const part> getPartAt(const int x) const
|
||||||
{
|
{
|
||||||
return (*m_parts[x - 1]);
|
return m_parts[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
part& operator[](const int x)
|
ref <part> getPartAt(const int x)
|
||||||
{
|
{
|
||||||
return (*m_parts[x - 1]);
|
return m_parts[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int getCount() const
|
const int getPartCount() const
|
||||||
{
|
{
|
||||||
return (m_parts.size());
|
return m_parts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static IMAPstructure* emptyStructure()
|
static ref <IMAPstructure> emptyStructure()
|
||||||
{
|
{
|
||||||
return (&m_emptyStructure);
|
return (m_emptyStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static IMAPstructure m_emptyStructure;
|
static ref <IMAPstructure> m_emptyStructure;
|
||||||
|
|
||||||
std::vector <ref <IMAPpart> > m_parts;
|
std::vector <ref <IMAPpart> > m_parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IMAPstructure IMAPstructure::m_emptyStructure;
|
ref <IMAPstructure> IMAPstructure::m_emptyStructure = vmime::create <IMAPstructure>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -208,21 +206,21 @@ IMAPpart::IMAPpart(ref <IMAPpart> parent, const int number, const IMAPParser::bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const class structure& IMAPpart::getStructure() const
|
ref <const structure> IMAPpart::getStructure() const
|
||||||
{
|
{
|
||||||
if (m_structure != NULL)
|
if (m_structure != NULL)
|
||||||
return (*m_structure);
|
return (m_structure);
|
||||||
else
|
else
|
||||||
return (*IMAPstructure::emptyStructure());
|
return (IMAPstructure::emptyStructure());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class structure& IMAPpart::getStructure()
|
ref <structure> IMAPpart::getStructure()
|
||||||
{
|
{
|
||||||
if (m_structure != NULL)
|
if (m_structure != NULL)
|
||||||
return (*m_structure);
|
return (m_structure);
|
||||||
else
|
else
|
||||||
return (*IMAPstructure::emptyStructure());
|
return (IMAPstructure::emptyStructure());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,21 +329,21 @@ const int IMAPMessage::getFlags() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const structure& IMAPMessage::getStructure() const
|
ref <const structure> IMAPMessage::getStructure() const
|
||||||
{
|
{
|
||||||
if (m_structure == NULL)
|
if (m_structure == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
|
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
structure& IMAPMessage::getStructure()
|
ref <structure> IMAPMessage::getStructure()
|
||||||
{
|
{
|
||||||
if (m_structure == NULL)
|
if (m_structure == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
|
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -369,17 +367,17 @@ void IMAPMessage::extract(utility::outputStream& os, utility::progressionListene
|
|||||||
|
|
||||||
|
|
||||||
void IMAPMessage::extractPart
|
void IMAPMessage::extractPart
|
||||||
(const part& p, utility::outputStream& os, utility::progressionListener* progress,
|
(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress,
|
||||||
const int start, const int length, const bool peek) const
|
const int start, const int length, const bool peek) const
|
||||||
{
|
{
|
||||||
if (!m_folder)
|
if (!m_folder)
|
||||||
throw exceptions::folder_not_found();
|
throw exceptions::folder_not_found();
|
||||||
|
|
||||||
extract(&p, os, progress, start, length, false, peek);
|
extract(p, os, progress, start, length, false, peek);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IMAPMessage::fetchPartHeader(part& p)
|
void IMAPMessage::fetchPartHeader(ref <part> p)
|
||||||
{
|
{
|
||||||
if (!m_folder)
|
if (!m_folder)
|
||||||
throw exceptions::folder_not_found();
|
throw exceptions::folder_not_found();
|
||||||
@ -387,13 +385,13 @@ void IMAPMessage::fetchPartHeader(part& p)
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
utility::outputStreamAdapter ossAdapter(oss);
|
utility::outputStreamAdapter ossAdapter(oss);
|
||||||
|
|
||||||
extract(&p, ossAdapter, NULL, 0, -1, true, true);
|
extract(p, ossAdapter, NULL, 0, -1, true, true);
|
||||||
|
|
||||||
static_cast <IMAPpart&>(p).getOrCreateHeader().parse(oss.str());
|
p.dynamicCast <IMAPpart>()->getOrCreateHeader().parse(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IMAPMessage::extract(const part* p, utility::outputStream& os,
|
void IMAPMessage::extract(ref <const part> p, utility::outputStream& os,
|
||||||
utility::progressionListener* progress, const int start,
|
utility::progressionListener* progress, const int start,
|
||||||
const int length, const bool headerOnly, const bool peek) const
|
const int length, const bool headerOnly, const bool peek) const
|
||||||
{
|
{
|
||||||
@ -404,7 +402,7 @@ void IMAPMessage::extract(const part* p, utility::outputStream& os,
|
|||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
weak_ref <const IMAPpart> currentPart = static_cast <const IMAPpart*>(p);
|
weak_ref <const IMAPpart> currentPart = p.dynamicCast <const IMAPpart>();
|
||||||
std::vector <int> numbers;
|
std::vector <int> numbers;
|
||||||
|
|
||||||
numbers.push_back(currentPart->getNumber());
|
numbers.push_back(currentPart->getNumber());
|
||||||
@ -421,7 +419,7 @@ void IMAPMessage::extract(const part* p, utility::outputStream& os,
|
|||||||
for (std::vector <int>::reverse_iterator it = numbers.rbegin() ; it != numbers.rend() ; ++it)
|
for (std::vector <int>::reverse_iterator it = numbers.rbegin() ; it != numbers.rend() ; ++it)
|
||||||
{
|
{
|
||||||
if (it != numbers.rbegin()) section << ".";
|
if (it != numbers.rbegin()) section << ".";
|
||||||
section << *it;
|
section << (*it + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ public:
|
|||||||
~maildirPart();
|
~maildirPart();
|
||||||
|
|
||||||
|
|
||||||
const structure& getStructure() const;
|
ref <const structure> getStructure() const;
|
||||||
structure& getStructure();
|
ref <structure> getStructure();
|
||||||
|
|
||||||
weak_ref <const maildirPart> getParent() const { return (m_parent); }
|
weak_ref <const maildirPart> getParent() const { return (m_parent); }
|
||||||
|
|
||||||
@ -56,12 +56,12 @@ public:
|
|||||||
const int getSize() const { return (m_size); }
|
const int getSize() const { return (m_size); }
|
||||||
const int getNumber() const { return (m_number); }
|
const int getNumber() const { return (m_number); }
|
||||||
|
|
||||||
const header& getHeader() const
|
ref <const header> getHeader() const
|
||||||
{
|
{
|
||||||
if (m_header == NULL)
|
if (m_header == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
else
|
else
|
||||||
return (*m_header);
|
return m_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
header& getOrCreateHeader()
|
header& getOrCreateHeader()
|
||||||
@ -103,58 +103,56 @@ private:
|
|||||||
|
|
||||||
class maildirStructure : public structure
|
class maildirStructure : public structure
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
|
||||||
maildirStructure()
|
maildirStructure()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
maildirStructure(weak_ref <maildirPart> parent, const bodyPart& part)
|
maildirStructure(weak_ref <maildirPart> parent, const bodyPart& part)
|
||||||
{
|
{
|
||||||
m_parts.push_back(vmime::create <maildirPart>(parent, 1, part));
|
m_parts.push_back(vmime::create <maildirPart>(parent, 0, part));
|
||||||
}
|
}
|
||||||
|
|
||||||
maildirStructure(weak_ref <maildirPart> parent, const std::vector <ref <const vmime::bodyPart> >& list)
|
maildirStructure(weak_ref <maildirPart> parent, const std::vector <ref <const vmime::bodyPart> >& list)
|
||||||
{
|
{
|
||||||
int number = 1;
|
int number = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0 ; i < list.size() ; ++i)
|
for (unsigned int i = 0 ; i < list.size() ; ++i)
|
||||||
m_parts.push_back(vmime::create <maildirPart>(parent, number, *list[i]));
|
m_parts.push_back(vmime::create <maildirPart>(parent, number, *list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const part& operator[](const int x) const
|
ref <const part> getPartAt(const int x) const
|
||||||
{
|
{
|
||||||
return (*m_parts[x - 1]);
|
return m_parts[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
part& operator[](const int x)
|
ref <part> getPartAt(const int x)
|
||||||
{
|
{
|
||||||
return (*m_parts[x - 1]);
|
return m_parts[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int getCount() const
|
const int getPartCount() const
|
||||||
{
|
{
|
||||||
return (m_parts.size());
|
return m_parts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static maildirStructure* emptyStructure()
|
static ref <maildirStructure> emptyStructure()
|
||||||
{
|
{
|
||||||
return (&m_emptyStructure);
|
return m_emptyStructure;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static maildirStructure m_emptyStructure;
|
static ref <maildirStructure> m_emptyStructure;
|
||||||
|
|
||||||
std::vector <ref <maildirPart> > m_parts;
|
std::vector <ref <maildirPart> > m_parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
maildirStructure maildirStructure::m_emptyStructure;
|
ref <maildirStructure> maildirStructure::m_emptyStructure = vmime::create <maildirStructure>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -187,21 +185,21 @@ maildirPart::~maildirPart()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const structure& maildirPart::getStructure() const
|
ref <const structure> maildirPart::getStructure() const
|
||||||
{
|
{
|
||||||
if (m_structure != NULL)
|
if (m_structure != NULL)
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
else
|
else
|
||||||
return (*maildirStructure::emptyStructure());
|
return maildirStructure::emptyStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
structure& maildirPart::getStructure()
|
ref <structure> maildirPart::getStructure()
|
||||||
{
|
{
|
||||||
if (m_structure != NULL)
|
if (m_structure != NULL)
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
else
|
else
|
||||||
return (*maildirStructure::emptyStructure());
|
return maildirStructure::emptyStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,21 +256,21 @@ const bool maildirMessage::isExpunged() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const structure& maildirMessage::getStructure() const
|
ref <const structure> maildirMessage::getStructure() const
|
||||||
{
|
{
|
||||||
if (m_structure == NULL)
|
if (m_structure == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
|
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
structure& maildirMessage::getStructure()
|
ref <structure> maildirMessage::getStructure()
|
||||||
{
|
{
|
||||||
if (m_structure == NULL)
|
if (m_structure == NULL)
|
||||||
throw exceptions::unfetched_object();
|
throw exceptions::unfetched_object();
|
||||||
|
|
||||||
return (*m_structure);
|
return m_structure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +309,7 @@ void maildirMessage::extract(utility::outputStream& os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void maildirMessage::extractPart(const part& p, utility::outputStream& os,
|
void maildirMessage::extractPart(ref <const part> p, utility::outputStream& os,
|
||||||
utility::progressionListener* progress, const int start,
|
utility::progressionListener* progress, const int start,
|
||||||
const int length, const bool peek) const
|
const int length, const bool peek) const
|
||||||
{
|
{
|
||||||
@ -367,9 +365,9 @@ void maildirMessage::extractImpl(utility::outputStream& os, utility::progression
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void maildirMessage::fetchPartHeader(part& p)
|
void maildirMessage::fetchPartHeader(ref <part> p)
|
||||||
{
|
{
|
||||||
maildirPart& mp = dynamic_cast <maildirPart&>(p);
|
ref <maildirPart> mp = p.dynamicCast <maildirPart>();
|
||||||
|
|
||||||
utility::fileSystemFactory* fsf = platformDependant::getHandler()->getFileSystemFactory();
|
utility::fileSystemFactory* fsf = platformDependant::getHandler()->getFileSystemFactory();
|
||||||
|
|
||||||
@ -379,10 +377,10 @@ void maildirMessage::fetchPartHeader(part& p)
|
|||||||
ref <utility::fileReader> reader = file->getFileReader();
|
ref <utility::fileReader> reader = file->getFileReader();
|
||||||
ref <utility::inputStream> is = reader->getInputStream();
|
ref <utility::inputStream> is = reader->getInputStream();
|
||||||
|
|
||||||
is->skip(mp.getHeaderParsedOffset());
|
is->skip(mp->getHeaderParsedOffset());
|
||||||
|
|
||||||
utility::stream::value_type buffer[1024];
|
utility::stream::value_type buffer[1024];
|
||||||
utility::stream::size_type remaining = mp.getHeaderParsedLength();
|
utility::stream::size_type remaining = mp->getHeaderParsedLength();
|
||||||
|
|
||||||
string contents;
|
string contents;
|
||||||
contents.reserve(remaining);
|
contents.reserve(remaining);
|
||||||
@ -397,7 +395,7 @@ void maildirMessage::fetchPartHeader(part& p)
|
|||||||
contents.append(buffer, read);
|
contents.append(buffer, read);
|
||||||
}
|
}
|
||||||
|
|
||||||
mp.getOrCreateHeader().parse(contents);
|
mp->getOrCreateHeader().parse(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,21 +24,21 @@ namespace vmime {
|
|||||||
namespace net {
|
namespace net {
|
||||||
|
|
||||||
|
|
||||||
const part& part::operator[](const int x) const
|
ref <const part> part::getPartAt(const int pos) const
|
||||||
{
|
{
|
||||||
return (getStructure()[x]);
|
return getStructure()->getPartAt(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
part& part::operator[](const int x)
|
ref <part> part::getPartAt(const int pos)
|
||||||
{
|
{
|
||||||
return (getStructure()[x]);
|
return getStructure()->getPartAt(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const int part::getCount() const
|
const int part::getPartCount() const
|
||||||
{
|
{
|
||||||
return (getStructure().getCount());
|
return getStructure()->getPartCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ const int POP3Message::getFlags() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const structure& POP3Message::getStructure() const
|
ref <const structure> POP3Message::getStructure() const
|
||||||
{
|
{
|
||||||
throw exceptions::operation_not_supported();
|
throw exceptions::operation_not_supported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
structure& POP3Message::getStructure()
|
ref <structure> POP3Message::getStructure()
|
||||||
{
|
{
|
||||||
throw exceptions::operation_not_supported();
|
throw exceptions::operation_not_supported();
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ void POP3Message::extract(utility::outputStream& os,
|
|||||||
|
|
||||||
|
|
||||||
void POP3Message::extractPart
|
void POP3Message::extractPart
|
||||||
(const part& /* p */, utility::outputStream& /* os */,
|
(ref <const part> /* p */, utility::outputStream& /* os */,
|
||||||
utility::progressionListener* /* progress */,
|
utility::progressionListener* /* progress */,
|
||||||
const int /* start */, const int /* length */,
|
const int /* start */, const int /* length */,
|
||||||
const bool /* peek */) const
|
const bool /* peek */) const
|
||||||
@ -154,7 +154,7 @@ void POP3Message::extractPart
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void POP3Message::fetchPartHeader(part& /* p */)
|
void POP3Message::fetchPartHeader(ref <part> /* p */)
|
||||||
{
|
{
|
||||||
throw exceptions::operation_not_supported();
|
throw exceptions::operation_not_supported();
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ public:
|
|||||||
|
|
||||||
const bool isExpunged() const;
|
const bool isExpunged() const;
|
||||||
|
|
||||||
const structure& getStructure() const;
|
ref <const structure> getStructure() const;
|
||||||
structure& getStructure();
|
ref <structure> getStructure();
|
||||||
|
|
||||||
ref <const header> getHeader() const;
|
ref <const header> getHeader() const;
|
||||||
|
|
||||||
@ -69,9 +69,9 @@ public:
|
|||||||
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
||||||
|
|
||||||
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
void extractPart(const part& p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extractPart(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
|
|
||||||
void fetchPartHeader(part& p);
|
void fetchPartHeader(ref <part> p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ private:
|
|||||||
|
|
||||||
void processFetchResponse(const int options, const IMAPParser::msg_att* msgAtt);
|
void processFetchResponse(const int options, const IMAPParser::msg_att* msgAtt);
|
||||||
|
|
||||||
void extract(const part* p, utility::outputStream& os, utility::progressionListener* progress, const int start, const int length, const bool headerOnly, const bool peek) const;
|
void extract(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress, const int start, const int length, const bool headerOnly, const bool peek) const;
|
||||||
|
|
||||||
|
|
||||||
void convertAddressList(const IMAPParser::address_list& src, mailboxList& dest);
|
void convertAddressList(const IMAPParser::address_list& src, mailboxList& dest);
|
||||||
|
@ -58,8 +58,8 @@ public:
|
|||||||
|
|
||||||
const bool isExpunged() const;
|
const bool isExpunged() const;
|
||||||
|
|
||||||
const structure& getStructure() const;
|
ref <const structure> getStructure() const;
|
||||||
structure& getStructure();
|
ref <structure> getStructure();
|
||||||
|
|
||||||
ref <const header> getHeader() const;
|
ref <const header> getHeader() const;
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ public:
|
|||||||
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
||||||
|
|
||||||
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
void extractPart(const part& p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extractPart(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
|
|
||||||
void fetchPartHeader(part& p);
|
void fetchPartHeader(ref <part> p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -52,20 +52,20 @@ public:
|
|||||||
*
|
*
|
||||||
* @return structure of the part
|
* @return structure of the part
|
||||||
*/
|
*/
|
||||||
virtual const structure& getStructure() const = 0;
|
virtual ref <const structure> getStructure() const = 0;
|
||||||
|
|
||||||
/** Return the structure of this part.
|
/** Return the structure of this part.
|
||||||
*
|
*
|
||||||
* @return structure of the part
|
* @return structure of the part
|
||||||
*/
|
*/
|
||||||
virtual structure& getStructure() = 0;
|
virtual ref <structure> getStructure() = 0;
|
||||||
|
|
||||||
/** Return the header section for this part (you must fetch header
|
/** Return the header section for this part (you must fetch header
|
||||||
* before using this function: see message::fetchPartHeader).
|
* before using this function: see message::fetchPartHeader).
|
||||||
*
|
*
|
||||||
* @return header section
|
* @return header section
|
||||||
*/
|
*/
|
||||||
virtual const header& getHeader() const = 0;
|
virtual ref <const header> getHeader() const = 0;
|
||||||
|
|
||||||
/** Return the media-type of the content in this part.
|
/** Return the media-type of the content in this part.
|
||||||
*
|
*
|
||||||
@ -79,35 +79,34 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual const int getSize() const = 0;
|
virtual const int getSize() const = 0;
|
||||||
|
|
||||||
/** Return the part sequence number (index)
|
/** Return the part sequence number (index).
|
||||||
|
* The first part is at index zero.
|
||||||
*
|
*
|
||||||
* @return part number
|
* @return part number
|
||||||
*/
|
*/
|
||||||
virtual const int getNumber() const = 0; // begin at 1
|
virtual const int getNumber() const = 0;
|
||||||
|
|
||||||
/** Return the sub-part at the specified position.
|
/** Return the sub-part at the specified position (zero is the
|
||||||
* This provide easy access to parts:
|
* first part).
|
||||||
* Eg: "message->extractPart(message->getStructure()[3][1][2])".
|
|
||||||
*
|
*
|
||||||
* @param x index of the sub-part
|
* @param pos index of the sub-part
|
||||||
* @return sub-part at position 'x'
|
* @return sub-part at position 'pos'
|
||||||
*/
|
*/
|
||||||
const part& operator[](const int x) const;
|
ref <const part> getPartAt(const int pos) const;
|
||||||
|
|
||||||
/** Return the sub-part at the specified position.
|
/** Return the sub-part at the specified position (zero is the
|
||||||
* This provide easy access to parts:
|
* first part).
|
||||||
* Eg: "message->extractPart(message->getStructure()[3][1][2])".
|
|
||||||
*
|
*
|
||||||
* @param x index of the sub-part
|
* @param pos index of the sub-part
|
||||||
* @return sub-part at position 'x'
|
* @return sub-part at position 'pos'
|
||||||
*/
|
*/
|
||||||
part& operator[](const int x);
|
ref <part> getPartAt(const int pos);
|
||||||
|
|
||||||
/** Return the number of sub-parts in this part.
|
/** Return the number of sub-parts in this part.
|
||||||
*
|
*
|
||||||
* @return number of sub-parts
|
* @return number of sub-parts
|
||||||
*/
|
*/
|
||||||
const int getCount() const;
|
const int getPartCount() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -126,26 +125,26 @@ public:
|
|||||||
virtual ~structure() { }
|
virtual ~structure() { }
|
||||||
|
|
||||||
/** Return the part at the specified position (first
|
/** Return the part at the specified position (first
|
||||||
* part is at position 1).
|
* part is at position 0).
|
||||||
*
|
*
|
||||||
* @param x position
|
* @param pos position
|
||||||
* @return part at position 'x'
|
* @return part at position 'pos'
|
||||||
*/
|
*/
|
||||||
virtual const part& operator[](const int x) const = 0;
|
virtual ref <const part> getPartAt(const int pos) const = 0;
|
||||||
|
|
||||||
/** Return the part at the specified position (first
|
/** Return the part at the specified position (first
|
||||||
* part is at position 1).
|
* part is at position 0).
|
||||||
*
|
*
|
||||||
* @param x position
|
* @param pos position
|
||||||
* @return part at position 'x'
|
* @return part at position 'pos'
|
||||||
*/
|
*/
|
||||||
virtual part& operator[](const int x) = 0;
|
virtual ref <part> getPartAt(const int pos) = 0;
|
||||||
|
|
||||||
/** Return the number of parts in this part.
|
/** Return the number of parts in this part.
|
||||||
*
|
*
|
||||||
* @return number of parts
|
* @return number of parts
|
||||||
*/
|
*/
|
||||||
virtual const int getCount() const = 0;
|
virtual const int getPartCount() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -171,13 +170,13 @@ public:
|
|||||||
*
|
*
|
||||||
* @return MIME structure of the message
|
* @return MIME structure of the message
|
||||||
*/
|
*/
|
||||||
virtual const structure& getStructure() const = 0;
|
virtual ref <const structure> getStructure() const = 0;
|
||||||
|
|
||||||
/** Return the MIME structure of the message (must fetch before).
|
/** Return the MIME structure of the message (must fetch before).
|
||||||
*
|
*
|
||||||
* @return MIME structure of the message
|
* @return MIME structure of the message
|
||||||
*/
|
*/
|
||||||
virtual structure& getStructure() = 0;
|
virtual ref <structure> getStructure() = 0;
|
||||||
|
|
||||||
/** Return a reference to the header fields of the message (must fetch before).
|
/** Return a reference to the header fields of the message (must fetch before).
|
||||||
*
|
*
|
||||||
@ -275,13 +274,13 @@ public:
|
|||||||
* be supported by the protocol (IMAP supports this), but it will NOT throw
|
* be supported by the protocol (IMAP supports this), but it will NOT throw
|
||||||
* an exception if not supported.
|
* an exception if not supported.
|
||||||
*/
|
*/
|
||||||
virtual void extractPart(const part& p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const = 0;
|
virtual void extractPart(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const = 0;
|
||||||
|
|
||||||
/** Fetch the MIME header for the specified part.
|
/** Fetch the MIME header for the specified part.
|
||||||
*
|
*
|
||||||
* @param p the part for which to fetch the header
|
* @param p the part for which to fetch the header
|
||||||
*/
|
*/
|
||||||
virtual void fetchPartHeader(part& p) = 0;
|
virtual void fetchPartHeader(ref <part> p) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ public:
|
|||||||
|
|
||||||
const bool isExpunged() const;
|
const bool isExpunged() const;
|
||||||
|
|
||||||
const structure& getStructure() const;
|
ref <const structure> getStructure() const;
|
||||||
structure& getStructure();
|
ref <structure> getStructure();
|
||||||
|
|
||||||
ref <const header> getHeader() const;
|
ref <const header> getHeader() const;
|
||||||
|
|
||||||
@ -69,9 +69,9 @@ public:
|
|||||||
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
void setFlags(const int flags, const int mode = FLAG_MODE_SET);
|
||||||
|
|
||||||
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extract(utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
void extractPart(const part& p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
void extractPart(ref <const part> p, utility::outputStream& os, utility::progressionListener* progress = NULL, const int start = 0, const int length = -1, const bool peek = false) const;
|
||||||
|
|
||||||
void fetchPartHeader(part& p);
|
void fetchPartHeader(ref <part> p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user