//--------------------------------------------------------- void CSG_MetaData::_Load(wxXmlNode *pNode) { m_Name = pNode->GetName ().wc_str(); m_Content = pNode->GetNodeContent().wc_str(); //----------------------------------------------------- wxXmlAttribute *pProperty = pNode->GetAttributes(); while( pProperty ) { Add_Property(&pProperty->GetName(), &pProperty->GetValue()); pProperty = pProperty->GetNext(); } //----------------------------------------------------- wxXmlNode *pChild = pNode->GetChildren(); while( pChild ) { if( pChild->GetType() != wxXML_TEXT_NODE ) { Add_Child()->_Load(pChild); } pChild = pChild->GetNext(); } }
//--------------------------------------------------------- void CSG_MetaData::_Load(wxXmlNode *pNode) { Set_Name (SG_UTF8_To_String(pNode->GetName ()).c_str()); Set_Content (SG_UTF8_To_String(pNode->GetNodeContent()).c_str()); //----------------------------------------------------- wxXmlProperty *pProperty = pNode->GetProperties(); while( pProperty ) { Add_Property(SG_UTF8_To_String(pProperty->GetName()).c_str(), SG_UTF8_To_String(pProperty->GetValue()).c_str()); pProperty = pProperty->GetNext(); } //----------------------------------------------------- wxXmlNode *pChild = pNode->GetChildren(); while( pChild ) { if( pChild->GetType() != wxXML_TEXT_NODE ) { Add_Child()->_Load(pChild); } pChild = pChild->GetNext(); } }
//--------------------------------------------------------- bool CSG_MetaData::Assign(const CSG_MetaData &MetaData, bool bAppend) { int i; if( !bAppend ) { Destroy(); Set_Name (MetaData.Get_Name ()); Set_Content (MetaData.Get_Content()); //------------------------------------------------- for(i=0; i<MetaData.Get_Property_Count(); i++) { Add_Property(MetaData.Get_Property_Name(i), MetaData.Get_Property(i)); } } //----------------------------------------------------- for(i=0; i<MetaData.Get_Children_Count(); i++) { Add_Child()->Assign(*MetaData.Get_Child(i), false); } return( true ); }
//--------------------------------------------------------- bool CSG_MetaData::Add_Children(const CSG_MetaData &MetaData) { if( &MetaData != this ) { for(int i=0; i<MetaData.Get_Children_Count(); i++) { Add_Child(MetaData[i], true); } } return( true ); }
//--------------------------------------------------------- CSG_MetaData * CSG_MetaData::Add_Child(const CSG_String &Name, const SG_Char *Content) { CSG_MetaData *pChild = Add_Child(); if( pChild ) { pChild->m_Name = Name; pChild->m_Content = Content ? Content : SG_T(""); } return( pChild ); }
CSG_MetaData * CSG_MetaData::Add_Child(const CSG_String &Name, int Content) { return( Add_Child(Name, CSG_String::Format(SG_T("%d"), Content)) ); }