Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- FormsAuthenticationTicket.cs
- Visitors.cs
- EntityParameterCollection.cs
- FamilyTypeface.cs
- SqlDataSourceEnumerator.cs
- StylusPointCollection.cs
- SQLSingle.cs
- LocatorPartList.cs
- EmitterCache.cs
- FileVersion.cs
- AudioDeviceOut.cs
- PropertyDescriptors.cs
- Environment.cs
- SqlConnectionString.cs
- NameTable.cs
- RegionIterator.cs
- ProjectionNode.cs
- SystemThemeKey.cs
- DesignerWithHeader.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- BuildProviderCollection.cs
- ConvertEvent.cs
- NumberFormatInfo.cs
- HostedAspNetEnvironment.cs
- HtmlEmptyTagControlBuilder.cs
- MessageQueueAccessControlEntry.cs
- LayoutUtils.cs
- AddInSegmentDirectoryNotFoundException.cs
- EmptyEnumerator.cs
- GeometryDrawing.cs
- SimpleTypeResolver.cs
- ServiceDocument.cs
- AssemblyBuilderData.cs
- XmlTextReader.cs
- XPathMessageFilterElementCollection.cs
- UnsafeNativeMethods.cs
- CustomTypeDescriptor.cs
- PostBackTrigger.cs
- OleDbInfoMessageEvent.cs
- FlowLayoutSettings.cs
- PathTooLongException.cs
- RuleConditionDialog.Designer.cs
- SafeUserTokenHandle.cs
- ThicknessAnimationUsingKeyFrames.cs
- OdbcEnvironmentHandle.cs
- EFTableProvider.cs
- EventlogProvider.cs
- CheckBoxRenderer.cs
- AvTraceDetails.cs
- IDispatchConstantAttribute.cs
- StringAnimationBase.cs
- MenuItem.cs
- SpnegoTokenProvider.cs
- TraceListeners.cs
- DataGridCell.cs
- InternalConfirm.cs
- BindableAttribute.cs
- FontResourceCache.cs
- XmlSchemaDocumentation.cs
- Viewport2DVisual3D.cs
- XmlCharacterData.cs
- Vector.cs
- MenuItemBindingCollection.cs
- FormattedText.cs
- NativeMethods.cs
- SymbolEqualComparer.cs
- SchemeSettingElement.cs
- DataGridViewLayoutData.cs
- Attributes.cs
- CursorConverter.cs
- OperationResponse.cs
- DesignerActionPanel.cs
- TypeNameConverter.cs
- Timer.cs
- OdbcParameterCollection.cs
- MessageDecoder.cs
- TimelineClockCollection.cs
- AccessKeyManager.cs
- PageAsyncTask.cs
- XmlSchemaGroupRef.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ReachVisualSerializer.cs
- LinearGradientBrush.cs
- StyleSelector.cs
- DragDeltaEventArgs.cs
- TableProviderWrapper.cs
- PropertyGridView.cs
- BufferModesCollection.cs
- ColorBlend.cs
- CapabilitiesRule.cs
- RpcCryptoRequest.cs
- NullExtension.cs
- X509Extension.cs
- StateValidator.cs
- HttpFormatExtensions.cs
- AttributeEmitter.cs
- DataViewSettingCollection.cs
- CodeDomComponentSerializationService.cs
- XamlFigureLengthSerializer.cs
- TextServicesManager.cs