Annotation of truecrypt/platform/serializer.h, revision 1.1.1.7

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: #ifndef TC_HEADER_Platform_Serializer
                     10: #define TC_HEADER_Platform_Serializer
                     11: 
                     12: #include "PlatformBase.h"
                     13: #include "Buffer.h"
                     14: #include "SharedPtr.h"
                     15: #include "Stream.h"
                     16: 
                     17: namespace TrueCrypt
                     18: {
                     19:        class Serializer
                     20:        {
                     21:        public:
                     22:                Serializer (shared_ptr <Stream> stream) : DataStream (stream) { }
                     23:                virtual ~Serializer () { }
                     24: 
                     25:                void Deserialize (const string &name, bool &data);
                     26:                void Deserialize (const string &name, byte &data);
                     27:                void Deserialize (const string &name, int32 &data);
                     28:                void Deserialize (const string &name, int64 &data);
                     29:                void Deserialize (const string &name, uint32 &data);
                     30:                void Deserialize (const string &name, uint64 &data);
                     31:                void Deserialize (const string &name, string &data);
                     32:                void Deserialize (const string &name, wstring &data);
                     33:                void Deserialize (const string &name, const BufferPtr &data);
                     34:                bool DeserializeBool (const string &name);
                     35:                int32 DeserializeInt32 (const string &name);
                     36:                int64 DeserializeInt64 (const string &name);
                     37:                uint32 DeserializeUInt32 (const string &name);
                     38:                uint64 DeserializeUInt64 (const string &name);
                     39:                string DeserializeString (const string &name);
                     40:                list <string> DeserializeStringList (const string &name);
                     41:                wstring DeserializeWString (const string &name);
                     42:                list <wstring> DeserializeWStringList (const string &name);
                     43:                void Serialize (const string &name, bool data);
                     44:                void Serialize (const string &name, byte data);
                     45:                void Serialize (const string &name, const char *data);
                     46:                void Serialize (const string &name, int32 data);
                     47:                void Serialize (const string &name, int64 data);
                     48:                void Serialize (const string &name, uint32 data);
                     49:                void Serialize (const string &name, uint64 data);
                     50:                void Serialize (const string &name, const string &data);
                     51:                void Serialize (const string &name, const wstring &data);
                     52:                void Serialize (const string &name, const wchar_t *data);
                     53:                void Serialize (const string &name, const list <string> &stringList);
                     54:                void Serialize (const string &name, const list <wstring> &stringList);
                     55:                void Serialize (const string &name, const ConstBufferPtr &data);
                     56: 
                     57:        protected:
                     58:                template <typename T> T Deserialize ();
                     59:                string DeserializeString ();
                     60:                wstring DeserializeWString ();
                     61:                template <typename T> void Serialize (T data);
                     62:                void SerializeString (const string &data);
                     63:                void SerializeWString (const wstring &data);
                     64:                void ValidateName (const string &name);
                     65: 
                     66:                shared_ptr <Stream> DataStream;
                     67: 
                     68:        private:
                     69:                Serializer (const Serializer &);
                     70:                Serializer &operator= (const Serializer &);
                     71:        };
                     72: }
                     73: 
                     74: #endif // TC_HEADER_Platform_Serializer

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.