private IEnumerable <ProtoXamlInstruction> ParseNestedProperty(XamlType xamlType) { var propertyLocator = PropertyLocator.Parse(reader.LocalName); var namespaceDeclaration = new NamespaceDeclaration(reader.Namespace, reader.Prefix); yield return(instructionBuilder.NonEmptyPropertyElement(xamlType.UnderlyingType, propertyLocator.PropertyName, namespaceDeclaration)); reader.Read(); foreach (var p in ParseInnerTextIfAny()) { yield return(p); } SkipWhitespaces(); if (reader.NodeType != XmlNodeType.EndElement) { foreach (var instruction in ParseChildren()) { yield return(instruction); } } yield return(instructionBuilder.EndTag()); }
private MutableMember GetMemberForDottedLocator(PropertyLocator propertyLocator) { var ownerName = propertyLocator.Owner.PropertyName; var ownerPrefix = propertyLocator.Owner.Prefix; var owner = typeSource.GetByPrefix(ownerPrefix, ownerName); MutableMember member = owner.GetAttachableMember(propertyLocator.PropertyName); return(member); }
private ProtoInstruction InjectPropertyInstruction(XamlType xamlType, PropertyLocator propertyLocator, NamespaceDeclaration namespaceDeclaration) { if (IsNormalProperty(xamlType, propertyLocator)) { return(instructionBuilder.NonEmptyPropertyElement(xamlType.UnderlyingType, propertyLocator.PropertyName, namespaceDeclaration)); } else { var owner = typeSource.GetByPrefix(propertyLocator.Prefix, propertyLocator.OwnerName); return(instructionBuilder.ExpandedAttachedProperty(owner.UnderlyingType, propertyLocator.PropertyName, namespaceDeclaration)); } }
public UnboundAttribute(PropertyLocator propLocator, string val) { Locator = propLocator; Value = val; Type = AttributeType.Property; if (!TryExtractNamespacePrefixDefinition(out xmlnsDefinitionPrefix, out xmlnsDefinitionUri)) { return; } Type = AttributeType.Namespace; }
public RawDirective(PropertyLocator locator, string value) : base(locator, value) { }
private XamlMember GetAttachableMember(PropertyLocator memberLocator, IXamlTypeRepository typeRepository) { var owner = memberLocator.OwnerName; var ownerType = typeRepository.GetByPrefix(memberLocator.Prefix, owner); return typeRepository.GetXamlType(ownerType.UnderlyingType).GetAttachableMember(Locator.PropertyName); }
protected UnprocessedAttributeBase(PropertyLocator locator, string value) { Locator = locator; Value = value; }
private AttributeAssignment GetAttribute() { return(new AttributeAssignment(PropertyLocator.Parse(reader.Name), reader.Value)); }
public AttributeAssignment(PropertyLocator locator, string value) : base(locator, value) { }
private XamlMember GetDottedProperty(XamlType tagType, PropertyLocator propLocator) { if (tagType == null) { throw new ArgumentNullException(nameof(tagType)); } var xamlNamespace = ResolveXamlNameNs(propLocator); if (xamlNamespace == null) { throw new XamlParseException("PrefixNotFound"); } var xamlTypeName = new XamlTypeName(xamlNamespace, propLocator.Owner.PropertyName); var xamlType = typingCore.GetWithFullAddress(xamlTypeName); return xamlType.GetMember(propLocator.PropertyName); }
private void ReadPropertyElement(PropertyLocator locator, XamlType tagType, bool isEmptyTag) { var xamlBareAttributes = EnqueuePrefixDefinitionsAndGetTheRestOfAttributes(); var namespaceUri = xmlReader.NamespaceURI; var tagIsRoot = stack.Depth == 1; var dottedProperty = GetDottedProperty(tagType, locator); var node = new ProtoParserNode { Prefix = locator.Prefix, TypeNamespace = namespaceUri, IsEmptyTag = isEmptyTag }; var fullyFledgedAttributes = GetAttributes(xamlBareAttributes, node.Type).ToList(); if (stack.Depth > 0) { stack.IsCurrentlyInsideContent = false; } node.PropertyElement = dottedProperty; if (!node.IsEmptyTag) { stack.CurrentProperty = node.PropertyElement; node.NodeType = NodeType.PropertyElement; } else { node.NodeType = NodeType.EmptyPropertyElement; } nodes.Enqueue(node); EnqueueAttributes(fullyFledgedAttributes); }
private static bool IsNormalProperty(XamlType xamlType, PropertyLocator propertyLocator) { return(!propertyLocator.IsDotted || propertyLocator.IsDotted && propertyLocator.OwnerName == xamlType.Name); }
private XamlMember GetProperty(PropertyLocator propLocator, XamlType xamType, IXamlTypeRepository typingCore) { return propLocator.IsDotted ? GetAttachableMember(propLocator, typingCore) : GetRegularMember(xamType, typingCore); }
private MutableXamlMember GetMemberForDottedLocator(PropertyLocator propertyLocator) { var ownerName = propertyLocator.Owner.PropertyName; var ownerPrefix = propertyLocator.Owner.Prefix; var owner = wiringContext.TypeContext.GetByPrefix(ownerPrefix, ownerName); MutableXamlMember member = owner.GetAttachableMember(propertyLocator.PropertyName); return member; }
public UnprocessedAttribute(PropertyLocator locator, string value) { Locator = locator; Value = value; }
private MutableMember GetMemberForDottedLocator(PropertyLocator propertyLocator) { var ownerName = propertyLocator.Owner.PropertyName; var ownerPrefix = propertyLocator.Owner.Prefix; var owner = typeSource.GetByPrefix(ownerPrefix, ownerName); MutableMember member = owner.GetAttachableMember(propertyLocator.PropertyName); return member; }
private static bool IsNormalProperty(XamlType xamlType, PropertyLocator propertyLocator) { return !propertyLocator.IsDotted || propertyLocator.IsDotted && propertyLocator.OwnerName == xamlType.Name; }
private ProtoInstruction InjectPropertyInstruction(XamlType xamlType, PropertyLocator propertyLocator, NamespaceDeclaration namespaceDeclaration) { if (IsNormalProperty(xamlType, propertyLocator)) { return instructionBuilder.NonEmptyPropertyElement(xamlType.UnderlyingType, propertyLocator.PropertyName, namespaceDeclaration); } else { var owner = typeSource.GetByPrefix(propertyLocator.Prefix, propertyLocator.OwnerName); return instructionBuilder.ExpandedAttachedProperty(owner.UnderlyingType, propertyLocator.PropertyName, namespaceDeclaration); } }
public UnprocessedAttribute(PropertyLocator locator, string value) : base(locator, value) { }