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
- RestHandler.cs
- ScrollItemProviderWrapper.cs
- ShapingWorkspace.cs
- NamespaceList.cs
- ProgressBarHighlightConverter.cs
- SendParametersContent.cs
- FrameworkTemplate.cs
- XmlElementList.cs
- ErrorHandler.cs
- WebPartChrome.cs
- NativeMethods.cs
- WebConfigurationHostFileChange.cs
- InstanceDescriptor.cs
- ReadWriteObjectLock.cs
- ToolStripDropTargetManager.cs
- HostAdapter.cs
- ValueCollectionParameterReader.cs
- MiniCustomAttributeInfo.cs
- CryptoProvider.cs
- SystemGatewayIPAddressInformation.cs
- ConstraintConverter.cs
- SafeTimerHandle.cs
- AdornerPresentationContext.cs
- HtmlTable.cs
- AutomationProperties.cs
- EnumerationRangeValidationUtil.cs
- HelpProvider.cs
- MaterialGroup.cs
- PropertyFilterAttribute.cs
- HttpApplication.cs
- Clock.cs
- WindowsAltTab.cs
- SchemaConstraints.cs
- MemberAccessException.cs
- SQLMoney.cs
- GridViewRowPresenter.cs
- SafeRightsManagementQueryHandle.cs
- Domain.cs
- Transform.cs
- Baml2006ReaderFrame.cs
- TextEffectCollection.cs
- DiffuseMaterial.cs
- BufferedGraphics.cs
- DBBindings.cs
- URLString.cs
- AttributeEmitter.cs
- TraceUtility.cs
- PointConverter.cs
- ProfessionalColorTable.cs
- TokenBasedSetEnumerator.cs
- ExpressionWriter.cs
- ZipIOExtraFieldPaddingElement.cs
- SizeAnimationBase.cs
- ListBox.cs
- ParameterBuilder.cs
- Transform.cs
- VariableQuery.cs
- RegexStringValidatorAttribute.cs
- QuaternionRotation3D.cs
- EncoderReplacementFallback.cs
- DesignerActionPropertyItem.cs
- EntityDataSourceDataSelection.cs
- DefaultExpression.cs
- StateChangeEvent.cs
- SystemWebSectionGroup.cs
- ChannelOptions.cs
- XmlLanguageConverter.cs
- CommandField.cs
- MappingMetadataHelper.cs
- WebPartCatalogAddVerb.cs
- DrawingContext.cs
- Guid.cs
- ResourcePart.cs
- CSharpCodeProvider.cs
- AttachedAnnotation.cs
- AlternationConverter.cs
- DatatypeImplementation.cs
- SectionXmlInfo.cs
- ContextTokenTypeConverter.cs
- TextProperties.cs
- SequenceNumber.cs
- IResourceProvider.cs
- CharacterHit.cs
- TextServicesDisplayAttribute.cs
- AssemblyLoader.cs
- TransformProviderWrapper.cs
- UnionCodeGroup.cs
- Binding.cs
- NavigationExpr.cs
- SimpleHandlerFactory.cs
- WebConfigurationHostFileChange.cs
- ComplexPropertyEntry.cs
- TextAction.cs
- LocatorPartList.cs
- DataProviderNameConverter.cs
- WebBrowserPermission.cs
- LoadedOrUnloadedOperation.cs
- Vector3D.cs
- SqlSelectClauseBuilder.cs
- RuleSetDialog.cs