Allow nsTCharSeparatedTokenizer to be used in a range-based for loop
Categories
(Core :: XPCOM, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox86 | --- | fixed |
People
(Reporter: sg, Assigned: sg)
Details
Attachments
(7 files)
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
At the moment, using nsTCharSeparatedTokenizer (and its specializations) requires custom while loops like
nsCCharSeparatedTokenizer tokenizer(headerValue, ';');
while (tokenizer.hasMoreTokens()) {
const nsDependentCSubstring& token = tokenizer.nextToken();
// do something with token
}
With an appropriate adapter, C++11 range-based for loops could be used instead, which would provide a simpler syntax, reduce scope of the tokenizer and increase regularity:
for (const nsDependentCSubstring& token :
nsTokenizedRange{nsCCharSeparatedTokenizer(headerValue, ';')}) {
// do something with token
}
Also, several uses of strtok could be transformed to use the tokenizers in a range-based way.
| Assignee | ||
Comment 1•5 years ago
|
||
| Assignee | ||
Comment 2•5 years ago
|
||
Depends on D98306
| Assignee | ||
Comment 3•5 years ago
|
||
Depends on D98307
| Assignee | ||
Comment 4•5 years ago
|
||
Depends on D98308
Comment 5•5 years ago
|
||
Please provide an explanation of what you are doing and why. The two major parts of the review process are determining whether the goals of the author are good and whether they are being achieved, and without knowing what you are trying to do, that makes review much more difficult. Thanks.
| Assignee | ||
Comment 6•5 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #5)
Please provide an explanation of what you are doing and why. The two major parts of the review process are determining whether the goals of the author are good and whether they are being achieved, and without knowing what you are trying to do, that makes review much more difficult. Thanks.
Sorry, I added a description now.
| Assignee | ||
Comment 7•5 years ago
|
||
Depends on D98307
Updated•5 years ago
|
Updated•5 years ago
|
| Assignee | ||
Comment 8•5 years ago
|
||
There are no uses of nsTCharSeparatedTokenizer that require run-time
configuration of the flags, so having them a compile-time template
argument allows for generation of more efficient code.
This might not matter that much now, but a subsequent patch will add another
flag to allow merging the implementation of nsTSubstring::Split with
nsTCharSeparatedTokenizer, through which the compile-time evaluation will
become more relevant.
Depends on D98307
| Assignee | ||
Comment 9•5 years ago
|
||
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6568490004a6
https://hg.mozilla.org/mozilla-central/rev/6cfaa0523589
https://hg.mozilla.org/mozilla-central/rev/e94505c67802
https://hg.mozilla.org/mozilla-central/rev/ad59c7dccefb
https://hg.mozilla.org/mozilla-central/rev/3fb5e713945b
https://hg.mozilla.org/mozilla-central/rev/f84ee933797d
Comment 12•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
Comment 13•5 years ago
|
||
| bugherder | ||
Description
•