Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » best method of saving users settings?
best method of saving users settings? [message #33314] Sun, 24 July 2011 11:43 Go to next message
dave is currently offline  dave
Messages: 14
Registered: July 2011
Promising Member
hi,
just wondering what is the best method of saving users settings as presets in a GUI app such that the user can load one's personal settings when the need arises.

is binary method(serialize stream) better or the text based method(ini/xml)?

global app configuration is best when serialized, but if one wants to save user's choices in various GUI forms as in drop lists, switches, options, edit fields etc ,what should one do?
serialize or parse c/XML?
use vector maps?
or anything else?

regards

dave



Re: best method of saving users settings? [message #33319 is a reply to message #33314] Sun, 24 July 2011 19:09 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi dave,

This is quite common question... I wish there was a simple answer, so we could put it in FAQ section Smile

It depends a lot on what you want to do. If you want to store some internal information (e.g. GUI state), binary serialization is a good choice. XML is good choice when you store information you want to be easily accessible from other applications or human readable. For storing application configuration, which should be human editable, text based config file is appropriate.

Both Serialize() and Xmlize() have quite similar semantics and working with them is rather simple in U++. For reading/writing the ".ini" like text files, there exist a class that handles this as well.

Using a serialization of map should work in general, but it will make you do more work in case you wan't to store more than just one type. So I would recommend to stay with one of the three methods mentioned above.

Also, nothing stops you from combining these methods. You can save part of the information in serialized form, while the rest is in text file. I personally prefer to have it split, so user only reads what is intended for him to read Smile

Best regards,
Honza
Previous Topic: libnodave dll/lib include
Next Topic: adding version and company info?
Goto Forum:
  


Current Time: Sun Apr 28 19:10:44 CEST 2024

Total time taken to generate the page: 0.04095 seconds