diff options
Diffstat (limited to 'src/mime-getpart.cc')
-rw-r--r-- | src/mime-getpart.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mime-getpart.cc b/src/mime-getpart.cc index 02a1ec5..42f6c60 100644 --- a/src/mime-getpart.cc +++ b/src/mime-getpart.cc @@ -1,9 +1,10 @@ -/** -------------------------------------------------------------------- +/** * @file mime-getpart.cc * @brief Implementation of main mime parser components * @author Andreas Aardal Hanssen * @date 2002-2005 - * ----------------------------------------------------------------- **/ + */ + #include "convert.h" #include "mime.h" @@ -18,32 +19,27 @@ #include <stdio.h> #include <string.h> -using namespace ::std; - -//------------------------------------------------------------------------ -const Binc::MimePart *Binc::MimePart::getPart(const string &findpart, - string genpart, +const Binc::MimePart *Binc::MimePart::getPart(const std::string &findpart, + std::string genpart, FetchType fetchType) const { if (findpart == genpart) return this; if (isMultipart()) { if (members.size() != 0) { - vector<MimePart>::const_iterator i = members.begin(); int part = 1; - while (i != members.end()) { + for (const auto &i : members) { BincStream ss; ss << genpart; if (genpart != "") ss << "."; ss << part; const MimePart *m; - if ((m = (*i).getPart(findpart, ss.str())) != 0) { + if ((m = i.getPart(findpart, ss.str())) != nullptr) { if (fetchType == FetchHeader && m->isMessageRFC822()) m = &m->members[0]; return m; } - ++i; ++part; } } @@ -52,7 +48,7 @@ const Binc::MimePart *Binc::MimePart::getPart(const string &findpart, const MimePart *m = members[0].getPart(findpart, genpart); return m; } else { - return 0; + return nullptr; } } else { // Singlepart @@ -62,5 +58,5 @@ const Binc::MimePart *Binc::MimePart::getPart(const string &findpart, if (findpart == genpart) return this; } - return 0; + return nullptr; } |