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
- HasCopySemanticsAttribute.cs
- FixedSOMTableRow.cs
- ResourceExpressionBuilder.cs
- Number.cs
- ContractListAdapter.cs
- TimerExtension.cs
- ColumnTypeConverter.cs
- UpdateProgress.cs
- DataTableCollection.cs
- FixedSOMPageConstructor.cs
- ContentElementAutomationPeer.cs
- DataTableMapping.cs
- DataGridLength.cs
- XmlEntity.cs
- OleDbInfoMessageEvent.cs
- DesignerDataStoredProcedure.cs
- StateDesigner.Helpers.cs
- SafePointer.cs
- TemplateBindingExtensionConverter.cs
- PerfService.cs
- Int16.cs
- Trace.cs
- DatatypeImplementation.cs
- ControlBindingsCollection.cs
- ErrorTolerantObjectWriter.cs
- TypeLibConverter.cs
- CodeGroup.cs
- SchemaElementDecl.cs
- FollowerQueueCreator.cs
- DataGridView.cs
- ExpandedWrapper.cs
- ReadOnlyDictionary.cs
- OdbcEnvironmentHandle.cs
- EntitySet.cs
- PrtCap_Base.cs
- ProgressPage.cs
- XmlSchemaSet.cs
- FormViewDeletedEventArgs.cs
- MultipartContentParser.cs
- DiagnosticStrings.cs
- SupportingTokenProviderSpecification.cs
- InfoCardRSACryptoProvider.cs
- RecognitionResult.cs
- DragStartedEventArgs.cs
- SystemInformation.cs
- IDReferencePropertyAttribute.cs
- DataGridViewHitTestInfo.cs
- TypeExtensions.cs
- AddInEnvironment.cs
- WebBrowserPermission.cs
- ByteStack.cs
- RectAnimationUsingKeyFrames.cs
- StringInfo.cs
- Binding.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ObjectSet.cs
- ObjectViewListener.cs
- WebZone.cs
- StylusShape.cs
- DocumentViewerBase.cs
- OleDbParameterCollection.cs
- MetadataItemEmitter.cs
- ObjectListFieldCollection.cs
- ProfileSettingsCollection.cs
- EntitySqlQueryCacheEntry.cs
- ResourceSetExpression.cs
- MarginCollapsingState.cs
- SystemThemeKey.cs
- TripleDESCryptoServiceProvider.cs
- ObjectListSelectEventArgs.cs
- LazyLoadBehavior.cs
- PrimaryKeyTypeConverter.cs
- NameSpaceEvent.cs
- BoundField.cs
- FillBehavior.cs
- ElementNotEnabledException.cs
- Int16AnimationBase.cs
- NativeWindow.cs
- ReadOnlyAttribute.cs
- HttpWrapper.cs
- Expression.cs
- AlignmentXValidation.cs
- DesignerFrame.cs
- ParameterReplacerVisitor.cs
- SafeBuffer.cs
- ExpressionEditorAttribute.cs
- BufferedOutputAsyncStream.cs
- SpellerHighlightLayer.cs
- ProcessHostConfigUtils.cs
- MailMessageEventArgs.cs
- PlainXmlWriter.cs
- ContainerVisual.cs
- CacheMemory.cs
- BindingBase.cs
- PrimaryKeyTypeConverter.cs
- ManagedWndProcTracker.cs
- ImageListUtils.cs
- DirectoryObjectSecurity.cs
- WebPartUtil.cs
- CfgSemanticTag.cs