D26876: Remove the Enum hack: finish lists with a comma, it's valid c++

Kevin Ottens noreply at phabricator.kde.org
Tue Jan 28 17:46:44 GMT 2020


ervin added inline comments.

INLINE COMMENTS

> KConfigHeaderGenerator.cpp:252
>  
> -    // HACK: Use C-Style for add a comma in all but the last element,
> -    // just to make the source generated code equal to the old one.
> -    // When we are sure, revert this to a range-based-for and just add
> -    // a last comma, as it's valid c++.
> -    for (int i = 0, end = parseResult.signalList.size(); i < end; i++) {
> -        auto signal = parseResult.signalList.at(i);
> -        stream() << whitespace() << "  " << signalEnumName(signal.name) << " = 0x" << hex << val;
> -        if (i != end-1) {
> -            stream() << ",\n";
> -        }
> -
> +    for (const auto signal : parseResult.signalList) {
> +        stream() << whitespace() << "  " << signalEnumName(signal.name) << " = 0x" << hex << val << ",\n";

I lost track of constness here so I might be wrong, shouldn't this use qAsConst in this context?

REPOSITORY
  R237 KConfig

BRANCH
  remove_enum_hack

REVISION DETAIL
  https://phabricator.kde.org/D26876

To: tcanabrava, ervin, dfaure, apol
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200128/fb878ead/attachment.html>


More information about the Kde-frameworks-devel mailing list