Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / IfAction.cs / 1 / IfAction.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; internal class IfAction : ContainerAction { internal enum ConditionType { ConditionIf, ConditionWhen, ConditionOtherwise } private ConditionType type; private int testKey = Compiler.InvalidQueryKey; internal IfAction(ConditionType type) { this.type = type; } internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (this.type != ConditionType.ConditionOtherwise) { CheckRequiredAttribute(compiler, this.testKey != Compiler.InvalidQueryKey, Keywords.s_Test); } if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Test)) { if (this.type == ConditionType.ConditionOtherwise) { return false; } this.testKey = compiler.AddBooleanQuery(value); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) { Debug.Assert(this.testKey != Compiler.InvalidQueryKey); bool value = processor.EvaluateBoolean(frame, this.testKey); if (value == false) { frame.Finished(); break; } } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (this.type == ConditionType.ConditionWhen ||this.type == ConditionType.ConditionOtherwise) { Debug.Assert(frame.Container != null); frame.Exit(); } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; internal class IfAction : ContainerAction { internal enum ConditionType { ConditionIf, ConditionWhen, ConditionOtherwise } private ConditionType type; private int testKey = Compiler.InvalidQueryKey; internal IfAction(ConditionType type) { this.type = type; } internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (this.type != ConditionType.ConditionOtherwise) { CheckRequiredAttribute(compiler, this.testKey != Compiler.InvalidQueryKey, Keywords.s_Test); } if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(name, compiler.Atoms.Test)) { if (this.type == ConditionType.ConditionOtherwise) { return false; } this.testKey = compiler.AddBooleanQuery(value); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) { Debug.Assert(this.testKey != Compiler.InvalidQueryKey); bool value = processor.EvaluateBoolean(frame, this.testKey); if (value == false) { frame.Finished(); break; } } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (this.type == ConditionType.ConditionWhen ||this.type == ConditionType.ConditionOtherwise) { Debug.Assert(frame.Container != null); frame.Exit(); } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } } } } // 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
- OdbcEnvironment.cs
- _IPv4Address.cs
- PermissionAttributes.cs
- FilteredAttributeCollection.cs
- AuthenticationServiceManager.cs
- DriveInfo.cs
- sqlinternaltransaction.cs
- FontStretches.cs
- ColorBuilder.cs
- SpeechRecognizer.cs
- WindowsGrip.cs
- ISessionStateStore.cs
- LayoutEditorPart.cs
- embossbitmapeffect.cs
- DependencyObjectPropertyDescriptor.cs
- AccessibleObject.cs
- Identity.cs
- WebPartCancelEventArgs.cs
- SqlProvider.cs
- XmlTypeMapping.cs
- DataObjectMethodAttribute.cs
- PersonalizationProviderCollection.cs
- TextTreeFixupNode.cs
- AssemblyAttributesGoHere.cs
- Rect3D.cs
- oledbmetadatacollectionnames.cs
- Drawing.cs
- GlobalItem.cs
- UnSafeCharBuffer.cs
- SecurityException.cs
- Activator.cs
- RelationshipEntry.cs
- BinaryObjectReader.cs
- DbConnectionPoolGroupProviderInfo.cs
- lengthconverter.cs
- transactioncontext.cs
- SmiGettersStream.cs
- DockProviderWrapper.cs
- PageThemeBuildProvider.cs
- GenericParameterDataContract.cs
- X509RawDataKeyIdentifierClause.cs
- TypeUsage.cs
- Mapping.cs
- DataViewManager.cs
- DES.cs
- SoapObjectInfo.cs
- ImageSourceValueSerializer.cs
- VisualSerializer.cs
- AnnotationAuthorChangedEventArgs.cs
- DetectEofStream.cs
- TrustLevelCollection.cs
- ColumnBinding.cs
- ArraySet.cs
- XslAstAnalyzer.cs
- XmlArrayAttribute.cs
- DeviceOverridableAttribute.cs
- CompressStream.cs
- SendMailErrorEventArgs.cs
- WinFormsSecurity.cs
- HScrollBar.cs
- UInt16Converter.cs
- HttpServerUtilityBase.cs
- OdbcConnectionFactory.cs
- LinqDataSourceDisposeEventArgs.cs
- ContentTextAutomationPeer.cs
- ContentPosition.cs
- CodeSnippetStatement.cs
- InvalidFilterCriteriaException.cs
- OperandQuery.cs
- RadioButtonRenderer.cs
- UIElementAutomationPeer.cs
- ProjectionPathBuilder.cs
- Renderer.cs
- ComplexObject.cs
- MouseCaptureWithinProperty.cs
- QilName.cs
- GuidTagList.cs
- RootBrowserWindow.cs
- RenderContext.cs
- BamlTreeMap.cs
- LinkDesigner.cs
- ModelUtilities.cs
- SiteMapProvider.cs
- ConvertTextFrag.cs
- AddInProcess.cs
- StatusBar.cs
- ColorPalette.cs
- nulltextnavigator.cs
- SoapElementAttribute.cs
- WindowsAuthenticationModule.cs
- DummyDataSource.cs
- PhonemeConverter.cs
- BinarySecretSecurityToken.cs
- EntityProviderServices.cs
- DataGridViewRowsAddedEventArgs.cs
- FontSourceCollection.cs
- ExtendedPropertyInfo.cs
- UnitySerializationHolder.cs
- UrlPath.cs
- ObjectListFieldCollection.cs