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
- X509Utils.cs
- MetadataCache.cs
- RequestQueue.cs
- EdmMember.cs
- DocobjHost.cs
- SourceChangedEventArgs.cs
- SQLBoolean.cs
- FixedTextContainer.cs
- ExceptionUtil.cs
- RadioButton.cs
- hwndwrapper.cs
- PixelFormat.cs
- ItemsChangedEventArgs.cs
- NotFiniteNumberException.cs
- TiffBitmapEncoder.cs
- Int32AnimationUsingKeyFrames.cs
- FrameworkReadOnlyPropertyMetadata.cs
- UITypeEditor.cs
- ConfigurationSchemaErrors.cs
- SmtpNetworkElement.cs
- PeerCollaborationPermission.cs
- ToolTipService.cs
- JsonServiceDocumentSerializer.cs
- RenderData.cs
- BitSet.cs
- RoutedEventConverter.cs
- PageBorderless.cs
- SqlFacetAttribute.cs
- Debugger.cs
- MetaTable.cs
- WebConfigurationHost.cs
- CodeDelegateCreateExpression.cs
- SyndicationDeserializer.cs
- BCryptNative.cs
- GroupQuery.cs
- PasswordValidationException.cs
- DeploymentSection.cs
- SoapExtensionImporter.cs
- XmlAttributes.cs
- SafeSystemMetrics.cs
- CryptographicAttribute.cs
- ProfilePropertyNameValidator.cs
- InstanceCollisionException.cs
- TypedTableGenerator.cs
- MtomMessageEncoder.cs
- OrthographicCamera.cs
- GenericUriParser.cs
- FixedSOMGroup.cs
- TableSectionStyle.cs
- ExpressionParser.cs
- RunWorkerCompletedEventArgs.cs
- ProcessDesigner.cs
- SwitchDesigner.xaml.cs
- SerializationFieldInfo.cs
- InputBuffer.cs
- DBPropSet.cs
- VariantWrapper.cs
- KnowledgeBase.cs
- MessageSecurityOverTcp.cs
- Rfc2898DeriveBytes.cs
- FocusChangedEventArgs.cs
- CompilerCollection.cs
- ResponseStream.cs
- WindowsListViewScroll.cs
- ArrayExtension.cs
- BrowserDefinitionCollection.cs
- TextOptions.cs
- BaseTemplatedMobileComponentEditor.cs
- EntityDataSourceViewSchema.cs
- StylusDevice.cs
- Bezier.cs
- TemplateKey.cs
- HuffmanTree.cs
- GridViewCancelEditEventArgs.cs
- ColumnReorderedEventArgs.cs
- OutputCacheSettingsSection.cs
- PropertyPushdownHelper.cs
- NodeFunctions.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- TextTreeTextElementNode.cs
- RoleGroup.cs
- ListCardsInFileRequest.cs
- CodeIndexerExpression.cs
- AdornerHitTestResult.cs
- ToolstripProfessionalRenderer.cs
- TextParaLineResult.cs
- NamespaceList.cs
- LogStore.cs
- SqlAliaser.cs
- PathSegmentCollection.cs
- ThreadAbortException.cs
- PreservationFileReader.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- DiagnosticTrace.cs
- SqlServices.cs
- FileUpload.cs
- IssuanceLicense.cs
- FileUpload.cs
- DesignerTextWriter.cs
- DataObjectMethodAttribute.cs