[BW]: [Ign] Fixed compile errors (missing < operator on fc::enum_type

[BW]: [Ign] Eliminated some annoying compiler warnings.
This commit is contained in:
vogel76 2014-01-29 12:51:45 +01:00
parent ff2173c8d6
commit 10a6e76375
4 changed files with 30 additions and 11 deletions

View file

@ -24,16 +24,23 @@ namespace fc
enum_type& operator=( IntType i ) { value = (EnumType)i; return *this;}
enum_type& operator=( EnumType i ) { value = i; return *this;}
friend bool operator==( enum_type e, IntType i ) { return e.value == (EnumType)i; }
friend bool operator==( enum_type e, EnumType i ) { return e.value == i; }
bool operator<(const enum_type& e) const { return value < e.value;}
bool operator>(const enum_type& e) const { return value > e.value;}
bool operator<=(const enum_type& e) const { return value <= e.value;}
bool operator>=(const enum_type& e) const { return value >= e.value;}
friend bool operator==( const enum_type& e, IntType i ){ return e.value == (EnumType)i;}
friend bool operator==( const enum_type& e, EnumType i ){ return e.value == i; }
friend bool operator==( const enum_type& e, const enum_type& i ){ return e.value == i.value; }
friend bool operator==( IntType i, const enum_type& e){ return e.value == (EnumType)i; }
friend bool operator==( EnumType i, const enum_type& e ){ return e.value == i; }
friend bool operator!=( const enum_type& e, IntType i ){ return e.value != (EnumType)i;}
friend bool operator!=( const enum_type& e, EnumType i ){ return e.value != i; }
friend bool operator!=( const enum_type& e, const enum_type& i ){ return e.value != i.value; }
friend bool operator==( enum_type e, enum_type i ) { return e.value == i.value; }
friend bool operator==( IntType i, enum_type e) { return e.value == (EnumType)i; }
friend bool operator==( EnumType i, enum_type e ) { return e.value == i; }
friend bool operator!=( enum_type e, IntType i ) { return e.value != (EnumType)i; }
friend bool operator!=( enum_type e, EnumType i ) { return e.value != i; }
friend bool operator!=( enum_type e, enum_type i ) { return e.value != i.value; }
EnumType value;
};

View file

@ -106,7 +106,7 @@ namespace fc {
v |= uint32_t(uint8_t(b) & 0x7f) << by;
by += 7;
} while( uint8_t(b) & 0x80 );
vi.value = v;
vi.value = static_cast<uint32_t>(v);
}
template<typename Stream> inline void pack( Stream& s, const char* v ) { pack( s, fc::string(v) ); }
@ -153,7 +153,7 @@ namespace fc {
// bool
template<typename Stream> inline void pack( Stream& s, const bool& v ) { pack( s, uint8_t(v) ); }
template<typename Stream> inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=b; }
template<typename Stream> inline void unpack( Stream& s, bool& v ) { uint8_t b; unpack( s, b ); v=(b!=0); }
namespace detail {

View file

@ -3,6 +3,9 @@
#include <fc/string.hpp>
#include <fc/optional.hpp>
#pragma warning (push)
#pragma warning (disable : 4244)
namespace fc {
class microseconds {
public:
@ -87,3 +90,6 @@ namespace fc {
typedef fc::optional<time_point> otime_point;
}
#pragma warning (pop)

View file

@ -2,6 +2,9 @@
#include <stdint.h>
#include <string>
#pragma warning (push)
#pragma warning (disable : 4244)
namespace fc
{
class bigint;
@ -110,3 +113,6 @@ namespace std
}
};
}
#pragma warning (pop)