|
|
1.1 root 1: /*
1.1.1.6 root 2: Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
1.1 root 3:
1.1.1.7 ! root 4: Governed by the TrueCrypt License 3.0 the full text of which is contained in
1.1.1.6 root 5: the file License.txt included in TrueCrypt binary and source code distribution
6: packages.
1.1 root 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.