mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
+ Got rid of zip lib requirement in G3D...
Still can re-enable code by defining _HAVE_ZIP...
+ Remove silly X11 lib dependency from G3D
Code doesn't seem to do anything yet anyway, and even if, we don't want it :p
+ Fix another weird G3D build problem...
+ Remove some __asm usage in g3d, which is not available on Win64
My editor also decided to remove a ton of trailing white spaces...tss...
+ Reapply G3D fixes for 64bit VC
+ not use SSE specific header when SSE not enabled in *nix
+ Updated project files
+ New vmap_assembler VC90/VC80 Project
+ vmap assembler binaries updates
NOTE: Old vmap fikes expected work (as tests show) with new library version.
But better use new generated versions. Its different in small parts to bad or good...
(based on Lynx3d's repo commit 44798d3)
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
147 lines
4.1 KiB
C++
147 lines
4.1 KiB
C++
/**
|
|
@file G3D/enumclass.h
|
|
|
|
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
|
|
@created 2007-01-27
|
|
@edited 2007-07-20
|
|
*/
|
|
#ifndef G3D_enumclass_h
|
|
#define G3D_enumclass_h
|
|
|
|
#include "G3D/HashTrait.h"
|
|
#include "G3D/BinaryInput.h"
|
|
#include "G3D/BinaryOutput.h"
|
|
|
|
/**
|
|
\def G3D_DECLARE_ENUM_CLASS_METHODS
|
|
|
|
\brief Creates a series of methods that turn a class into a scoped enumeration.
|
|
|
|
Uses the "Intelligent Enum" design pattern
|
|
http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4001/
|
|
|
|
Enum classes are initialized to their zero value by default.
|
|
|
|
See GLG3D/GKey.h for an example.
|
|
\sa G3D_DECLARE_ENUM_CLASS_HASHCODE
|
|
*/
|
|
#define G3D_DECLARE_ENUM_CLASS_METHODS(Classname)\
|
|
inline Classname(char v) : value((Value)v) {}\
|
|
\
|
|
inline Classname() : value((Value)0) {}\
|
|
\
|
|
inline Classname(const Value v) : value(v) {}\
|
|
\
|
|
explicit inline Classname(int v) : value((Value)v) {}\
|
|
\
|
|
/** Support cast back to the Value type, which is needed to allow implicit assignment inside unions. */\
|
|
/*inline operator Value() const {
|
|
return value;
|
|
}*/\
|
|
\
|
|
inline operator int() const {\
|
|
return (int)value;\
|
|
}\
|
|
\
|
|
inline bool operator== (const Classname other) const {\
|
|
return value == other.value;\
|
|
}\
|
|
\
|
|
inline bool operator== (const Classname::Value other) const {\
|
|
return value == other;\
|
|
}\
|
|
\
|
|
inline bool operator!= (const Classname other) const {\
|
|
return value != other.value;\
|
|
}\
|
|
\
|
|
inline bool operator!= (const Classname::Value other) const {\
|
|
return value != other;\
|
|
}\
|
|
\
|
|
inline bool operator< (const Classname other) const {\
|
|
return value < other.value;\
|
|
}\
|
|
\
|
|
inline bool operator> (const Classname other) const {\
|
|
return value > other.value;\
|
|
}\
|
|
\
|
|
inline bool operator>= (const Classname other) const {\
|
|
return value >= other.value;\
|
|
}\
|
|
\
|
|
inline bool operator<= (const Classname other) const {\
|
|
return value <= other.value;\
|
|
}\
|
|
\
|
|
inline bool operator< (const Value other) const {\
|
|
return value < other;\
|
|
}\
|
|
\
|
|
inline bool operator> (const Value other) const {\
|
|
return value > other;\
|
|
}\
|
|
\
|
|
inline bool operator<= (const Value other) const {\
|
|
return value <= other;\
|
|
}\
|
|
\
|
|
inline bool operator>= (const Value other) const {\
|
|
return value >= other;\
|
|
}\
|
|
\
|
|
inline Classname& operator-- () {\
|
|
value = (Value)((int)value - 1);\
|
|
return *this;\
|
|
}\
|
|
\
|
|
inline Classname& operator++ () {\
|
|
value = (Value)((int)value + 1);\
|
|
return *this;\
|
|
}\
|
|
\
|
|
inline Classname& operator+= (const int x) {\
|
|
value = (Value)((int)value + x);\
|
|
return *this;\
|
|
}\
|
|
\
|
|
inline Classname& operator-= (const int x) {\
|
|
value = (Value)((int)value - x);\
|
|
return *this;\
|
|
}\
|
|
\
|
|
inline Classname operator+ (const int x) const {\
|
|
return Classname((int)value + x);\
|
|
}\
|
|
\
|
|
inline Classname operator- (const int x) const {\
|
|
return Classname((int)value - x);\
|
|
}\
|
|
\
|
|
inline unsigned int hashCode() const {\
|
|
return (unsigned int)value;\
|
|
}\
|
|
\
|
|
inline void serialize(BinaryOutput& b) const {\
|
|
b.writeInt32(value);\
|
|
}\
|
|
\
|
|
inline void deserialize(BinaryInput& b) {\
|
|
value = (Value)b.readInt32();\
|
|
}
|
|
|
|
/** \def G3D_DECLARE_ENUM_CLASS_HASHCODE
|
|
*/
|
|
#define G3D_DECLARE_ENUM_CLASS_HASHCODE(Classname)\
|
|
template <> struct HashTrait<Classname::Value> \
|
|
{ \
|
|
static size_t hashCode(Classname::Value key) { return static_cast<size_t>(key); } \
|
|
}; \
|
|
\
|
|
template <> struct HashTrait<Classname> \
|
|
{ \
|
|
static size_t hashCode(Classname key) { return static_cast<size_t>(key.hashCode()); } \
|
|
};
|
|
|
|
#endif
|