Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlNavigatorStack.cs / 1 / 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
- DefaultAsyncDataDispatcher.cs
- AuthenticatedStream.cs
- ViewEventArgs.cs
- DictionaryBase.cs
- HtmlTableRow.cs
- ExpressionPrefixAttribute.cs
- DrawingContextDrawingContextWalker.cs
- ErrorsHelper.cs
- ParamArrayAttribute.cs
- ResourceExpression.cs
- AnyAllSearchOperator.cs
- ScriptReferenceBase.cs
- ReverseQueryOperator.cs
- TrackingServices.cs
- HandleExceptionArgs.cs
- TextStore.cs
- CodeActivityMetadata.cs
- FontResourceCache.cs
- ContentElement.cs
- EncryptedXml.cs
- Timer.cs
- PageParser.cs
- ToolTipAutomationPeer.cs
- SiteMapDataSourceView.cs
- SByteConverter.cs
- ListViewItem.cs
- MemberHolder.cs
- HttpAsyncResult.cs
- Point3DValueSerializer.cs
- XmlNamespaceMapping.cs
- DbDataAdapter.cs
- ToolStripTextBox.cs
- HitTestDrawingContextWalker.cs
- PrivateFontCollection.cs
- TextServicesLoader.cs
- Symbol.cs
- TextEffect.cs
- figurelength.cs
- XmlTypeAttribute.cs
- WSTrustDec2005.cs
- ProcessModelInfo.cs
- BmpBitmapEncoder.cs
- TraceContextEventArgs.cs
- ManagedWndProcTracker.cs
- EventItfInfo.cs
- Normalization.cs
- WindowInteropHelper.cs
- OracleInfoMessageEventArgs.cs
- InternalControlCollection.cs
- DurableMessageDispatchInspector.cs
- HttpModuleActionCollection.cs
- Timer.cs
- EUCJPEncoding.cs
- DrawingServices.cs
- SemanticResolver.cs
- XsdBuildProvider.cs
- Transactions.cs
- TimeSpanMinutesConverter.cs
- ContainerUtilities.cs
- HwndMouseInputProvider.cs
- ThousandthOfEmRealDoubles.cs
- TextTreeDeleteContentUndoUnit.cs
- PrePostDescendentsWalker.cs
- PeerApplication.cs
- DictionaryMarkupSerializer.cs
- GuidelineCollection.cs
- AnnotationResourceCollection.cs
- SuppressMergeCheckAttribute.cs
- PropertyMetadata.cs
- AdRotatorDesigner.cs
- HierarchicalDataSourceControl.cs
- WbemProvider.cs
- SQLBytes.cs
- SiteMapNodeItem.cs
- ArraySortHelper.cs
- ParseElement.cs
- SQLChars.cs
- VisualTarget.cs
- ObjectView.cs
- RSATokenProvider.cs
- x509store.cs
- XmlMembersMapping.cs
- URLString.cs
- WindowsEditBox.cs
- OpCodes.cs
- DataGridViewTextBoxColumn.cs
- HttpProfileBase.cs
- DataGridViewTextBoxCell.cs
- UIElementPropertyUndoUnit.cs
- XmlStringTable.cs
- IDataContractSurrogate.cs
- ComplexPropertyEntry.cs
- XmlStrings.cs
- Visitors.cs
- UrlMapping.cs
- UpdatePanel.cs
- EventMetadata.cs
- WebConfigurationHostFileChange.cs
- HttpAsyncResult.cs
- LocationUpdates.cs