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
- QualificationDataItem.cs
- AdRotator.cs
- ValidatingPropertiesEventArgs.cs
- HttpRuntime.cs
- Events.cs
- DetailsViewDeletedEventArgs.cs
- TitleStyle.cs
- Deserializer.cs
- XmlSchemaSimpleTypeUnion.cs
- XmlDomTextWriter.cs
- UpnEndpointIdentityExtension.cs
- HandleCollector.cs
- XmlSchemaValidator.cs
- TableRowGroupCollection.cs
- Win32SafeHandles.cs
- NamespaceDisplayAutomationPeer.cs
- ClusterRegistryConfigurationProvider.cs
- DiffuseMaterial.cs
- PropertyDescriptor.cs
- SqlProfileProvider.cs
- VisualStyleInformation.cs
- WinFormsComponentEditor.cs
- ClientTargetSection.cs
- LexicalChunk.cs
- SafeLocalAllocation.cs
- MetafileHeaderEmf.cs
- XmlEntityReference.cs
- MultilineStringConverter.cs
- UnmanagedMarshal.cs
- DelayedRegex.cs
- RowToParametersTransformer.cs
- wmiprovider.cs
- ChangeConflicts.cs
- LeaseManager.cs
- FactoryGenerator.cs
- Selection.cs
- RowTypeElement.cs
- DataGridViewElement.cs
- BaseDataList.cs
- DateTimeConverter2.cs
- OutputWindow.cs
- PersonalizablePropertyEntry.cs
- SynchronizedInputPattern.cs
- DefaultExpressionVisitor.cs
- OdbcEnvironmentHandle.cs
- Activator.cs
- PathSegmentCollection.cs
- UnaryQueryOperator.cs
- CheckBox.cs
- _Connection.cs
- ContentPresenter.cs
- AVElementHelper.cs
- mediaeventshelper.cs
- DropDownButton.cs
- AsymmetricSignatureDeformatter.cs
- TextServicesManager.cs
- PointCollectionValueSerializer.cs
- EventEntry.cs
- OdbcEnvironment.cs
- WindowClosedEventArgs.cs
- StrokeNodeEnumerator.cs
- _CookieModule.cs
- SecurityTokenSerializer.cs
- RowSpanVector.cs
- Separator.cs
- WpfWebRequestHelper.cs
- ToolBar.cs
- MasterPageBuildProvider.cs
- DataError.cs
- LineServices.cs
- ImageCodecInfo.cs
- WinFormsSecurity.cs
- CryptoProvider.cs
- Function.cs
- ExpressionBuilder.cs
- Convert.cs
- RoutingExtension.cs
- MemoryStream.cs
- CellConstantDomain.cs
- NextPreviousPagerField.cs
- SQLDecimalStorage.cs
- DoubleCollection.cs
- TemplateInstanceAttribute.cs
- OptimisticConcurrencyException.cs
- HMACSHA256.cs
- MonthChangedEventArgs.cs
- Win32SafeHandles.cs
- PersonalizationAdministration.cs
- Transform3D.cs
- DataServiceQueryException.cs
- PartialCachingAttribute.cs
- LexicalChunk.cs
- EntityDataSourceState.cs
- XamlToRtfParser.cs
- ConnectionPoint.cs
- _KerberosClient.cs
- SafeHandles.cs
- TerminateSequence.cs
- ToolBar.cs
- TextBoxAutomationPeer.cs