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 / 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
- AppSettingsExpressionBuilder.cs
- TextRunTypographyProperties.cs
- __FastResourceComparer.cs
- BitmapEffectOutputConnector.cs
- FixedTextBuilder.cs
- DiffuseMaterial.cs
- SynchronizationScope.cs
- ResourceDescriptionAttribute.cs
- GridPatternIdentifiers.cs
- Configuration.cs
- MemberRelationshipService.cs
- WebUtil.cs
- LabelDesigner.cs
- DrawListViewSubItemEventArgs.cs
- SoapSchemaImporter.cs
- GcHandle.cs
- ListViewItemSelectionChangedEvent.cs
- ReadWriteSpinLock.cs
- FixUpCollection.cs
- DataSourceProvider.cs
- DefinitionUpdate.cs
- AuthenticationSection.cs
- DynamicDiscoSearcher.cs
- Operators.cs
- FilteredDataSetHelper.cs
- CollectionEditor.cs
- XmlAttributeAttribute.cs
- MediaElement.cs
- RSAOAEPKeyExchangeDeformatter.cs
- EntityDescriptor.cs
- cryptoapiTransform.cs
- OutputCacheSection.cs
- Fault.cs
- HostingEnvironmentSection.cs
- WebPartConnectionsEventArgs.cs
- AssemblyCache.cs
- ViewDesigner.cs
- SchemaComplexType.cs
- OverrideMode.cs
- EnlistmentState.cs
- InterleavedZipPartStream.cs
- ObjectViewQueryResultData.cs
- SqlDataSourceView.cs
- OracleInfoMessageEventArgs.cs
- ReferenceConverter.cs
- _ConnectStream.cs
- APCustomTypeDescriptor.cs
- ReadOnlyPropertyMetadata.cs
- MethodBuilder.cs
- ObjectAnimationBase.cs
- VisualStyleTypesAndProperties.cs
- SharedPersonalizationStateInfo.cs
- ControlBuilderAttribute.cs
- ListView.cs
- AdPostCacheSubstitution.cs
- ClientConfigurationHost.cs
- AmbientLight.cs
- DetailsViewModeEventArgs.cs
- SchemaImporter.cs
- TableAdapterManagerHelper.cs
- ToolConsole.cs
- GridPattern.cs
- StringConverter.cs
- MemberCollection.cs
- ResourceAssociationType.cs
- SafeCertificateContext.cs
- TrackingExtract.cs
- _Semaphore.cs
- ClientTarget.cs
- MultipleViewPattern.cs
- ExtensionQuery.cs
- TcpAppDomainProtocolHandler.cs
- ViewBase.cs
- Filter.cs
- EntityClientCacheKey.cs
- ColumnHeaderConverter.cs
- httpstaticobjectscollection.cs
- SqlCharStream.cs
- Ref.cs
- WeakRefEnumerator.cs
- ScriptManagerProxy.cs
- FontStyles.cs
- MobileControlsSectionHandler.cs
- WindowsGraphicsCacheManager.cs
- ResumeStoryboard.cs
- XmlDictionaryReaderQuotas.cs
- ObjectListItemCollection.cs
- XmlEventCache.cs
- PathData.cs
- SiteMapNodeItemEventArgs.cs
- ActivityPropertyReference.cs
- EntitySqlException.cs
- BamlTreeNode.cs
- ColorIndependentAnimationStorage.cs
- Configuration.cs
- DataControlPagerLinkButton.cs
- LowerCaseStringConverter.cs
- ResXResourceWriter.cs
- PtsPage.cs
- WebConfigurationHostFileChange.cs