Once again, I'm pondering my settings framework. I still don't like to have:
Yet, I do want to do some special stuff on some types, to maintain human readability. This mainly applies to bools (save as Yes/No) and dates (save in ISO format).
As overloading is not likely to happen soon, I started thinking about doing this:
Then I'd test the type of the Value argument and do whatever formatting needed. Possible?
B4X:
* SettingStr(Key as string, Value as string, Write as bool) as string
* SettingInt(Key as string, Value as int, Write as bool) as int
* SettingLong(Key as string, Value as long, Write as bool) as long
* SettingBool(Key as string, Value as bool, Write as bool) as bool
* SettingFloat(Key as string, Value as float, Write as bool) as float
* SettingDouble(Key as string, Value as double, Write as bool) as double
* SettingDate(Key as string, Value as long, Write as bool) as long
Yet, I do want to do some special stuff on some types, to maintain human readability. This mainly applies to bools (save as Yes/No) and dates (save in ISO format).
As overloading is not likely to happen soon, I started thinking about doing this:
B4X:
* Setting(Key as string, Value as object, Write as bool) as object
Then I'd test the type of the Value argument and do whatever formatting needed. Possible?