public override void ValidateField(Enums.ColladaElementType parent_type) { if (Value != null && typeof(T).IsSubclassOf(typeof(ColladaElement))) { foreach (var element in Value) { (element as ColladaElement).ValidateElement(parent_type); } } }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="field">The field to run the test on</param> /// <param name="property_name">The proterty name to check the value of in each list element</param> /// <param name="required_value">The value that the list must contain at least one of</param> public ColladaListHasValue(Enums.ColladaElementType valid_parent, ColladaObjectElementList <T1> field, string property_name, T2 required_value) : base(valid_parent) { testField = field; propertyName = property_name; requiredValue = required_value; }
public override void ValidateField(Enums.ColladaElementType parent_type) { if (Value == null) { return; } ColladaElement value = Value as ColladaElement; if (value != null) { value.ValidateElement(parent_type); } }
/// <summary> /// Checks whether this element conforms to the schema /// Throws a validation exception when errors are found /// </summary> /// <param name="parent_type">The collada element type of the parent</param> public void ValidateElement(Enums.ColladaElementType parent_type) { // run each validation test foreach (var test in ValidationTests) { ColladaValidationException exception = test.Validate(parent_type); // if the test returned an exception, create a detail list for it then throw it if (exception != null) { exception.ElementDetails = GetDetailList(); throw exception; } } // validate children foreach (var field in Fields) { field.ValidateField(elementType); } }
/// <summary> /// Runs the validation test /// </summary> /// <param name="parent_type">The parent element type, used to determine whether this test needs to be run</param> /// <returns></returns> public ColladaValidationException Validate(Enums.ColladaElementType parent_type) { bool valid_parent = false; // if the test should be run with any parent type, valid_parent will be true if (_validParentType == Enums.ColladaElementType.All) { valid_parent = true; } else { valid_parent = (parent_type == _validParentType); } // validate the field and return an exception if necessary ColladaValidationException exception = null; if (valid_parent) { exception = ValidateImpl(); } return(exception); }
public ColladaSIDValueArray(Enums.ColladaElementType type) : base(type) { }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="fields">A list of fields to check the presence of</param> public ColladaInvalidForParent(Enums.ColladaElementType valid_parent, List <ColladaObject> fields) : base(valid_parent) { testFields = fields; }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="field">The field to run the test on</param> /// <param name="minimum_count">The minimum number of elements the list must have</param> public ColladaListMinCount(Enums.ColladaElementType valid_parent, ColladaObjectElementList <T> field, int minimum_count) : base(valid_parent) { testField = field; minimumCount = minimum_count; }
public ColladaValidationTest(Enums.ColladaElementType parent_type) { _validParentType = parent_type; }
/// <summary> /// Initialises the base element class with a specific type /// </summary> /// <param name="type">The COLLADA element type of the derived class</param> public ColladaElement(Enums.ColladaElementType type) { elementType = type; }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="fields">A list of fields to run the test on</param> public ColladaOneRequired(Enums.ColladaElementType valid_parent, List <ColladaObject> fields) : base(valid_parent) { _testFields = fields; }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="field">The field to run the test on</param> /// <param name="valid_values">A list of values to check for</param> public ColladaHasValidValue(Enums.ColladaElementType valid_parent, ColladaObject field, List <T> valid_values) : base(valid_parent) { testField = field; validValues = valid_values; }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="field">The field to run the test on</param> public ColladaIsNull(Enums.ColladaElementType valid_parent, ColladaObject field) : base(valid_parent) { testField = field; }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="fields">A list of fields to run the test on</param> public ColladaMutuallyExclusive(Enums.ColladaElementType valid_parent, List <ColladaObject> fields) : base(valid_parent) { testFields = fields; }
public ColladaElement() { elementType = Enums.ColladaElementType.Undefined; }
public ColladaGeometryCommonAttributes(Enums.ColladaElementType type) : base(type) { Fields.Add(_name = new ColladaObjectAttribute <string>("")); Fields.Add(_count = new ColladaObjectAttribute <uint>(0)); Fields.Add(_material = new ColladaObjectAttribute <string>("")); }
/// <summary> /// Validation test constructor /// </summary> /// <param name="valid_parent">The parent collada element type to run this test for. Set to "All" to run regardless of parent type</param> /// <param name="field">The field to run the test on</param> public ColladaEmptyString(Enums.ColladaElementType valid_parent, ColladaObject field) : base(valid_parent) { testField = field; }
public virtual void ValidateField(Enums.ColladaElementType parent_type) { }