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
- XmlAutoDetectWriter.cs
- SafeHandles.cs
- SessionStateUtil.cs
- CodeIterationStatement.cs
- Floater.cs
- TextElement.cs
- GridItemPattern.cs
- SessionPageStateSection.cs
- ThrowHelper.cs
- DataSourceCacheDurationConverter.cs
- HScrollProperties.cs
- Empty.cs
- OdbcConnectionOpen.cs
- ApplicationGesture.cs
- XmlWrappingReader.cs
- DependencyPropertyValueSerializer.cs
- Label.cs
- PKCS1MaskGenerationMethod.cs
- RankException.cs
- PartialCachingControl.cs
- BindingsSection.cs
- X509WindowsSecurityToken.cs
- EntityConnection.cs
- APCustomTypeDescriptor.cs
- CheckBoxBaseAdapter.cs
- ObjectQueryProvider.cs
- PointF.cs
- ActivityMarkupSerializer.cs
- PrimitiveRenderer.cs
- PerformanceCounter.cs
- HashJoinQueryOperatorEnumerator.cs
- SqlProvider.cs
- XmlQueryStaticData.cs
- FileClassifier.cs
- SqlUDTStorage.cs
- ParameterSubsegment.cs
- FixedPageStructure.cs
- DurableInstance.cs
- ManagedIStream.cs
- LineVisual.cs
- BamlRecordReader.cs
- ParseElementCollection.cs
- Oid.cs
- PropertyKey.cs
- NumericUpDownAcceleration.cs
- WebReferencesBuildProvider.cs
- StringConcat.cs
- CompoundFileDeflateTransform.cs
- X509Utils.cs
- ContentElement.cs
- ByteStack.cs
- PageThemeParser.cs
- AssociatedControlConverter.cs
- DateTime.cs
- ButtonRenderer.cs
- PrintDialog.cs
- LinqDataSourceValidationException.cs
- TextCompositionEventArgs.cs
- ParserOptions.cs
- ParagraphResult.cs
- Win32SafeHandles.cs
- COM2TypeInfoProcessor.cs
- DecimalConverter.cs
- ErrorFormatter.cs
- SignerInfo.cs
- LassoHelper.cs
- HttpException.cs
- StackBuilderSink.cs
- HttpStreamFormatter.cs
- FileDialog_Vista.cs
- TableLayoutSettings.cs
- DesignObjectWrapper.cs
- SecurityContext.cs
- RotateTransform3D.cs
- DesignTimeVisibleAttribute.cs
- DataSvcMapFile.cs
- TypeSystemProvider.cs
- Stylesheet.cs
- RegexCaptureCollection.cs
- Table.cs
- UserInitiatedNavigationPermission.cs
- StringArrayEditor.cs
- ProcessingInstructionAction.cs
- UrlAuthFailedErrorFormatter.cs
- Reference.cs
- SQLInt32.cs
- Int16Storage.cs
- DocumentReferenceCollection.cs
- CollaborationHelperFunctions.cs
- DefaultAutoFieldGenerator.cs
- RoamingStoreFile.cs
- DataControlCommands.cs
- Win32SafeHandles.cs
- SpeechSynthesizer.cs
- CompilerState.cs
- oledbmetadatacolumnnames.cs
- TextServicesDisplayAttribute.cs
- WaitHandle.cs
- SelectingProviderEventArgs.cs
- XslNumber.cs