operator bool()

This commit is contained in:
David Rose 2009-01-20 03:17:59 +00:00
parent a6f4fb2377
commit 5d73bc8e19
2 changed files with 13 additions and 0 deletions

View File

@ -222,6 +222,17 @@ is_empty() const {
return (_head == (NodePathComponent *)NULL);
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::operator bool
// Access: Published
// Description: Returns true if the NodePath is valid (not empty),
// or false if it contains no nodes.
////////////////////////////////////////////////////////////////////
INLINE NodePath::
operator bool () const {
return !is_empty();
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::is_singleton
// Access: Published

View File

@ -177,6 +177,8 @@ PUBLISHED:
// Methods to query a NodePath's contents.
INLINE bool is_empty() const;
INLINE operator bool () const;
INLINE bool is_singleton(Thread *current_thread = Thread::get_current_thread()) const;
int get_num_nodes(Thread *current_thread = Thread::get_current_thread()) const;
PandaNode *get_node(int index, Thread *current_thread = Thread::get_current_thread()) const;