Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMime
Commits
6652b3e6
Commit
6652b3e6
authored
Jan 20, 2021
by
Laurent Montel
😁
Browse files
Port foreach
parent
8570799a
Pipeline
#48168
failed with stage
in 4 minutes and 9 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
6652b3e6
...
...
@@ -51,6 +51,7 @@ if (USE_UNITY_CMAKE_SUPPORT)
endif
()
endif
()
########### Targets ###########
add_definitions
(
-DQT_NO_FOREACH
)
add_subdirectory
(
src
)
add_subdirectory
(
includes
)
...
...
src/kmime_content.cpp
View file @
6652b3e6
...
...
@@ -187,7 +187,8 @@ void Content::assemble()
}
d
->
head
=
assembleHeaders
();
foreach
(
Content
*
c
,
contents
())
{
const
auto
contentsList
=
contents
();
for
(
Content
*
c
:
contentsList
)
{
c
->
assemble
();
}
}
...
...
@@ -424,7 +425,8 @@ Content *Content::textContent()
if
(
contentType
()
->
isText
())
{
ret
=
this
;
}
else
{
foreach
(
Content
*
c
,
d_ptr
->
contents
())
{
const
auto
contents
=
d_ptr
->
contents
();
for
(
Content
*
c
:
contents
)
{
if
((
ret
=
c
->
textContent
())
!=
nullptr
)
{
break
;
}
...
...
@@ -557,7 +559,8 @@ void Content::removeContent(Content *c, bool del)
// Move all headers from the old subcontent to ourselves.
// NOTE: This also sets the new Content-Type.
foreach
(
Headers
::
Base
*
h
,
main
->
d_ptr
->
headers
)
{
const
auto
headers
=
main
->
d_ptr
->
headers
;
for
(
Headers
::
Base
*
h
:
headers
)
{
setHeader
(
h
);
// Will remove the old one if present.
}
main
->
d_ptr
->
headers
.
clear
();
...
...
@@ -692,7 +695,8 @@ int Content::storageSize() const
// FIXME: This should take into account the boundary headers that are added in
// encodedContent!
foreach
(
Content
*
c
,
d
->
contents
())
{
const
auto
contents
=
d
->
contents
();
for
(
Content
*
c
:
contents
)
{
s
+=
c
->
storageSize
();
}
}
...
...
@@ -709,7 +713,8 @@ int Content::lineCount() const
}
ret
+=
d
->
body
.
count
(
'\n'
);
foreach
(
Content
*
c
,
d
->
contents
())
{
const
auto
contents
=
d
->
contents
();
for
(
Content
*
c
:
contents
)
{
ret
+=
c
->
lineCount
();
}
...
...
src/kmime_headers.cpp
View file @
6652b3e6
...
...
@@ -363,7 +363,8 @@ QVector<QByteArray> MailboxList::addresses() const
{
QVector
<
QByteArray
>
rv
;
rv
.
reserve
(
d_func
()
->
mailboxList
.
count
());
foreach
(
const
Types
::
Mailbox
&
mbox
,
d_func
()
->
mailboxList
)
{
const
auto
mailboxList
=
d_func
()
->
mailboxList
;
for
(
const
Types
::
Mailbox
&
mbox
:
mailboxList
)
{
rv
.
append
(
mbox
.
address
());
}
return
rv
;
...
...
@@ -498,7 +499,8 @@ QString AddressList::asUnicodeString() const
QStringList
rv
;
for
(
const
Types
::
Address
&
addr
:
qAsConst
(
d
->
addressList
))
{
rv
.
reserve
(
rv
.
size
()
+
addr
.
mailboxList
.
size
());
foreach
(
const
Types
::
Mailbox
&
mbox
,
addr
.
mailboxList
)
{
const
auto
mailboxList
=
addr
.
mailboxList
;
for
(
const
Types
::
Mailbox
&
mbox
:
mailboxList
)
{
rv
.
append
(
mbox
.
prettyAddress
());
}
}
...
...
@@ -539,8 +541,10 @@ void AddressList::addAddress(const QByteArray &address,
QVector
<
QByteArray
>
AddressList
::
addresses
()
const
{
QVector
<
QByteArray
>
rv
;
foreach
(
const
Types
::
Address
&
addr
,
d_func
()
->
addressList
)
{
foreach
(
const
Types
::
Mailbox
&
mbox
,
addr
.
mailboxList
)
{
const
auto
addressList
=
d_func
()
->
addressList
;
for
(
const
Types
::
Address
&
addr
:
addressList
)
{
const
auto
mailboxList
=
addr
.
mailboxList
;
for
(
const
Types
::
Mailbox
&
mbox
:
mailboxList
)
{
rv
.
append
(
mbox
.
address
());
}
}
...
...
@@ -572,8 +576,10 @@ QString AddressList::displayString() const
Types
::
Mailbox
::
List
AddressList
::
mailboxes
()
const
{
Types
::
Mailbox
::
List
rv
;
foreach
(
const
Types
::
Address
&
addr
,
d_func
()
->
addressList
)
{
foreach
(
const
Types
::
Mailbox
&
mbox
,
addr
.
mailboxList
)
{
const
auto
addressList
=
d_func
()
->
addressList
;
for
(
const
Types
::
Address
&
addr
:
addressList
)
{
const
auto
mailboxList
=
addr
.
mailboxList
;
for
(
const
Types
::
Mailbox
&
mbox
:
mailboxList
)
{
rv
.
append
(
mbox
);
}
}
...
...
@@ -993,7 +999,8 @@ bool Ident::parse(const char *&scursor, const char *const send, bool isCRLF)
QVector
<
QByteArray
>
Ident
::
identifiers
()
const
{
QVector
<
QByteArray
>
rv
;
foreach
(
const
Types
::
AddrSpec
&
addr
,
d_func
()
->
msgIdList
)
{
const
auto
msgIdList
=
d_func
()
->
msgIdList
;
for
(
const
Types
::
AddrSpec
&
addr
:
msgIdList
)
{
if
(
!
addr
.
isEmpty
())
{
const
QString
asString
=
addr
.
asString
();
if
(
!
asString
.
isEmpty
())
{
...
...
tests/test_kmime_header_parsing.cpp
View file @
6652b3e6
...
...
@@ -344,7 +344,8 @@ int main(int argc, char *argv[])
<<
"result.displayName:
\n
"
<<
endl
;
int
i
=
0
;
foreach
(
const
auto
&
it
,
result
.
mailboxList
)
{
const
auto
mailboxList
=
result
.
mailboxList
;
for
(
const
auto
&
it
:
mailboxList
)
{
cout
<<
"result.mailboxList["
<<
i
<<
"].displayName:
\n
"
<<
(
it
).
name
()
<<
endl
<<
"result.mailboxList["
<<
i
<<
"].addrSpec.localPart:
\n
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment