Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / IfAction.cs / 1305376 / 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, "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 (Ref.Equal(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, "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 (Ref.Equal(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
- Iis7Helper.cs
- ClonableStack.cs
- Blend.cs
- XpsS0ValidatingLoader.cs
- X509Utils.cs
- WebHttpElement.cs
- NativeMethods.cs
- RefExpr.cs
- Method.cs
- ScalarConstant.cs
- ConditionalBranch.cs
- HelloOperationCD1AsyncResult.cs
- ObjectListCommandCollection.cs
- dbdatarecord.cs
- JobPageOrder.cs
- ParserOptions.cs
- CommandSet.cs
- TextFormatter.cs
- ObjectItemNoOpAssemblyLoader.cs
- CodeCommentStatementCollection.cs
- EncryptedReference.cs
- GridViewColumn.cs
- StorageSetMapping.cs
- FileDialog.cs
- BufferedWebEventProvider.cs
- UIElementAutomationPeer.cs
- Matrix3DValueSerializer.cs
- TextTreePropertyUndoUnit.cs
- DriveInfo.cs
- ControlPaint.cs
- LZCodec.cs
- SoapSchemaImporter.cs
- UriExt.cs
- PeerEndPoint.cs
- BezierSegment.cs
- SvcMapFileLoader.cs
- SelectedGridItemChangedEvent.cs
- DbConnectionPoolIdentity.cs
- ProcessHostFactoryHelper.cs
- HttpHandler.cs
- CodeValidator.cs
- DetailsViewPagerRow.cs
- PersianCalendar.cs
- SoapExtensionReflector.cs
- ObjectCacheSettings.cs
- TextUtf8RawTextWriter.cs
- BindingMAnagerBase.cs
- BufferedGraphics.cs
- RoleExceptions.cs
- ProfileModule.cs
- Helpers.cs
- OrthographicCamera.cs
- Parser.cs
- Stroke.cs
- CompilationRelaxations.cs
- Point.cs
- xsdvalidator.cs
- MenuItemStyleCollectionEditor.cs
- StandardTransformFactory.cs
- ContentElementAutomationPeer.cs
- EntityClientCacheEntry.cs
- XmlElementCollection.cs
- ExcludePathInfo.cs
- DbConnectionHelper.cs
- ParallelDesigner.cs
- IsolatedStorageSecurityState.cs
- BindingGraph.cs
- TraversalRequest.cs
- documentsequencetextview.cs
- XPathSingletonIterator.cs
- DynamicEntity.cs
- StreamWithDictionary.cs
- ExpressionPrefixAttribute.cs
- DictionarySurrogate.cs
- WebPartZoneBase.cs
- Transform3DCollection.cs
- AppearanceEditorPart.cs
- AdPostCacheSubstitution.cs
- ValueExpressions.cs
- WebBrowser.cs
- SqlError.cs
- Utils.cs
- ProfileGroupSettingsCollection.cs
- XamlParser.cs
- ClientData.cs
- DoubleAnimationBase.cs
- AssemblyNameProxy.cs
- AvTraceFormat.cs
- ComponentCollection.cs
- TypeConverterMarkupExtension.cs
- SpoolingTaskBase.cs
- AutomationPatternInfo.cs
- VirtualizingStackPanel.cs
- UdpDiscoveryMessageFilter.cs
- XsltContext.cs
- GPPOINT.cs
- NamespaceDisplay.xaml.cs
- baseaxisquery.cs
- CodeObject.cs
- FileDialog.cs