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
- Win32Exception.cs
- FieldMetadata.cs
- DrawingDrawingContext.cs
- DocumentPaginator.cs
- BlurBitmapEffect.cs
- WebHttpSecurityElement.cs
- SelectionItemPattern.cs
- ValidationPropertyAttribute.cs
- Vector.cs
- EpmCustomContentWriterNodeData.cs
- ConfigurationManagerHelper.cs
- PersonalizationStateInfoCollection.cs
- PassportAuthenticationEventArgs.cs
- SecurityTimestamp.cs
- ErrorFormatterPage.cs
- SectionInformation.cs
- FileNotFoundException.cs
- ResourcePermissionBaseEntry.cs
- QilStrConcat.cs
- InternalBufferOverflowException.cs
- CssTextWriter.cs
- _ChunkParse.cs
- SystemUdpStatistics.cs
- TransactionContextManager.cs
- VSWCFServiceContractGenerator.cs
- BulletDecorator.cs
- ThreadAttributes.cs
- HttpHandlersSection.cs
- DiffuseMaterial.cs
- ObjectReaderCompiler.cs
- GeometryModel3D.cs
- WebEvents.cs
- XmlDesignerDataSourceView.cs
- PostBackOptions.cs
- FlowLayoutSettings.cs
- ExpressionBuilder.cs
- SortAction.cs
- TrackBarDesigner.cs
- DesignerActionHeaderItem.cs
- InternalBase.cs
- SafeRightsManagementHandle.cs
- NativeMethods.cs
- WebPartZoneBase.cs
- Duration.cs
- ToolStripOverflow.cs
- StylusEventArgs.cs
- LinqDataSourceDisposeEventArgs.cs
- SyntaxCheck.cs
- DesignOnlyAttribute.cs
- WorkflowDebuggerSteppingAttribute.cs
- WebPageTraceListener.cs
- VisualTarget.cs
- WebServiceErrorEvent.cs
- IisTraceWebEventProvider.cs
- AnnotationDocumentPaginator.cs
- AxisAngleRotation3D.cs
- SHA1.cs
- WebPartManager.cs
- PrincipalPermission.cs
- CustomWebEventKey.cs
- Hashtable.cs
- PersistenceTypeAttribute.cs
- BinaryMethodMessage.cs
- DesignerLoader.cs
- FixedSOMLineCollection.cs
- HtmlAnchor.cs
- FtpCachePolicyElement.cs
- WindowsAuthenticationModule.cs
- CreateParams.cs
- Canonicalizers.cs
- BoolExpressionVisitors.cs
- AtomServiceDocumentSerializer.cs
- BamlBinaryReader.cs
- ProfilePropertySettings.cs
- BitmapEffectInputData.cs
- PagesSection.cs
- ColumnReorderedEventArgs.cs
- Accessible.cs
- HtmlElementCollection.cs
- MaterialGroup.cs
- DefaultBinder.cs
- IPipelineRuntime.cs
- DebuggerAttributes.cs
- PropertyManager.cs
- DropSource.cs
- JsonMessageEncoderFactory.cs
- BooleanProjectedSlot.cs
- NaturalLanguageHyphenator.cs
- ToolStripEditorManager.cs
- Site.cs
- Task.cs
- StreamGeometry.cs
- BezierSegment.cs
- webproxy.cs
- SqlException.cs
- HttpWriter.cs
- ConstructorBuilder.cs
- Version.cs
- XmlSchemaObject.cs
- TextBreakpoint.cs