- wxDocument::SaveObject(stream);
-
- stream << doodleSegments.Number() << '\n';
- wxNode *node = doodleSegments.First();
- while (node)
- {
- DoodleSegment *segment = (DoodleSegment *)node->Data();
- segment->SaveObject(stream);
- stream << '\n';
-
- node = node->Next();
- }
- return stream;
+ wxDocument::SaveObject(stream);
+
+ wxTextOutputStream text_stream( stream );
+
+ wxInt32 n = doodleSegments.GetCount();
+ text_stream << n << '\n';
+
+ wxList::compatibility_iterator node = doodleSegments.GetFirst();
+ while (node)
+ {
+ DoodleSegment *segment = (DoodleSegment *)node->GetData();
+ segment->SaveObject(stream);
+ text_stream << '\n';
+
+ node = node->GetNext();
+ }
+
+ return stream;