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 ListoutputBuffer; 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 ListoutputBuffer; 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
- ToolStripItemImageRenderEventArgs.cs
- WorkItem.cs
- MSAAEventDispatcher.cs
- PersonalizationAdministration.cs
- WebCategoryAttribute.cs
- XmlSchemaDatatype.cs
- FrameworkElementFactory.cs
- NativeMethodsOther.cs
- CodeGotoStatement.cs
- CachedCompositeFamily.cs
- DefaultAsyncDataDispatcher.cs
- WebPartEditorOkVerb.cs
- Mutex.cs
- ParameterElementCollection.cs
- CacheMode.cs
- formatstringdialog.cs
- PointConverter.cs
- Geometry.cs
- ArcSegment.cs
- EditorServiceContext.cs
- CustomAttributeFormatException.cs
- SchemaImporter.cs
- HttpConfigurationSystem.cs
- SharedStream.cs
- Transform3DGroup.cs
- ProcessInfo.cs
- X509CertificateTrustedIssuerElementCollection.cs
- KeyConverter.cs
- HandleCollector.cs
- ControlIdConverter.cs
- SelectionList.cs
- RoutedEventHandlerInfo.cs
- IISUnsafeMethods.cs
- SecurityAlgorithmSuite.cs
- AssociationType.cs
- StorageComplexTypeMapping.cs
- BrowserCapabilitiesFactory.cs
- DetailsViewInsertEventArgs.cs
- BaseCollection.cs
- MethodCallTranslator.cs
- FixedTextView.cs
- HttpVersion.cs
- Point3DAnimationUsingKeyFrames.cs
- MatrixAnimationUsingPath.cs
- SByteConverter.cs
- Panel.cs
- base64Transforms.cs
- SyndicationCategory.cs
- XmlTextAttribute.cs
- ProfileSettingsCollection.cs
- RelatedCurrencyManager.cs
- MetadataUtil.cs
- COM2Enum.cs
- TraceInternal.cs
- HttpException.cs
- ObjectDataSourceEventArgs.cs
- ManagementQuery.cs
- BamlStream.cs
- HtmlElementErrorEventArgs.cs
- InputGestureCollection.cs
- SystemIcmpV4Statistics.cs
- CompressEmulationStream.cs
- ObjectSecurity.cs
- SqlException.cs
- DesignerActionUI.cs
- XmlSyndicationContent.cs
- RealizationDrawingContextWalker.cs
- WebPartZoneCollection.cs
- TreeNodeConverter.cs
- AnnotationAdorner.cs
- QilXmlWriter.cs
- EntityContainer.cs
- SmiEventSink_Default.cs
- XPathMessageFilterTable.cs
- NamedPipeAppDomainProtocolHandler.cs
- WhitespaceRuleLookup.cs
- TypeGenericEnumerableViewSchema.cs
- DetailsViewPageEventArgs.cs
- MessageDecoder.cs
- MonitorWrapper.cs
- LinqDataSourceContextData.cs
- OneWayElement.cs
- Keyboard.cs
- TileBrush.cs
- ProgressBarHighlightConverter.cs
- ServiceHostFactory.cs
- TdsParserStaticMethods.cs
- Scene3D.cs
- DispatcherObject.cs
- DataServiceQueryProvider.cs
- DbSetClause.cs
- KeyToListMap.cs
- CheckBoxField.cs
- DataAccessor.cs
- Int32Rect.cs
- ConfigurationStrings.cs
- _LazyAsyncResult.cs
- Version.cs
- ResourceDescriptionAttribute.cs
- DateTimeConverter.cs