"Fossies" - the Fresh Open Source Software Archive

Member "src/Platform/Serializer.h" (10 Oct 2018, 3005 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Serializer.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   13 #ifndef TC_HEADER_Platform_Serializer
   14 #define TC_HEADER_Platform_Serializer
   16 #include "PlatformBase.h"
   17 #include "Buffer.h"
   18 #include "SharedPtr.h"
   19 #include "Stream.h"
   21 namespace VeraCrypt
   22 {
   23     class Serializer
   24     {
   25     public:
   26         Serializer (shared_ptr <Stream> stream) : DataStream (stream) { }
   27         virtual ~Serializer () { }
   29         void Deserialize (const string &name, bool &data);
   30         void Deserialize (const string &name, byte &data);
   31         void Deserialize (const string &name, int32 &data);
   32         void Deserialize (const string &name, int64 &data);
   33         void Deserialize (const string &name, uint32 &data);
   34         void Deserialize (const string &name, uint64 &data);
   35         void Deserialize (const string &name, string &data);
   36         void Deserialize (const string &name, wstring &data);
   37         void Deserialize (const string &name, const BufferPtr &data);
   38         bool DeserializeBool (const string &name);
   39         int32 DeserializeInt32 (const string &name);
   40         int64 DeserializeInt64 (const string &name);
   41         uint32 DeserializeUInt32 (const string &name);
   42         uint64 DeserializeUInt64 (const string &name);
   43         string DeserializeString (const string &name);
   44         list <string> DeserializeStringList (const string &name);
   45         wstring DeserializeWString (const string &name);
   46         list <wstring> DeserializeWStringList (const string &name);
   47         void Serialize (const string &name, bool data);
   48         void Serialize (const string &name, byte data);
   49         void Serialize (const string &name, const char *data);
   50         void Serialize (const string &name, int32 data);
   51         void Serialize (const string &name, int64 data);
   52         void Serialize (const string &name, uint32 data);
   53         void Serialize (const string &name, uint64 data);
   54         void Serialize (const string &name, const string &data);
   55         void Serialize (const string &name, const wstring &data);
   56         void Serialize (const string &name, const wchar_t *data);
   57         void Serialize (const string &name, const list <string> &stringList);
   58         void Serialize (const string &name, const list <wstring> &stringList);
   59         void Serialize (const string &name, const ConstBufferPtr &data);
   61     protected:
   62         template <typename T> T Deserialize ();
   63         string DeserializeString ();
   64         wstring DeserializeWString ();
   65         template <typename T> void Serialize (T data);
   66         void SerializeString (const string &data);
   67         void SerializeWString (const wstring &data);
   68         void ValidateName (const string &name);
   70         shared_ptr <Stream> DataStream;
   72     private:
   73         Serializer (const Serializer &);
   74         Serializer &operator= (const Serializer &);
   75     };
   76 }
   78 #endif // TC_HEADER_Platform_Serializer