/// <summary> /// Gets the object attributes for the given <paramref name="objectName"/> /// using the information from the given <paramref name="attribute"/>. /// This adds the object to the list of container objects if-and-only-if the /// object is a container object. /// </summary> /// <param name="objectName">the object name</param> /// <param name="attribute">the attribute for the given object name</param> /// <param name="allContainerObjects">the list of all container objects</param> /// <returns>the object attributes</returns> private static ObjectAttributes GetObjectAttributes(AsfObjectName objectName, AsfAttribute attribute, ICollection <AsfObjectName> allContainerObjects) { // Retrieve list of object types (GUID) List <Guid> objectTypes = new List <Guid>(); if (attribute.ObjectType != null) { foreach (string objectType in attribute.ObjectType.Split("|".ToCharArray())) { objectTypes.Add(new Guid(objectType)); } } // Retrieve suitable parents, all container objects if empty list ICollection <AsfObjectName> suitableParents = attribute.SuitableParents; if (suitableParents.Count == 0) { suitableParents = allContainerObjects; } // Update list of all container objects if ((attribute.ObjectFlags & ObjectFlags.ContainerObject) == ObjectFlags.ContainerObject) { allContainerObjects.Add(objectName); } return(new ObjectAttributes(objectTypes.AsReadOnly(), attribute.ObjectFlags, suitableParents)); }
/// <summary> /// Gets the object type flags for the given <paramref name="objectName"/>. /// </summary> /// <param name="objectName">the object name</param> /// <returns>the object flags</returns> public static ObjectFlags GetObjectFlags(this AsfObjectName objectName) { return(ObjectAttributesForObjectName[objectName].ObjectFlags); }
/// <summary> /// Returns whether the given <paramref name="objectFlag"/> is set for /// the given <paramref name="objectName"/>. /// </summary> /// <param name="objectName">the object name</param> /// <param name="objectFlag">the flag to test</param> /// <returns>true if the flag is set, false otherwise</returns> public static bool IsFlagSet(this AsfObjectName objectName, ObjectFlags objectFlag) { return((objectName.GetObjectFlags() & objectFlag) == objectFlag); }
/// <summary> /// Gets the suitable parents for the given <paramref name="objectName"/>. /// </summary> /// <param name="objectName">the object name</param> /// <returns>the suitable parents</returns> public static ICollection <AsfObjectName> GetSuitableParents(this AsfObjectName objectName) { return(ObjectAttributesForObjectName[objectName].SuitableParents); }
public static bool IsTopLevel(this AsfObjectName objectName) { ICollection <AsfObjectName> suitableParents = objectName.GetSuitableParents(); return(suitableParents.Count == 1 && suitableParents.Contains(AsfObjectName.Root)); }