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
- ChtmlCommandAdapter.cs
- StatusBarAutomationPeer.cs
- CommonBehaviorsSection.cs
- CheckBoxField.cs
- ExtensionSimplifierMarkupObject.cs
- TokenFactoryBase.cs
- Path.cs
- XpsImageSerializationService.cs
- wmiprovider.cs
- DbConnectionPoolOptions.cs
- UrlPropertyAttribute.cs
- GlobalizationAssembly.cs
- UIElement3DAutomationPeer.cs
- SolidBrush.cs
- LayoutEditorPart.cs
- UriWriter.cs
- CommonObjectSecurity.cs
- Literal.cs
- ReadContentAsBinaryHelper.cs
- DragEvent.cs
- XmlSchemaSimpleContentRestriction.cs
- OleDbDataReader.cs
- CodeThrowExceptionStatement.cs
- FixedPageProcessor.cs
- DecimalConverter.cs
- WriterOutput.cs
- VariableValue.cs
- ApplicationActivator.cs
- AnimationException.cs
- Keywords.cs
- DataControlField.cs
- SoapProtocolReflector.cs
- XmlUnspecifiedAttribute.cs
- ThousandthOfEmRealPoints.cs
- ImplicitInputBrush.cs
- ExpressionEditorAttribute.cs
- WebPartDisplayModeCollection.cs
- HuffModule.cs
- ToolBarButtonClickEvent.cs
- StylusTip.cs
- UrlPath.cs
- HeaderedContentControl.cs
- TextViewElement.cs
- TemplateControlParser.cs
- Workspace.cs
- SQLChars.cs
- TrackingRecord.cs
- RequestQueryParser.cs
- SQLDecimalStorage.cs
- GridItemProviderWrapper.cs
- KeyEvent.cs
- CalendarAutomationPeer.cs
- Stopwatch.cs
- PatternMatchRules.cs
- ArrayMergeHelper.cs
- PlanCompilerUtil.cs
- EncodingTable.cs
- StylusCollection.cs
- EventLog.cs
- MembershipValidatePasswordEventArgs.cs
- Help.cs
- DtrList.cs
- EventMappingSettings.cs
- RadioButtonFlatAdapter.cs
- webclient.cs
- HttpCacheParams.cs
- OleDbTransaction.cs
- SubpageParaClient.cs
- UnsettableComboBox.cs
- LayoutManager.cs
- MatrixKeyFrameCollection.cs
- WindowsListViewGroupSubsetLink.cs
- SqlParameterizer.cs
- EntityStoreSchemaGenerator.cs
- ReadOnlyAttribute.cs
- TypeToken.cs
- LocatorBase.cs
- ScriptManager.cs
- Point3DCollectionConverter.cs
- StringSorter.cs
- DataFormat.cs
- Translator.cs
- TypeInfo.cs
- InfoCardMetadataExchangeClient.cs
- BaseParagraph.cs
- arc.cs
- EmptyEnumerable.cs
- SqlMethodCallConverter.cs
- DelegateArgument.cs
- HttpApplication.cs
- DependencyObjectProvider.cs
- DataGridViewBindingCompleteEventArgs.cs
- GridViewItemAutomationPeer.cs
- RuntimeConfigLKG.cs
- InkCanvasAutomationPeer.cs
- Table.cs
- CodeObject.cs
- ThreadAttributes.cs
- RelationshipEndMember.cs
- DecoderFallbackWithFailureFlag.cs