|
|
1.1 ! root 1: /* ! 2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. ! 3: ! 4: Governed by the TrueCrypt License 2.4 the full text of which is contained ! 5: in the file License.txt included in TrueCrypt binary and source code ! 6: distribution packages. ! 7: */ ! 8: ! 9: #include "Serializable.h" ! 10: #include "SerializerFactory.h" ! 11: ! 12: namespace TrueCrypt ! 13: { ! 14: string Serializable::DeserializeHeader (shared_ptr <Stream> stream) ! 15: { ! 16: Serializer sr (stream); ! 17: return sr.DeserializeString ("SerializableName"); ! 18: } ! 19: ! 20: Serializable *Serializable::DeserializeNew (shared_ptr <Stream> stream) ! 21: { ! 22: string name = Serializable::DeserializeHeader (stream); ! 23: Serializable *serializable = SerializerFactory::GetNewSerializable (name); ! 24: serializable->Deserialize (stream); ! 25: ! 26: return serializable; ! 27: } ! 28: ! 29: void Serializable::Serialize (shared_ptr <Stream> stream) const ! 30: { ! 31: Serializer sr (stream); ! 32: Serializable::SerializeHeader (sr, SerializerFactory::GetName (typeid (*this))); ! 33: } ! 34: ! 35: void Serializable::SerializeHeader (Serializer &serializer, const string &name) ! 36: { ! 37: serializer.Serialize ("SerializableName", name); ! 38: } ! 39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.