list separator in config entries

Thomas Braxton kde.braxton at gmail.com
Wed Oct 17 10:54:09 BST 2007


On 10/13/07, Thomas Braxton <kde.braxton at gmail.com> wrote:
>
>
>
> On 10/13/07, Oswald Buddenhagen <ossi at kde.org> wrote:
> >
> > On Sat, Oct 13, 2007 at 09:52:25AM -0500, Thomas Braxton wrote:
> > > On 10/12/07, Oswald Buddenhagen <ossi at kde.org> wrote:
> > > > the escaping you chose is ... uhm ... ugly. i mean, even uglier than
> >
> > > > just tree backslashes in a row.
> > >
> > > yeah, but 3 backslashes in a row doesn't work, \x5c does
> > >
> > i think you *really* should re-read my first contribution to this thread
> > and everything that followed from it.
> >
> > > > anyway, a lot of the code looks suspicious, to say the least. i'll
> > > > know more when i actually get my hands on it.
> > >
> > > like what?
> > >
> > like all the special casing related to lists and separators. it's just
> > plain weird. why don't you simply use a "forward parser" like
> > KConfigIniBackend::parseConfig() does instead of doing this incredible
> > magic?
> > i'm sure there is more. weirdness doesn't come alone. ;)
>
>
>
> Ok, give me a day or two. ;) even though this'll probably end up in
> KConfigIniBackend later anyway.
>

Ok, here you go. Personally I think this is uglier than hex encoding the
trailing backslash. Since we can't know if this is a trailing backslash or
escaping the separator, every backslash has to be escaped twice. Once by
KConfigGroup, and once by KConfigIniBackend. And I'm not sure, but I think
this will cause problems if/when we change KEntry to use QVariant instead of
QByteArray, because there's no way for KConfigIniBackend to know if it
should unescape the backslashes once or twice.

This is how share/config/kconfigtest changes.

--- kconfigtest.old 2007-10-15 11:29:34.000000000 -0500
+++ kconfigtest.new 2007-10-15 11:29:44.000000000 -0500
@@ -30,9 +30,9 @@
 listOfIntsEntry1=1,2,3,4
 stringListEmptyEntry=
 stringListEntry=Hello\\,, World
-stringListEscapeCommaEntry=Hel\\\\\\\\,\\\\\\,\\\\,\\\\\\\\\\,lo,World
-stringListEscapeEvenEntry=Hello\\\\\\\\x5c,World
-stringListEscapeOddEntry=Hello\\\\\\x5c,World
+stringListEscapeCommaEntry=Hel\\\\\\\\\\\\\\,\\\\\\\\\\,\\\\\\,\\\\\\\\\\\\\\\\\\,lo,World
+stringListEscapeEvenEntry=Hello\\\\\\\\\\\\\\\\,World
+stringListEscapeOddEntry=Hello\\\\\\\\\\\\,World
 variantListEntry=true,false,joe,10023
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071017/b76066da/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new-listfix.diff
Type: application/octet-stream
Size: 2313 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071017/b76066da/attachment.obj>


More information about the kde-core-devel mailing list