MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetBool

Function GetBool

trinity/Shader/Tr2Effect.cpp:1638–1654  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Find an annotation called annotationName in the map, and return its value. If not found, or it's not a bool, or map is nullptr, return defaultValue instead. Arguments: map - annotation map, may be nullptr annotationName - name of the annotation, may be nullptr defaultValue - what to return if not fo

Source from the content-addressed store, hash-verified

1636// the value of this annotation, if it can be found and is of type BOOL.
1637// -------------------------------------------------------------------------------------
1638bool GetBool( const Tr2EffectParameterAnnotationMap* map, const char* annotationName, bool defaultValue )
1639{
1640 CCP_STATS_ZONE( __FUNCTION__ );
1641
1642 if( !map || !annotationName )
1643 {
1644 return defaultValue;
1645 }
1646
1647 auto value = std::find_if( map->begin(), map->end(), [&]( const Tr2EffectParameterAnnotation& a ) { return strcmp( a.name, annotationName ) == 0; } );
1648 if( value != map->end() && value->type == Tr2EffectParameterAnnotation::BOOL )
1649 {
1650 return value->boolValue;
1651 }
1652
1653 return defaultValue;
1654}
1655
1656// --------------------------------------------------------------------------------------
1657// Description:

Callers 2

PopulateParametersMethod · 0.85
PruneParametersMethod · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected