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
- MobileFormsAuthentication.cs
- ICspAsymmetricAlgorithm.cs
- HwndProxyElementProvider.cs
- Int32CAMarshaler.cs
- Column.cs
- DockingAttribute.cs
- DiffuseMaterial.cs
- SamlAuthenticationStatement.cs
- HatchBrush.cs
- DetailsViewRowCollection.cs
- Misc.cs
- BitmapSourceSafeMILHandle.cs
- ScriptHandlerFactory.cs
- NodeCounter.cs
- BaseTemplateBuildProvider.cs
- CreateUserWizard.cs
- TextSelection.cs
- OracleConnection.cs
- ProcessModelInfo.cs
- BaseWebProxyFinder.cs
- NoneExcludedImageIndexConverter.cs
- WhiteSpaceTrimStringConverter.cs
- QueryCacheEntry.cs
- LocalizableAttribute.cs
- PageContentCollection.cs
- TreeNodeCollectionEditor.cs
- GenericAuthenticationEventArgs.cs
- RenderData.cs
- ServiceModelConfigurationSectionGroup.cs
- WebPartEditorOkVerb.cs
- Profiler.cs
- SafeCryptContextHandle.cs
- XmlSchemaFacet.cs
- InteropExecutor.cs
- DataExpression.cs
- MimeMultiPart.cs
- FormViewPageEventArgs.cs
- BindStream.cs
- ExpandedWrapper.cs
- TextRange.cs
- XmlAttributeOverrides.cs
- RoleManagerModule.cs
- _LocalDataStoreMgr.cs
- AttributeCollection.cs
- HttpContextWrapper.cs
- TextEvent.cs
- SoapInteropTypes.cs
- ComponentResourceKey.cs
- PersistencePipeline.cs
- TypeExtensionConverter.cs
- HttpWebResponse.cs
- FormView.cs
- DesignSurfaceManager.cs
- DocumentPageHost.cs
- AppDomainCompilerProxy.cs
- DerivedKeySecurityTokenStub.cs
- SimpleWebHandlerParser.cs
- Activator.cs
- EngineSite.cs
- DataSourceBooleanViewSchemaConverter.cs
- SortQuery.cs
- SamlAuthorizationDecisionClaimResource.cs
- PictureBox.cs
- PublisherMembershipCondition.cs
- GridViewCancelEditEventArgs.cs
- Block.cs
- WindowVisualStateTracker.cs
- IPCCacheManager.cs
- SimpleMailWebEventProvider.cs
- TextServicesLoader.cs
- WebPartVerbsEventArgs.cs
- GorillaCodec.cs
- CodeStatement.cs
- AsyncResult.cs
- XComponentModel.cs
- AuthenticationSection.cs
- SoapAttributes.cs
- Peer.cs
- NullableBoolConverter.cs
- RuntimeHandles.cs
- XmlNamedNodeMap.cs
- LinkButton.cs
- ObjectDataSource.cs
- TextComposition.cs
- XmlnsCache.cs
- BitStack.cs
- BitmapFrameEncode.cs
- Config.cs
- HtmlFormParameterWriter.cs
- Lazy.cs
- SqlParameterCollection.cs
- PageAsyncTaskManager.cs
- ToolStripKeyboardHandlingService.cs
- PrefixHandle.cs
- PeerNameRecord.cs
- WinFormsUtils.cs
- ListView.cs
- UriTemplateQueryValue.cs
- MultiView.cs
- InvokeProviderWrapper.cs