Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Xml / System / Xml / XPath / Internal / ParentQuery.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="ParentQuery.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
7
8 namespace MS.Internal.Xml.XPath {
9     using System;
10     using System.Xml;
11     using System.Xml.XPath;
12     using System.Diagnostics;
13     using System.Globalization;
14     using System.Collections.Generic;
15
16     internal sealed class ParentQuery : CacheAxisQuery {
17
18         public ParentQuery(Query  qyInput, string Name, string Prefix, XPathNodeType Type) : base(qyInput, Name, Prefix, Type) {}
19         private ParentQuery(ParentQuery other) : base(other) { }
20
21         public override object Evaluate(XPathNodeIterator context) {
22             base.Evaluate(context);
23
24             // 
25             XPathNavigator input;
26             while ((input = qyInput.Advance()) != null) {
27                 input = input.Clone();
28
29                 if (input.MoveToParent()) {
30                     if (matches(input)) {
31                         Insert(outputBuffer, input);
32                     }
33                 }
34             }
35             return this;
36         }
37
38         public override XPathNodeIterator Clone() { return new ParentQuery(this); }        
39     }
40 }