| Anonymous | Login | Signup for a new account | 2013-05-26 08:48 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
| 0020166 | FPC | RTL | public | 2011-09-06 12:05 | 2011-09-06 17:31 | ||||||||
| Reporter | Hert van Zwietering | ||||||||||||
| Assigned To | |||||||||||||
| Priority | normal | Severity | trivial | Reproducibility | always | ||||||||
| Status | new | Resolution | open | ||||||||||
| Platform | any | OS | any | OS Version | any | ||||||||
| Product Version | 2.5.1 | Product Build | |||||||||||
| Target Version | Fixed in Version | ||||||||||||
| Summary | 0020166: TWriter doesn't stream empty value | ||||||||||||
| Description | By default, the TWriter class is not streaming properties which match the default value. For instance; I create an object with a single string property and load it from a previously saves stream that contains a value in the string property. This works fine and my object now contains that value. Then subsequently, for this same object, I now load from another stream but this time the stream has an object with an empty string value. This string value was not written out to the stream because the TWriter thinks that an empty string value shouldn't have to be written. So after this second load, my object still contains the value of the first load, simply because the TReader didn't find (hence load) this property in the stream. I know that this is by design, but would like to start a discussion to have this behavior changed. Delphi7 for instance writes empty strings to the output streams which is to be expected as an empty string is also a value. This doen't only apply to strings but any type... a 0 integer is also a value; a null variant is also a value. In short I'd like to either have the default checking removed in TWriter.WriteProperty or have a setting for a TWriter where I can tell it to not check default values. | ||||||||||||
| Tags | No tags attached. | ||||||||||||
| FPCOldBugId | |||||||||||||
| Fixed in Revision | |||||||||||||
| Attached Files | |||||||||||||
Notes |
|
|
(0051513) Jonas Maebe (manager) 2011-09-06 16:34 |
Isn't the problem rather that properties not present in the stream aren't initialized to their default value? |
|
(0051515) Hert van Zwietering (reporter) 2011-09-06 17:31 |
Oh no, that isn't a problem at all. The problem is that empty values aren't written to the stream and as a result not being loaded. A property could well get a default string value in the constructor and when emptied the empty property would have to be written so that on load of the stream the value is also set to the stored empty value. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-09-06 12:05 | Hert van Zwietering | New Issue | |
| 2011-09-06 16:34 | Jonas Maebe | Note Added: 0051513 | |
| 2011-09-06 17:31 | Hert van Zwietering | Note Added: 0051515 | |
| Main | My View | View Issues | Change Log | Roadmap |



