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
- OleDbConnectionPoolGroupProviderInfo.cs
- AffineTransform3D.cs
- MbpInfo.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- StylusShape.cs
- MembershipPasswordException.cs
- ErrorFormatterPage.cs
- Tool.cs
- WizardDesigner.cs
- ZipArchive.cs
- ThumbAutomationPeer.cs
- ObjectListFieldCollection.cs
- ZipIOCentralDirectoryFileHeader.cs
- XmlUtilWriter.cs
- XmlExceptionHelper.cs
- UrlPath.cs
- UDPClient.cs
- FixedPageStructure.cs
- ValueTable.cs
- LineVisual.cs
- Selection.cs
- PenLineCapValidation.cs
- ReaderContextStackData.cs
- PropertyDescriptor.cs
- ExtensibleClassFactory.cs
- MsdtcWrapper.cs
- Constraint.cs
- NavigatorOutput.cs
- UdpTransportSettingsElement.cs
- ProbeDuplexAsyncResult.cs
- EffectiveValueEntry.cs
- ByteFacetDescriptionElement.cs
- FixedPageAutomationPeer.cs
- TableRowCollection.cs
- ListDictionaryInternal.cs
- UserNamePasswordValidator.cs
- RemotingConfiguration.cs
- TemplateFactory.cs
- StrongNameIdentityPermission.cs
- complextypematerializer.cs
- CompModSwitches.cs
- OracleInfoMessageEventArgs.cs
- SqlRowUpdatedEvent.cs
- HtmlMeta.cs
- SqlError.cs
- RegexCode.cs
- SignedXml.cs
- UserPersonalizationStateInfo.cs
- ResourceManager.cs
- ComponentEvent.cs
- TextReturnReader.cs
- Function.cs
- ObfuscationAttribute.cs
- UdpReplyToBehavior.cs
- TypeConstant.cs
- MeasureData.cs
- HttpCapabilitiesSectionHandler.cs
- PolyBezierSegmentFigureLogic.cs
- SHA1.cs
- _Events.cs
- RadialGradientBrush.cs
- NetworkInformationException.cs
- StateManagedCollection.cs
- RectangleF.cs
- PnrpPermission.cs
- CodeGroup.cs
- ButtonFieldBase.cs
- CodeAttachEventStatement.cs
- FormViewAutoFormat.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- AddressHeaderCollectionElement.cs
- ExpandableObjectConverter.cs
- SetIterators.cs
- ServiceOperationDetailViewControl.cs
- EventLogQuery.cs
- NameValueConfigurationCollection.cs
- DoubleAnimationBase.cs
- NameSpaceExtractor.cs
- MasterPage.cs
- ScrollBarRenderer.cs
- SecurityTokenProviderContainer.cs
- Message.cs
- CannotUnloadAppDomainException.cs
- SqlSelectStatement.cs
- FacetValueContainer.cs
- DerivedKeySecurityToken.cs
- CodeIterationStatement.cs
- RouteValueDictionary.cs
- VirtualizingPanel.cs
- KeyedHashAlgorithm.cs
- Label.cs
- Util.cs
- IIS7WorkerRequest.cs
- SchemaCollectionPreprocessor.cs
- HtmlLink.cs
- PenLineCapValidation.cs
- CompositeScriptReference.cs
- SourceLocationProvider.cs
- RuntimeResourceSet.cs
- Thumb.cs