Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / XPath / Internal / ContextQuery.cs / 1 / ContextQuery.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace MS.Internal.Xml.XPath {
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
internal class ContextQuery : Query {
protected XPathNavigator contextNode;
public ContextQuery() {
this.count = 0;
}
protected ContextQuery(ContextQuery other) : base(other) {
this.contextNode = other.contextNode; // Don't need to clone here
}
public override void Reset() {
count = 0;
}
public override XPathNavigator Current { get { return contextNode; } }
public override object Evaluate(XPathNodeIterator context) {
contextNode = context.Current; // We don't clone here. Because we never move it.
count = 0;
return this;
}
public override XPathNavigator Advance() {
if (count == 0) {
count = 1;
return contextNode;
}
return null;
}
public override XPathNavigator MatchNode(XPathNavigator current) {
return current;
}
public override XPathNodeIterator Clone() { return new ContextQuery(this); }
public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } }
public override int CurrentPosition { get { return count; } }
public override int Count { get { return 1; } }
public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace MS.Internal.Xml.XPath {
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
internal class ContextQuery : Query {
protected XPathNavigator contextNode;
public ContextQuery() {
this.count = 0;
}
protected ContextQuery(ContextQuery other) : base(other) {
this.contextNode = other.contextNode; // Don't need to clone here
}
public override void Reset() {
count = 0;
}
public override XPathNavigator Current { get { return contextNode; } }
public override object Evaluate(XPathNodeIterator context) {
contextNode = context.Current; // We don't clone here. Because we never move it.
count = 0;
return this;
}
public override XPathNavigator Advance() {
if (count == 0) {
count = 1;
return contextNode;
}
return null;
}
public override XPathNavigator MatchNode(XPathNavigator current) {
return current;
}
public override XPathNodeIterator Clone() { return new ContextQuery(this); }
public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } }
public override int CurrentPosition { get { return count; } }
public override int Count { get { return 1; } }
public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlHierarchyData.cs
- SqlCrossApplyToCrossJoin.cs
- PropertiesTab.cs
- ToolStripMenuItemCodeDomSerializer.cs
- DataKey.cs
- NumericUpDownAcceleration.cs
- DataMemberFieldConverter.cs
- DataGridAddNewRow.cs
- SqlUserDefinedAggregateAttribute.cs
- EventListener.cs
- FileVersionInfo.cs
- QueryExpr.cs
- SHA512.cs
- TemplateContent.cs
- Validator.cs
- SID.cs
- TypeConverter.cs
- BrowserCapabilitiesFactory.cs
- Socket.cs
- PenCursorManager.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- Stylus.cs
- StrokeRenderer.cs
- _BaseOverlappedAsyncResult.cs
- OdbcStatementHandle.cs
- EncryptedData.cs
- TextTreeUndoUnit.cs
- TransactionInterop.cs
- ReflectionServiceProvider.cs
- RenderingEventArgs.cs
- SqlNodeTypeOperators.cs
- OleDbTransaction.cs
- PaintValueEventArgs.cs
- TextFindEngine.cs
- FormViewDeleteEventArgs.cs
- HybridDictionary.cs
- ReliabilityContractAttribute.cs
- XmlSchemaCollection.cs
- XmlSubtreeReader.cs
- DetailsViewAutoFormat.cs
- DataStreams.cs
- XmlAnyAttributeAttribute.cs
- DefaultValueTypeConverter.cs
- Lasso.cs
- cache.cs
- URIFormatException.cs
- TimeSpanValidator.cs
- ScrollEventArgs.cs
- BooleanToVisibilityConverter.cs
- BitmapEffect.cs
- MultiView.cs
- ReflectTypeDescriptionProvider.cs
- SqlConnectionStringBuilder.cs
- DrawingBrush.cs
- CategoriesDocument.cs
- CompiledQuery.cs
- DataBindingCollection.cs
- XamlSerializerUtil.cs
- MsmqBindingMonitor.cs
- DefaultAssemblyResolver.cs
- CodeDomDecompiler.cs
- TextSpanModifier.cs
- DBPropSet.cs
- PolyLineSegment.cs
- EdmComplexTypeAttribute.cs
- ThreadTrace.cs
- TransformedBitmap.cs
- CharAnimationBase.cs
- HybridObjectCache.cs
- XmlCharacterData.cs
- MappingException.cs
- ProtocolsSection.cs
- ZipIOExtraFieldZip64Element.cs
- ParserHooks.cs
- AppearanceEditorPart.cs
- GridViewUpdateEventArgs.cs
- DataTableNewRowEvent.cs
- FeatureSupport.cs
- OrderByQueryOptionExpression.cs
- PageBuildProvider.cs
- AppDomain.cs
- updatecommandorderer.cs
- AssemblyHash.cs
- ChildrenQuery.cs
- NotifyCollectionChangedEventArgs.cs
- SerializationEventsCache.cs
- TextElement.cs
- XmlObjectSerializerContext.cs
- FlowDocument.cs
- login.cs
- Selection.cs
- RawStylusInputCustomDataList.cs
- HandlerBase.cs
- ProcessThread.cs
- ToggleButtonAutomationPeer.cs
- PathHelper.cs
- XmlAttributes.cs
- SafeNativeMethods.cs
- Image.cs
- _RegBlobWebProxyDataBuilder.cs