company logo

Option :: toBool - Get option value as Boolean

The function returns true , when the option contains a true value ( isTrue() ), or false, when the option contains a false value ( isFalse() ). When the option value it neither true nor false, the function throws an exception. In order to avoid exceptions, one may also call isTrue() or isFalse() .

// check option before converting to Boolean

  if ( !Option("MyOption").toString().isEmpty() )

    myOption = Option("MyOption").toBool();

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false .

Implementation details

bool Option  :: toBool (  )