Loading...   

  • Created By Uleat On: 07:41 PM August 08, 2015
  • Link

/*
EQEMu:  Everquest Server Emulator

Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

#pragma once

#include "ienum.h"

class ClientVersion : public IEnumInstantiable<int, uint32>
{
public:
	typedef _v ClientVersion_v;
	typedef _b ClientVersion_b;

	typedef enum : ClientVersion_v {
		Unknown = 0,
		TitaniumEdition,		// Build: 'Oct 31 2005 10:33:37'
		SecretsofFaydwer,		// Build: 'Sep  7 2007 09:11:49'
		ShardsofDestruction,	// Build: 'Dec 19 2008 15:22:49'
		Underfoot,				// Build: 'Jun  8 2010 16:44:32'
		RainofFear,				// Build: 'Dec 10 2012 17:35:44'
		RainofFear2,			// Build: 'May 10 2013 23:30:08'
		TheDarkenedSea			// Build: 'May 27 2015 18:23:40'
	} enum_client_version;

	static const ClientVersion_v first = TitaniumEdition;
	static const ClientVersion_v last = TheDarkenedSea;
	static const ClientVersion_v count = (last - first) + 1;
	static const ClientVersion_v invalid = Unknown;

	static bool IsValid(ClientVersion_v enumValue) {
		return (enumValue >= first && enumValue <= last);
	}

	static ClientVersion_v Validate(ClientVersion_v enumValue) {
		if (IsValid(enumValue))
			return enumValue;
		else
			return invalid;
	}

	static ClientVersion_b ValueToBitmask(ClientVersion_v enumValue) {
		if (IsValid(enumValue))
			return (1 << (enumValue - 1));
		else
			return 0;
	}

	static ClientVersion_v BitmaskToValue(ClientVersion_b enumBitmask) {
		switch (enumBitmask) {
		case (1 << (TitaniumEdition - 1)):
			return TitaniumEdition;
		case (1 << (SecretsofFaydwer - 1)):
			return SecretsofFaydwer;
		case (1 << (ShardsofDestruction - 1)):
			return ShardsofDestruction;
		case (1 << (Underfoot - 1)):
			return Underfoot;
		case (1 << (RainofFear - 1)):
			return RainofFear;
		case (1 << (RainofFear2 - 1)):
			return RainofFear2;
		case (1 << (TheDarkenedSea - 1)):
			return TheDarkenedSea;
		default:
			return invalid;
		}
	}

	static std::string ValueToString(ClientVersion_v enumValue) {
		switch (enumValue) {
		case TitaniumEdition:
			return "Titanium Edition";
		case SecretsofFaydwer:
			return "Secrets of Faydwer";
		case ShardsofDestruction:
			return "Shards of Destruction";
		case Underfoot:
			return "Underfoot";
		case RainofFear:
			return "Rain of Fear";
		case RainofFear2:
			return "Rain of Fear 2";
		case TheDarkenedSea:
			return "The Darkened Sea";
		default:
			return "Unknown";
		}
	}

	static std::string BitmaskToString(ClientVersion_b enumBitmask) {
		return (ValueToString(BitmaskToValue(enumBitmask)));
	}

	ClientVersion() {
		set(invalid);
	}

	ClientVersion(ClientVersion& dataRef) {
		set(dataRef.get_v());
	}

	ClientVersion(ClientVersion_v enumValue) {
		set(enumValue);
	}

	virtual ~ClientVersion();

	void value(ClientVersion_v enumValue) {
		set(enumValue);
	}

	ClientVersion_v value() {
		return get_v();
	}

	ClientVersion_b bitmask() {
		return get_b();
	}

	void operator = (ClientVersion_v enumValue) {
		set(enumValue);
	}

	bool operator == (ClientVersion_v enumValue) {
		return (get_v() == enumValue);
	}

	bool operator != (ClientVersion_v enumValue) {
		return (get_v() != enumValue);
	}

	operator ClientVersion_v() {
		return get_v();
	}

	std::string ToString() {
		return ValueToString(get_v());
	}
};

Raw Paste Data