Ejemplo n.º 1
0
FrameListPtr FrameListParameter::getFrameListValue( const StringData *value ) const
{
	FrameListPtr frameList = FrameList::parse( value->readable() );
	if ( !m_allowEmptyList && frameList->isInstanceOf( EmptyFrameListTypeId ) )
	{
		throw Exception( "Empty frame list not allowed!" );
	}

	return frameList;
}
Ejemplo n.º 2
0
bool FrameListParameter::valueValid( const Object *value, std::string *reason ) const
{
	if( !StringParameter::valueValid( value, reason ) )
	{
		return false;
	}

	const StringData *stringValue = assertedStaticCast<const StringData>( value );

	try
	{
		FrameListPtr frameList = FrameList::parse( stringValue->readable() );
		assert( frameList ); // If we didn't throw an exception, we must have successfully created a FrameList instance

		if ( !m_allowEmptyList && frameList->isInstanceOf( EmptyFrameListTypeId ) )
		{
			if ( reason )
			{
				*reason = "Value must not be empty.";
			}

			return false;
		}

	}
	catch ( std::exception &e )
	{
		if ( reason )
		{
			*reason = e.what();
		}

		return false;
	}

	return true;
}