ACAPI_​Property_​IsValidValue

Returns true if the value is acceptable for the given property definition.

    bool  ACAPI_Property_IsValidValue (
        const API_PropertyValue&        value
        const API_PropertyDefinition&   definition
    );
	

 

Parameters

value
[in] The value to check.
definition
[in] The valueType, collectionType and possibleEnumValues of the definition will be used to check the validity of the value.

 

Return Values

true
The given value’s variantStatus is API_VariantStatusNormal or API_VariantStatusUserUndefined and value’s variant.type is the same as definition’s valueType.
For definition with collectionType of API_PropertySingleChoiceEnumerationCollectionType or API_PropertyMultipleChoiceEnumerationCollectionType possibleEnumValues must contain value’s variant(s).
false
For any other case.

 

Example


GS::Array GetPropertiesOfElementForPropertyValue (const API_Guid& elemGuid, const API_PropertyValue& propertyValue)
{
    GS::Array<API_PropertyDefinition> definitions;
    ACAPI_Element_GetPropertyDefinitions (elemGuid, API_PropertyDefinitionFilter_UserDefined, definitions);

    GS::Array<API_PropertyDefinition> filteredDefinition;
    for (const API_PropertyDefinition& definition : definitions) {
        if (ACAPI_Property_IsValidValue (propertyValue, definition)) {
            filteredDefinition.Push (definition);
        }
    }
    return filteredDefinition;
}
        
For more detailed examples, please see the Property_Test add-on.

 

Requirements

Version: API 25 or later
Header: ACAPinc.h

 

See Also

Properties,
API Functions