mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Add proper comparison operators and get_hash to ButtonHandle
This commit is contained in:
parent
0dc6c663a1
commit
3d19752dc0
@ -76,6 +76,59 @@ operator < (const ButtonHandle &other) const {
|
||||
return (_index < other._index);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::Ordering Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool ButtonHandle::
|
||||
operator <= (const ButtonHandle &other) const {
|
||||
return (_index <= other._index);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::Ordering Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool ButtonHandle::
|
||||
operator > (const ButtonHandle &other) const {
|
||||
return (_index > other._index);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::Ordering Operator
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool ButtonHandle::
|
||||
operator >= (const ButtonHandle &other) const {
|
||||
return (_index >= other._index);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::compare_to
|
||||
// Access: Published
|
||||
// Description: Sorts ButtonHandles arbitrarily (according to <, >,
|
||||
// etc.). Returns a number less than 0 if this type
|
||||
// sorts before the other one, greater than zero if it
|
||||
// sorts after, 0 if they are equivalent.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int ButtonHandle::
|
||||
compare_to(const ButtonHandle &other) const {
|
||||
return _index - other._index;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::get_hash
|
||||
// Access: Published
|
||||
// Description: Returns a hash code suitable for phash_map.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE size_t ButtonHandle::
|
||||
get_hash() const {
|
||||
return (size_t)_index;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonHandle::has_ascii_equivalent
|
||||
// Access: Published
|
||||
|
@ -29,16 +29,19 @@ class EXPCL_PANDA_PUTIL ButtonHandle {
|
||||
PUBLISHED:
|
||||
INLINE ButtonHandle();
|
||||
INLINE ButtonHandle(int index);
|
||||
INLINE ButtonHandle(const ButtonHandle ©);
|
||||
ButtonHandle(const string &name);
|
||||
|
||||
public:
|
||||
INLINE ButtonHandle(const ButtonHandle ©);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE bool operator == (const ButtonHandle &other) const;
|
||||
INLINE bool operator != (const ButtonHandle &other) const;
|
||||
INLINE bool operator < (const ButtonHandle &other) const;
|
||||
INLINE bool operator <= (const ButtonHandle &other) const;
|
||||
INLINE bool operator > (const ButtonHandle &other) const;
|
||||
INLINE bool operator >= (const ButtonHandle &other) const;
|
||||
INLINE int compare_to(const ButtonHandle &other) const;
|
||||
INLINE size_t get_hash() const;
|
||||
|
||||
PUBLISHED:
|
||||
string get_name() const;
|
||||
INLINE bool has_ascii_equivalent() const;
|
||||
INLINE char get_ascii_equivalent() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user