Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SourceFileInfo.cs
- Util.cs
- SpecialTypeDataContract.cs
- ETagAttribute.cs
- XamlWrapperReaders.cs
- NodeCounter.cs
- Itemizer.cs
- TypeToken.cs
- AutoFocusStyle.xaml.cs
- Type.cs
- HasActivatableWorkflowEvent.cs
- WorkflowRuntimeEndpoint.cs
- CatalogZone.cs
- GraphicsState.cs
- DetailsViewDeleteEventArgs.cs
- ProvideValueServiceProvider.cs
- BitmapEffectCollection.cs
- CodeDelegateCreateExpression.cs
- XamlClipboardData.cs
- CustomErrorsSectionWrapper.cs
- ScrollChrome.cs
- PropertyFilter.cs
- ContainerFilterService.cs
- RankException.cs
- ByteStreamGeometryContext.cs
- TextEditorTables.cs
- InputReport.cs
- NamespaceDecl.cs
- DateTimeFormatInfoScanner.cs
- ConnectionStringsSection.cs
- XPathItem.cs
- MessageQueueException.cs
- NotificationContext.cs
- DbExpressionRules.cs
- ConfigXmlWhitespace.cs
- XamlFxTrace.cs
- Drawing.cs
- RootProfilePropertySettingsCollection.cs
- FontClient.cs
- WorkflowRequestContext.cs
- AffineTransform3D.cs
- ModuleConfigurationInfo.cs
- COSERVERINFO.cs
- ServiceNameCollection.cs
- StringBuilder.cs
- DbModificationCommandTree.cs
- HyperLink.cs
- LinkArea.cs
- ProcessModuleCollection.cs
- CodeAssignStatement.cs
- filewebresponse.cs
- DispatchOperation.cs
- EmissiveMaterial.cs
- UIPropertyMetadata.cs
- UserControl.cs
- ManagementBaseObject.cs
- ObjectDataSourceFilteringEventArgs.cs
- DesignerTextWriter.cs
- XhtmlBasicTextBoxAdapter.cs
- StylusDownEventArgs.cs
- ImportCatalogPart.cs
- _Events.cs
- XpsDocument.cs
- ListViewCommandEventArgs.cs
- UInt16Storage.cs
- IdentifierService.cs
- BindingOperations.cs
- Exceptions.cs
- SqlAggregateChecker.cs
- OdbcConnectionStringbuilder.cs
- StyleTypedPropertyAttribute.cs
- CheckBoxBaseAdapter.cs
- WebSysDescriptionAttribute.cs
- SqlConnectionStringBuilder.cs
- XamlDebuggerXmlReader.cs
- Header.cs
- LambdaSerializationException.cs
- WorkflowValidationFailedException.cs
- DecimalStorage.cs
- DecimalMinMaxAggregationOperator.cs
- Normalizer.cs
- EventListener.cs
- WebBrowserEvent.cs
- WebPermission.cs
- _SecureChannel.cs
- DateTimePickerDesigner.cs
- ArgumentException.cs
- Viewport3DAutomationPeer.cs
- SimpleTypeResolver.cs
- XmlWrappingReader.cs
- DataObjectSettingDataEventArgs.cs
- MetaData.cs
- SafeViewOfFileHandle.cs
- SqlDataSourceStatusEventArgs.cs
- RoleGroupCollection.cs
- dataSvcMapFileLoader.cs
- AttributeSetAction.cs
- NativeMethods.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- ResourceAttributes.cs