void CContainerTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how) const { if (how == eShallowChildless) { SetDefault(dst); // clear destination container return; } CIterator idst; CConstIterator isrc; bool old_element = InitIterator(idst,dst); if ( InitIterator(isrc, src) ) { TTypeInfo elementType = GetElementType(); do { TConstObjectPtr elementPtr = GetElementPtr(isrc); if (old_element) { elementType->Assign(GetElementPtr(idst), elementPtr, how); old_element = NextElement(idst); } else { AddElement(dst, elementPtr, how); } } while ( NextElement(isrc) ); } if (old_element) { EraseAllElements(idst); } }
void CAliasTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how) const { #if 1 GetPointedType()->Assign(dst, src, how); #else TConstObjectPtr data = GetObjectPointer(src); TTypeInfo type = GetRealDataTypeInfo(data); TObjectPtr object = GetObjectPointer(dst); type->Assign(object, data, how); #endif }
void CPointerTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how) const { TConstObjectPtr data = GetObjectPointer(src); if ( how != eRecursive ) { SetObjectPointer(dst, how == eShallow ? (const_cast<void*>(data)) : 0); } else if ( data == 0) { SetObjectPointer(dst, 0); } else { TTypeInfo type = GetRealDataTypeInfo(data); TObjectPtr object = type->Create(); type->Assign(object, data, how); SetObjectPointer(dst, object); } }