added support for leaving out <embedded objects> that are created during their parent's creation and should not be streamed out separately. Support for empty element tags when reading in
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -78,6 +78,13 @@ void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo
|
|||||||
|
|
||||||
void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded)
|
void wxWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded)
|
||||||
{
|
{
|
||||||
|
// hack to avoid writing out embedded windows, these are windows that are constructed as part of other windows, they would
|
||||||
|
// doubly constructed afterwards
|
||||||
|
|
||||||
|
const wxWindow * win = dynamic_cast<const wxWindow*>(object) ;
|
||||||
|
if ( win && win->GetId() < 0 )
|
||||||
|
return ;
|
||||||
|
|
||||||
if ( persister->BeforeWriteObject( this , object , classInfo ) )
|
if ( persister->BeforeWriteObject( this , object , classInfo ) )
|
||||||
{
|
{
|
||||||
if ( object == NULL )
|
if ( object == NULL )
|
||||||
@@ -578,7 +585,9 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG(prop->GetName() == wxT("element") , wxT("A non empty collection must consist of 'element' nodes")) ;
|
wxASSERT_MSG(prop->GetName() == wxT("element") , wxT("A non empty collection must consist of 'element' nodes")) ;
|
||||||
wxXmlNode* elementContent = prop->GetChildren() ;
|
wxXmlNode* elementContent = prop->GetChildren() ;
|
||||||
wxASSERT_MSG(elementContent, wxT("An element node cannot be empty")) ;
|
if ( elementContent )
|
||||||
|
{
|
||||||
|
// we skip empty elements
|
||||||
if ( elementType->IsObjectType() )
|
if ( elementType->IsObjectType() )
|
||||||
{
|
{
|
||||||
int valueId = ReadComponent( elementContent , callbacks ) ;
|
int valueId = ReadComponent( elementContent , callbacks ) ;
|
||||||
@@ -597,6 +606,7 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
if ( pi->GetAccessor()->HasAdder() )
|
if ( pi->GetAccessor()->HasAdder() )
|
||||||
callbacks->AddToPropertyCollection( objectID , classInfo ,pi , elementValue ) ;
|
callbacks->AddToPropertyCollection( objectID , classInfo ,pi , elementValue ) ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
prop = prop->GetNext() ;
|
prop = prop->GetNext() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user