Code:
/ 4.0 / 4.0 / 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.
//------------------------------------------------------------------------------
//
// 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
- Win32SafeHandles.cs
- ListViewAutomationPeer.cs
- ButtonFieldBase.cs
- DataGridAutoFormatDialog.cs
- ObjectNotFoundException.cs
- DataGridViewTextBoxColumn.cs
- SelfIssuedTokenFactoryCredential.cs
- StringAnimationBase.cs
- SmtpMail.cs
- TemplatePartAttribute.cs
- AnnotationComponentManager.cs
- DependencyObject.cs
- SignedPkcs7.cs
- SmiEventSink_Default.cs
- XPathCompiler.cs
- HtmlHead.cs
- GlobalItem.cs
- ColumnTypeConverter.cs
- DataContractSerializerMessageContractImporter.cs
- BuilderElements.cs
- DefaultTextStore.cs
- CheckBoxField.cs
- QEncodedStream.cs
- CodeObjectCreateExpression.cs
- DBSqlParserColumnCollection.cs
- VarRemapper.cs
- Exception.cs
- TriggerActionCollection.cs
- ITreeGenerator.cs
- ModelPropertyImpl.cs
- RolePrincipal.cs
- XmlEntity.cs
- EntityDataSourceContextCreatingEventArgs.cs
- Geometry3D.cs
- BaseDataList.cs
- XmlValidatingReader.cs
- COM2PropertyPageUITypeConverter.cs
- InstanceNotReadyException.cs
- PropertyReferenceSerializer.cs
- sqlpipe.cs
- SymDocumentType.cs
- DummyDataSource.cs
- NetSectionGroup.cs
- WebRequestModuleElementCollection.cs
- XmlLinkedNode.cs
- UnsafeNativeMethods.cs
- IisTraceListener.cs
- MetadataWorkspace.cs
- HttpHandlersSection.cs
- RenamedEventArgs.cs
- EndpointIdentityExtension.cs
- ContextMenu.cs
- WebPartVerb.cs
- DbConnectionPoolGroupProviderInfo.cs
- CorrelationTokenTypeConvertor.cs
- StickyNote.cs
- OpenFileDialog.cs
- JsonByteArrayDataContract.cs
- TimeSpanSecondsConverter.cs
- DataGridViewDataErrorEventArgs.cs
- ObjectStateFormatter.cs
- EventLogSession.cs
- PriorityQueue.cs
- DataGridViewSelectedColumnCollection.cs
- Exceptions.cs
- BoolExpr.cs
- User.cs
- PointCollection.cs
- MappedMetaModel.cs
- TabletCollection.cs
- COAUTHIDENTITY.cs
- IOException.cs
- VectorKeyFrameCollection.cs
- TypeForwardedToAttribute.cs
- DoubleAnimationUsingPath.cs
- WindowsSpinner.cs
- ObjectStateEntry.cs
- EFDataModelProvider.cs
- WebPartCollection.cs
- SecurityHeaderElementInferenceEngine.cs
- StreamInfo.cs
- PixelShader.cs
- X509Extension.cs
- infer.cs
- CredentialSelector.cs
- DrawingCollection.cs
- HtmlInputRadioButton.cs
- SecurityHelper.cs
- DataSourceSelectArguments.cs
- PerfCounters.cs
- PanelDesigner.cs
- XamlSerializationHelper.cs
- LazyTextWriterCreator.cs
- MatrixAnimationUsingPath.cs
- WebControl.cs
- Hash.cs
- WindowsProgressbar.cs
- COSERVERINFO.cs
- DataBindingCollection.cs
- XmlIgnoreAttribute.cs