[Development] QRegularExpression -- first round of API review

Oswald Buddenhagen oswald.buddenhagen at nokia.com
Thu Dec 15 20:45:05 CET 2011


On Thu, Dec 15, 2011 at 04:43:49PM +0000, ext Giuseppe D'Angelo wrote:
>    pos, matchedLength, endPos
>
inconsistent naming

>     void setPatternOptions(PatternOptions options, bool on = true);
> 
i don't like that too much, because *un*setting options en masse sucks -
you need to make a "block" of options to set, and a "block" of options
to delete. that's half as bad if all options are off by default, but
then one has to wonder whether a way to unset them actually makes sense
in the first place.
fwiw, the usual elegant solution is having a value and a mask parameter.
the mask could have two magic values meaning "un-/set all asserted in
vlaue" to mean effectively what your bool means. the default argument
would be the magic value for setting, so the standard syntax would set
all flags named in the first argument.

just the obvious. i'll let others have the real fun. ;)



More information about the Development mailing list