Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / CacheOutputQuery.cs / 1305376 / CacheOutputQuery.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;
using System.Xml.Xsl;
using System.Collections.Generic;
internal abstract class CacheOutputQuery : Query {
internal Query input;
// int count; -- we reusing it here
protected List outputBuffer;
public CacheOutputQuery(Query input) {
this.input = input;
this.outputBuffer = new List();
this.count = 0;
}
protected CacheOutputQuery(CacheOutputQuery other) : base(other) {
this.input = Clone(other.input);
this.outputBuffer = new List(other.outputBuffer);
this.count = other.count;
}
public override void Reset() {
this.count = 0;
}
public override void SetXsltContext(XsltContext context){
input.SetXsltContext(context);
}
public override object Evaluate(XPathNodeIterator context) {
outputBuffer.Clear();
count = 0;
return input.Evaluate(context);// This is trick. IDQuery needs this value. Otherwise we would return this.
// All subclasses should and would anyway override thismethod and return this.
}
public override XPathNavigator Advance() {
Debug.Assert(0 <= count && count <= outputBuffer.Count);
if (count < outputBuffer.Count) {
return outputBuffer[count++];
}
return null;
}
public override XPathNavigator Current {
get {
Debug.Assert(0 <= count && count <= outputBuffer.Count);
if (count == 0) {
return null;
}
return outputBuffer[count - 1];
}
}
public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } }
public override int CurrentPosition { get { return count; } }
public override int Count { get { return outputBuffer.Count; } }
public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } }
public override void PrintQuery(XmlWriter w) {
w.WriteStartElement(this.GetType().Name);
input.PrintQuery(w);
w.WriteEndElement();
}
}
}
// 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
- EmptyQuery.cs
- SingleSelectRootGridEntry.cs
- FileClassifier.cs
- ErrorWebPart.cs
- BooleanToVisibilityConverter.cs
- LinkedList.cs
- CheckBoxList.cs
- UniqueIdentifierService.cs
- ActionFrame.cs
- VersionPair.cs
- GridViewRowCollection.cs
- ToolStripRenderer.cs
- CopyOnWriteList.cs
- ReadingWritingEntityEventArgs.cs
- UniqueIdentifierService.cs
- DefaultDiscoveryServiceExtension.cs
- XmlSchemaSimpleTypeUnion.cs
- PageThemeBuildProvider.cs
- CultureInfo.cs
- Tuple.cs
- NotificationContext.cs
- TextTrailingWordEllipsis.cs
- ClientProxyGenerator.cs
- HTTPNotFoundHandler.cs
- ByteAnimation.cs
- OptimizerPatterns.cs
- FormClosingEvent.cs
- ProvideValueServiceProvider.cs
- WebPartEditorApplyVerb.cs
- EnumDataContract.cs
- WebPartHeaderCloseVerb.cs
- WebPartMovingEventArgs.cs
- XmlSchemaInferenceException.cs
- DataServiceEntityAttribute.cs
- WindowsSolidBrush.cs
- StatusBarItem.cs
- IndexerNameAttribute.cs
- StringAttributeCollection.cs
- InkCanvasFeedbackAdorner.cs
- CngUIPolicy.cs
- SimpleMailWebEventProvider.cs
- BrowserCapabilitiesFactoryBase.cs
- MonthChangedEventArgs.cs
- SspiSafeHandles.cs
- FontStretch.cs
- DataTrigger.cs
- QilScopedVisitor.cs
- HeaderUtility.cs
- HasCopySemanticsAttribute.cs
- ObjectListCommandsPage.cs
- WS2007HttpBinding.cs
- ADMembershipProvider.cs
- Regex.cs
- IsolatedStorageException.cs
- DataGridTextColumn.cs
- GroupBox.cs
- EventMappingSettingsCollection.cs
- TransformGroup.cs
- CaseStatementProjectedSlot.cs
- ConfigsHelper.cs
- DataConnectionHelper.cs
- Paragraph.cs
- ObjectSecurity.cs
- MetadataPropertyCollection.cs
- InfoCardConstants.cs
- EdmToObjectNamespaceMap.cs
- ConnectionsZone.cs
- TransformationRules.cs
- COAUTHIDENTITY.cs
- Rfc2898DeriveBytes.cs
- DataControlPagerLinkButton.cs
- EntityParameterCollection.cs
- ExpressionEditorAttribute.cs
- PrintControllerWithStatusDialog.cs
- SafeNativeMethods.cs
- EntityDataReader.cs
- HwndProxyElementProvider.cs
- ChooseAction.cs
- String.cs
- ConnectionsZone.cs
- GridItemCollection.cs
- Geometry.cs
- TableLayoutPanelCellPosition.cs
- ActivitySurrogateSelector.cs
- TextParentUndoUnit.cs
- DataContractSerializer.cs
- PenThreadPool.cs
- FigureParaClient.cs
- ModelVisual3D.cs
- WebPartActionVerb.cs
- WorkflowRuntimeBehavior.cs
- GraphicsPathIterator.cs
- RuntimeConfigLKG.cs
- XmlWhitespace.cs
- ReceiveCompletedEventArgs.cs
- FilterEventArgs.cs
- ApplicationId.cs
- ACL.cs
- WizardStepBase.cs
- DecimalKeyFrameCollection.cs