コード例 #1
0
ファイル: cEventManager.cpp プロジェクト: remesnik/SDLDecker
//
// EventManager::VValidateType			- Chapter 10, page 299
//
// Validate an event type, this does NOT add it to the internal
// registry, only verifies that it is legal ( e.g. either the
// ident number is not yet assigned, or it is assigned to
// matching signature text, and the signature text is not empty
// ).
//
bool cEventManager::VValidateType(
	EventType const & inType ) const{
	if ( 0 == inType.getStr().length() )
		return false;
	if ( ( inType.getHashValue() == 0 ) &&
		(strcmp(inType.getStr().c_str(),kpWildcardEventType) != 0) )
		return false;
	EventTypeSet::const_iterator evIt =
		m_typeList.find( inType );
	if ( evIt == m_typeList.end() ){
		printf("Event Failed validation: not registered with the EventManager!\n");
		return false;
	}

	return true;
}
コード例 #2
0
	// /////////////////////////////////////////////////////////////////
	// 
	// /////////////////////////////////////////////////////////////////
	bool EventManager::VValidateType(EventType const &inType) const
	{
		if ( 0 == inType.getStr().length() )
			return false;

		if ( ( inType.getHashValue() == 0 ) &&
			(strcmp(inType.getStr().c_str(),kpWildcardEventType) != 0) )
			return false;

		EventTypeSet::const_iterator evIt =
			m_typeList.find( inType );

		if ( evIt == m_typeList.end() )
		{
			assert( 0 && "Failed validation of an event type; it was probably not registered with the EventManager!" );
			return false;
		}
		
		return true;
	}