TWriter doesn't stream stored empty strings
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
I'd like to reopen the issue #20166 (closed).
There is absolutely no possibility to make the TWriter stream an empty string:
1.) The "nodefault" modifier doesn't work (contrary to Michael's statement "If you want a value to be written regardless, you must append the nodefault modifier to the property definition, this will cause TWriter to ignore default values."
2.) A stored method returning True doesn't work.
3.) An explicit "stored True" doesn't work.
As a result, if a component uses a non-empty default string value (e.g. TMyComp.S from the example) and you change the value to empty string => the property isn't written into the stream. A subsequent read doesn't restore the empty string but the default string, obviously.
Steps to reproduce:
See the attached test case project. All string properties S, T and U are explicitly told to be written to the stream (every one with a different approach). None of them is written.
Compare it to the Integer properties I, J, K with the same modifiers - all of them are stored.
Additional information:
A possible (simple) patch is attached. It copies the Integer/Ord approach. The nodefault modifier isn't handled, though - neither by ordinal properties, nor by string properties.
Mantis conversion info:
- Mantis ID: 31985
- Build: 36212
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 37954 (#f6a08a2c)
- Monitored by: » AntonK (Anton Kavalenka)
- Target version: 3.2.0