PrefsObject
Re: PrefsObject
I am happy to help out with suggestions, but I still need some example code to start with. Could someone post the example(s) on here?
Workbench Explorer - A better way to browse drawers
Re: PrefsObject
I was just going to suggest the same thing!salass00 wrote:Currently application.library reads and writes version 1.0 pobjects files but it should be simple enough to make a new version of the library that reads version 1.0 and version 2.0 pobjects file and writes in the latter format only.
Will do.If you have suggestions on how the new pobjects format should look then please post them here.
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Re: PrefsObject
@mritter0
I'll send you some code examples when I get to my machine later today.
No, the system is cool (though still a little undocumented). It's just the current XML schema that is bad.mritter0 wrote:Am I wasting my time using PrefsObject system?
I'll send you some code examples when I get to my machine later today.
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: PrefsObject
Current:salass00 wrote:Well if there are problems with the current pobjects format then they can be fixed in application.library.broadblues wrote: I wouldn't use it myself, it produces horid unstructured xml, where the only relation between a key and value is that value follows immediatly after the key.
Currently application.library reads and writes version 1.0 pobjects files but it should be simple enough to make a new version of the library that reads version 1.0 and version 2.0 pobjects file and writes in the latter format only.
If you have suggestions on how the new pobjects format should look then please post them here.
Code: Select all
<key>Filer.def.dstbackground2pen.r</key>
<string>0xEEEDEEED</string>
Possible improvement:
Key and string now bound together in an item.
Code: Select all
<item>
<key>Filer.def.dstbackground2pen.r</key>
<string>0xEEEDEEED</string>
</item>
alternative.
Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" >
0xEEEDEEED
</item>
<item key="Filer.def.search.filename.case" type="bool" >
TRUE
</item>
There are a lot of variations ofcourse, Trixie may have better suggestions still...
Re: PrefsObject
@mritter0
I started reworking the PrefsObjects wiki documentation to turn it into something more useful - it's now well overdue! I've covered reading the preferences and added a how-to example code fragment; this should get you started. More information to be added soon I hope:
Link: http://wiki.amigaos.net/wiki/PrefsObjects
@broadblues
I was actually going to suggest something like you show in that last example.
I started reworking the PrefsObjects wiki documentation to turn it into something more useful - it's now well overdue! I've covered reading the preferences and added a how-to example code fragment; this should get you started. More information to be added soon I hope:
Link: http://wiki.amigaos.net/wiki/PrefsObjects
@broadblues
I was actually going to suggest something like you show in that last example.
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
- salass00
- AmigaOS Core Developer
- Posts: 530
- Joined: Sat Jun 18, 2011 3:12 pm
- Location: Finland
- Contact:
Re: PrefsObject
How about something like this?broadblues wrote:Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" > 0xEEEDEEED </item> <item key="Filer.def.search.filename.case" type="bool" > TRUE </item>
There are a lot of variations ofcourse, Trixie may have better suggestions still...
Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string>
<bool key="Filer.def.search.filename.case">TRUE</bool>
Re: PrefsObject
Code: Select all
<item key="Filer.def.dstbackground2pen.r" type="string" > 0xEEEDEEED </item> <item key="Filer.def.search.filename.case" type="bool" > TRUE </item>
I'd prefer the first option over the second, since with a general <item> structure it'd be very easy to f.i. create a general GUI that can edit all items, using a fallback text gadget, whereas with the type defining in the tag, you'd have to support all possible types in order to parse the file. I'm also assuming that the "type" attribute could be something application specific, like type="email" allowing the application to validate it, whereas application.library would only treat it as text.Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string> <bool key="Filer.def.search.filename.case">TRUE</bool>
Re: PrefsObject
On the other hand, Chris' suggestion looks much more human-readable, so if we are to arrive at a compromise between "easy to parse" and "easy to read and edit manually", I'd probably go with something like that. And from the viewpoint of the parser, I guess there's not much difference between handling six different elements (there are six types of PrefsObject) and six different attributes - you need to process them anyway.jaokim wrote:I'd prefer the first option over the second
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
- salass00
- AmigaOS Core Developer
- Posts: 530
- Joined: Sat Jun 18, 2011 3:12 pm
- Location: Finland
- Contact:
Re: PrefsObject
As I see it this won't be a problem since only application.library should be used for parsing these files.jaokim wrote: I'd prefer the first option over the second, since with a general <item> structure it'd be very easy to f.i. create a general GUI that can edit all items, using a fallback text gadget, whereas with the type defining in the tag, you'd have to support all possible types in order to parse the file. I'm also assuming that the "type" attribute could be something application specific, like type="email" allowing the application to validate it, whereas application.library would only treat it as text.
I haven't looked at the code but I would assume that the PrefsObjectsEditor also uses application.library to read and write the pobjects files.
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: PrefsObject
Well I'm not keen on that format. My objection to the original was lack of structure. The point of using xml in the first place (IMHO at least) is to export data in a structured way, other wise you might as wel use plain text.salass00 wrote:
How about something like this?
Code: Select all
<string key="Filer.def.dstbackground2pen.r>0xEEEDEEED</string> <bool key="Filer.def.search.filename.case">TRUE</bool>
My second format adds structure:
Dictionary->Item in dictionary->Key and type information->data.
Whilst it's a slight improvement on the original your suggestion doesn't really add much in the way structure, although the data and key is at least bound togther.
If you want to use tags to define the datatype (that can make parsing slightly easier internally) then how about.
Code: Select all
<pobjects version="2.0">
<dict>
<item key="itemone">
<bool>FALSE</bool>
</item>
<item key="itemtwo">
<string>This is the winter of our discontent</string>
</item>
</dict>
</pobject>