X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9fdd83842f5ead4ef45852b9943df36c38b4d7d7..7b65ea1af911e4ba65c47e2ed4f3138367b2bdbb:/utils/serialize/sercore.cpp diff --git a/utils/serialize/sercore.cpp b/utils/serialize/sercore.cpp index dbd55e2510..0fffba7f5b 100644 --- a/utils/serialize/sercore.cpp +++ b/utils/serialize/sercore.cpp @@ -1,11 +1,25 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: sercore.cpp +// Purpose: Serialization: core classes +// Author: Guilhem Lavaux +// Modified by: +// Created: July 1998 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Guilhem Lavaux +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + #ifdef __GNUG__ #pragma implementation "sercore.h" #endif #include #include +#include +#include #include "sercore.h" -IMPLEMENT_SERIAL_CLASS(wxList,wxObject) +IMPLEMENT_SERIAL_CLASS(wxList, wxObject) +IMPLEMENT_SERIAL_CLASS(wxHashTable, wxObject) void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s) { @@ -51,9 +65,43 @@ void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s) if (list->key_type == wxKEY_INTEGER) { for (i=0;iAppend( data_s.Read32(), s.GetChild(i) ); + list->Append( data_s.Read32(), s.GetChild() ); } else { for (i=0;iAppend( data_s.ReadString(), s.GetChild(i) ); + list->Append( data_s.ReadString(), s.GetChild() ); + } +} + +// ---------------------------------------------------------------------------- + +void WXSERIAL(wxHashTable)::StoreObject(wxObjectOutputStream& s) +{ + wxHashTable *table = (wxHashTable *)Object(); + int i; + + if (s.FirstStage()) { + for (i=0;in;i++) + s.AddChild(table->hash_table[i]); + return; } + + wxDataOutputStream data_s(s); + + data_s.Write8(table->key_type); + data_s.Write32(table->n); +} + +void WXSERIAL(wxHashTable)::LoadObject(wxObjectInputStream& s) +{ + wxHashTable *table = (wxHashTable *)Object(); + wxDataInputStream data_s(s); + int i, key, n; + + key = data_s.Read8(); + n = data_s.Read32(); + + table->Create(key, n); + + for (i=0;ihash_table[i] = (wxList *)s.GetChild(); }