Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlNavigatorStack.cs / 1305376 / XmlNavigatorStack.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; namespace System.Xml.Xsl.Runtime { ////// A dynamic stack of IXmlNavigators. /// internal struct XmlNavigatorStack { private XPathNavigator[] stkNav; // Stack of XPathNavigators private int sp; // Stack pointer (size of stack) #if DEBUG private const int InitialStackSize = 2; #else private const int InitialStackSize = 8; #endif ////// Push a navigator onto the stack /// public void Push(XPathNavigator nav) { if (this.stkNav == null) { this.stkNav = new XPathNavigator[InitialStackSize]; } else { if (this.sp >= this.stkNav.Length) { // Resize the stack XPathNavigator[] stkOld = this.stkNav; this.stkNav = new XPathNavigator[2 * this.sp]; Array.Copy(stkOld, this.stkNav, this.sp); } } this.stkNav[this.sp++] = nav; } ////// Pop the topmost navigator and return it /// public XPathNavigator Pop() { Debug.Assert(!IsEmpty); return this.stkNav[--this.sp]; } ////// Returns the navigator at the top of the stack without adjusting the stack pointer /// public XPathNavigator Peek() { Debug.Assert(!IsEmpty); return this.stkNav[this.sp - 1]; } ////// Remove all navigators from the stack /// public void Reset() { this.sp = 0; } ////// Returns true if there are no navigators in the stack /// public bool IsEmpty { get { return this.sp == 0; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; namespace System.Xml.Xsl.Runtime { ////// A dynamic stack of IXmlNavigators. /// internal struct XmlNavigatorStack { private XPathNavigator[] stkNav; // Stack of XPathNavigators private int sp; // Stack pointer (size of stack) #if DEBUG private const int InitialStackSize = 2; #else private const int InitialStackSize = 8; #endif ////// Push a navigator onto the stack /// public void Push(XPathNavigator nav) { if (this.stkNav == null) { this.stkNav = new XPathNavigator[InitialStackSize]; } else { if (this.sp >= this.stkNav.Length) { // Resize the stack XPathNavigator[] stkOld = this.stkNav; this.stkNav = new XPathNavigator[2 * this.sp]; Array.Copy(stkOld, this.stkNav, this.sp); } } this.stkNav[this.sp++] = nav; } ////// Pop the topmost navigator and return it /// public XPathNavigator Pop() { Debug.Assert(!IsEmpty); return this.stkNav[--this.sp]; } ////// Returns the navigator at the top of the stack without adjusting the stack pointer /// public XPathNavigator Peek() { Debug.Assert(!IsEmpty); return this.stkNav[this.sp - 1]; } ////// Remove all navigators from the stack /// public void Reset() { this.sp = 0; } ////// Returns true if there are no navigators in the stack /// public bool IsEmpty { get { return this.sp == 0; } } } } // 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
- precedingsibling.cs
- DesignTimeVisibleAttribute.cs
- SiteMapProvider.cs
- ResourceContainerWrapper.cs
- TextServicesDisplayAttribute.cs
- ResourceCategoryAttribute.cs
- UInt16.cs
- RoleManagerSection.cs
- WebPartsSection.cs
- ResXResourceSet.cs
- FixedDocument.cs
- BitVector32.cs
- ACL.cs
- FilteredAttributeCollection.cs
- CheckBoxList.cs
- StorageEntityContainerMapping.cs
- Label.cs
- BoundColumn.cs
- IPAddress.cs
- MappingMetadataHelper.cs
- KnownColorTable.cs
- URLString.cs
- Script.cs
- FileSecurity.cs
- RoleGroup.cs
- Attribute.cs
- Soap12FormatExtensions.cs
- Propagator.JoinPropagator.cs
- HtmlInputCheckBox.cs
- Vector3D.cs
- SyntaxCheck.cs
- RadialGradientBrush.cs
- SqlConnectionManager.cs
- DecimalConverter.cs
- DatatypeImplementation.cs
- AdornerLayer.cs
- PropertyEmitter.cs
- ServerIdentity.cs
- TabControlAutomationPeer.cs
- ResXDataNode.cs
- CryptoConfig.cs
- ReadOnlyAttribute.cs
- ConsumerConnectionPoint.cs
- WindowsTab.cs
- ZipIOCentralDirectoryFileHeader.cs
- SettingsAttributes.cs
- EntityDataSourceEntityTypeFilterItem.cs
- nulltextcontainer.cs
- XmlDocumentSerializer.cs
- DivideByZeroException.cs
- Switch.cs
- PolicyException.cs
- X509LogoTypeExtension.cs
- DataPagerFieldCommandEventArgs.cs
- ExpressionBindings.cs
- FrameworkContentElement.cs
- DataSourceConverter.cs
- SafeNativeMethodsOther.cs
- SpecularMaterial.cs
- ProviderMetadata.cs
- EndpointAddress10.cs
- TreeViewImageKeyConverter.cs
- EmissiveMaterial.cs
- Int32Storage.cs
- DragEventArgs.cs
- ScrollViewer.cs
- CmsUtils.cs
- TextFormatterContext.cs
- ServiceMetadataPublishingElement.cs
- PropertyPathConverter.cs
- ConnectionsZone.cs
- httpstaticobjectscollection.cs
- AutomationAttributeInfo.cs
- TextRangeAdaptor.cs
- Transaction.cs
- ScrollContentPresenter.cs
- _NetworkingPerfCounters.cs
- DbTransaction.cs
- ClassHandlersStore.cs
- SecurityTokenContainer.cs
- DependencyProperty.cs
- XmlSchemaRedefine.cs
- ConfigXmlComment.cs
- SqlTopReducer.cs
- ChtmlFormAdapter.cs
- DescriptionCreator.cs
- PenContexts.cs
- UdpTransportSettings.cs
- DBCommandBuilder.cs
- ProviderSettings.cs
- SqlConnectionPoolGroupProviderInfo.cs
- OdbcTransaction.cs
- __TransparentProxy.cs
- EntityDataSourceSelectedEventArgs.cs
- ObjectFullSpanRewriter.cs
- OleDbError.cs
- UnconditionalPolicy.cs
- ListSortDescriptionCollection.cs
- MetabaseSettingsIis7.cs
- WeakHashtable.cs