//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#pragma once

namespace VWFC
{
	namespace Tools
	{
		// NOTE! You have to import library 'Rpcrt4.lib' on windows
		// for this class to be used !!!
		class UUID
		{
		public:
						UUID();
						// the bits are reversed
						//	for example:
						//	{09E95D97-364C-43d5-8ADF-FF4CE0EC41A7}
						//	'975DE909' 'd5434C36' '4CFFDF8A' 'A741ECE0'
						UUID(UInt32 a, UInt32 b, UInt32 c, UInt32 d);
						// copy the bytes one by one
						UUID(UInt8* pArray, size_t size);
						UUID(const UUID& src);
						// Trows exception if not in this format
						// {09E95D97-364C-43d5-8ADF-FF4CE0EC41A7}
						UUID(const TXString& str);
						~UUID();

			UUID&		operator=(const UUID& src);

			bool		operator==(const UUID& id);
			bool		operator!=(const UUID& id);
						operator TXString() const;

			// create four 32 Bit integer from the components of the GUID structure
			// the bits are reversed
			//	for example:
			//	{09E95D97-364C-43d5-8ADF-FF4CE0EC41A7}
			//	'975DE909' 'd5434C36' '4CFFDF8A' 'A741ECE0'
			void		GetUUID(UInt32& out1, UInt32& out2, UInt32& out3, UInt32& out4);
			// copy the byes one by one as they are
			void		GetUUID(UInt8* pArray, size_t size);

			TXString	Encode(const TXString& arrChars);

		protected:
			// {09E95D97-364C-43d5-8ADF-FF4CE0EC41A7}
			UInt8		fData[16];
		};
	}
}
