D20092: New class KOSRelease - a parser for os-release files
Harald Sitter
noreply at phabricator.kde.org
Wed Apr 3 13:02:25 BST 2019
sitter updated this revision to Diff 55338.
sitter added a comment.
- defaultFilePath is now static in the cpp only, the public ctor defaults to QString() for the filePath, which gets checked in the private ctor and diverted to defaultFilePath if necessary
- Private ctor now copies filePath as we may need to change it to defaultFilePath
- = and \# parsing revisitede
- new helper splitEntry mids the line at first = character only preventing = characters in pretty strings from tripping up the parsing
- \# characters that are not the first character in the line are now not explicitly causing a line skip as far as entry parsing is concerned. I think this is actually a more truthful implementation of the format specification. since the spec doesn't even mention trailing \# we can do whatever with them and not skipping entire lines outright seems like the nicer solution here
- api docs updated accordingly. now clearly states that trailing comments result in undefined behavior
- test and fixture updated to make sure = and \# work in pretty string and that completely invalid lines are skipped
- parsing skips now produce categorized warnings
I am wondering if from an API POV it'd be nicer if we maybe had two ctors (one default, one with QString) so we can let initalizer lists handle whether the defaults apply or not.
REPOSITORY
R244 KCoreAddons
CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D20092?vs=54993&id=55338
BRANCH
master
REVISION DETAIL
https://phabricator.kde.org/D20092
AFFECTED FILES
autotests/CMakeLists.txt
autotests/data/os-release
autotests/kosreleasetest.cpp
src/lib/CMakeLists.txt
src/lib/util/kosrelease.cpp
src/lib/util/kosrelease.h
To: sitter, apol, mpyne
Cc: davidedmundson, pino, aacid, mpyne, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190403/2f2b6058/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list