Home » U++ Library support » U++ Core » (Possible) Serialization issue
Re: (Possible) Serialization issue [message #17236 is a reply to message #17235] |
Mon, 04 August 2008 09:36 |
bytefield
Messages: 210 Registered: December 2007
|
Experienced Member |
|
|
Well, what if we use a "dirty" solution and instead of renaming it we declare a pointer to Load function and then declare Load as deprecated and after a while replace that pointer with content from Load, resulting a new function LoadFromFileWithBackup?
// Solution
bool (*LoadFromFileWithBackup)(Callback1<Stream&> serialize, Stream& stream) = & Load;
and after a while...
bool LoadFromFileWithBackup(Callback1<Stream&> serialize, Stream& stream)
{
StringStream backup;
backup.SetStoring();
serialize(backup);
ASSERT(!backup.IsError());
stream.SetLoading();
stream.LoadThrowing();
try {
CheckedSerialize(serialize, stream);
}
catch(LoadingError) {
backup.Seek(0);
backup.SetLoading();
serialize(backup);
ASSERT(!backup.IsError());
return false;
}
return true;
}
cdabbd745f1234c2751ee1f932d1dd75
|
|
|
Goto Forum:
Current Time: Sun May 12 09:29:07 CEST 2024
Total time taken to generate the page: 0.02700 seconds
|