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
- DataGridRowHeader.cs
- EntityContainerAssociationSet.cs
- UpdatePanelTrigger.cs
- ParameterCollection.cs
- RangeValuePattern.cs
- WebPartCloseVerb.cs
- ItemCheckEvent.cs
- ToolStripItemGlyph.cs
- XmlSchemaGroupRef.cs
- FileNotFoundException.cs
- TimelineGroup.cs
- NavigationExpr.cs
- ThreadInterruptedException.cs
- SerialErrors.cs
- EncodingInfo.cs
- IIS7UserPrincipal.cs
- TextBox.cs
- SQLUtility.cs
- XComponentModel.cs
- PropertyEntry.cs
- BindingWorker.cs
- ResXFileRef.cs
- Convert.cs
- DesignerAttribute.cs
- Funcletizer.cs
- ConstructorBuilder.cs
- BinaryObjectReader.cs
- TemplateEditingFrame.cs
- DurableOperationAttribute.cs
- TargetException.cs
- SubpageParagraph.cs
- XmlFormatMapping.cs
- IPGlobalProperties.cs
- CodeDirectiveCollection.cs
- HwndHostAutomationPeer.cs
- HashCodeCombiner.cs
- ArcSegment.cs
- AmbientLight.cs
- ExceptionAggregator.cs
- ExpressionBuilder.cs
- DesignerHelpers.cs
- HtmlButton.cs
- AsyncOperation.cs
- XXXInfos.cs
- HttpCacheVary.cs
- TextElementEditingBehaviorAttribute.cs
- mactripleDES.cs
- RC2.cs
- PenCursorManager.cs
- Int16KeyFrameCollection.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- MultiAsyncResult.cs
- SqlDataSource.cs
- PreDigestedSignedInfo.cs
- LineVisual.cs
- FontSourceCollection.cs
- EnvelopedPkcs7.cs
- Win32.cs
- BinaryFormatter.cs
- HttpWebRequest.cs
- HtmlLink.cs
- XmlStringTable.cs
- TreeViewTemplateSelector.cs
- ModulesEntry.cs
- FaultContractInfo.cs
- BaseTemplateParser.cs
- PowerStatus.cs
- SecurityResources.cs
- ForeignKeyConstraint.cs
- listviewsubitemcollectioneditor.cs
- _ListenerRequestStream.cs
- WindowsPen.cs
- RoleServiceManager.cs
- SizeAnimation.cs
- Pkcs7Signer.cs
- SimpleExpression.cs
- Freezable.cs
- DbParameterCollectionHelper.cs
- SourceElementsCollection.cs
- PermissionListSet.cs
- JpegBitmapDecoder.cs
- GridViewSelectEventArgs.cs
- RegexCode.cs
- IItemContainerGenerator.cs
- PerCallInstanceContextProvider.cs
- DbConnectionPoolIdentity.cs
- ListenDesigner.cs
- CookieProtection.cs
- CreateUserWizardDesigner.cs
- WriteableBitmap.cs
- ObjectParameter.cs
- DataSourceNameHandler.cs
- UnsignedPublishLicense.cs
- HuffmanTree.cs
- BulletedList.cs
- ConfigurationElementCollection.cs
- SymLanguageVendor.cs
- MailWebEventProvider.cs
- ExpressionSelection.cs
- RegexCaptureCollection.cs