/// <summary> /// Check to see if the type is exposed or not by this entry /// </summary> /// <param name="type">The type to check</param> /// <returns>Null if the type is not within the namespace of this entry, true if it is and it is exposed /// or false if it is and it is not exposed.</returns> public bool?IsExposedType(TypeNode type) { if (this.IsExposedNamespace(type.GetNamespace()) != null) { foreach (TypeFilter typeFilter in typeFilters) { bool?result = typeFilter.IsExposedType(type); if (result != null) { return(result); } } // No filter matches for this type, check the parents since it could be nested TypeNode parent = type.DeclaringType; while (parent != null) { bool?parentExposed = this.IsExposedType(parent); if (parentExposed != null) { return(parentExposed); } parent = type.DeclaringType; } // No filters match for the parents either, use the namespace setting return(exposed); } return(null); }
/// <summary> /// Check to see if the member is exposed or not by this entry /// </summary> /// <param name="member">The member to check</param> /// <returns>Null if the member is not within a type in the namespace of this entry, true if it is and it /// is exposed or false if it is and it is not exposed.</returns> public bool?IsExposedMember(Member member) { if (member == null) { throw new ArgumentNullException(nameof(member)); } TypeNode type = member.DeclaringType.GetTemplateType(); if (this.IsExposedNamespace(type.GetNamespace()) != null) { foreach (TypeFilter typeFilter in typeFilters) { bool?result = typeFilter.IsExposedMember(member); if (result != null) { return(result); } } // No filters matched this method, check if the type is exposed. If no types match, use the // namespace setting. return(this.IsExposedType(type) ?? exposed); } return(null); }
/// <summary> /// This is used to find out if the given type is in this namespace and has any exposed members /// </summary> /// <param name="type">The type to check</param> /// <returns>True if the type is in this namespace and has exposed members, false if not</returns> public bool HasExposedMembers(TypeNode type) { if (this.IsExposedNamespace(type.GetNamespace()) != null) { foreach (TypeFilter typeFilter in typeFilters) { bool?result = typeFilter.IsExposedType(type); if (result != null) { return(typeFilter.HasExposedMembers(type)); } } } return(false); }
//===================================================================== /// <summary> /// Check to see if the type is required or not by this entry /// </summary> /// <param name="type">The type to check</param> /// <returns>Null if the type is not within the namespace of this entry, true if it is and it is required /// or false if it is and it is not required.</returns> public bool?IsRequiredType(TypeNode type) { if (this.IsExposedNamespace(type.GetNamespace()) != null) { foreach (TypeFilter typeFilter in typeFilters) { bool?result = typeFilter.IsRequiredType(type); if (result != null) { return(result); } } // No filters match so it's not required return(false); } return(null); }