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
- TypeToken.cs
- ResetableIterator.cs
- UIntPtr.cs
- DetailsViewPageEventArgs.cs
- HtmlElementEventArgs.cs
- RequestFactory.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- PasswordTextNavigator.cs
- HashCoreRequest.cs
- UserValidatedEventArgs.cs
- CompositeTypefaceMetrics.cs
- ButtonBase.cs
- TypeConverterHelper.cs
- HostProtectionPermission.cs
- RequestStatusBarUpdateEventArgs.cs
- DelegateSerializationHolder.cs
- _NTAuthentication.cs
- ListViewDeletedEventArgs.cs
- RIPEMD160.cs
- VisualProxy.cs
- SettingsPropertyValue.cs
- AnimatedTypeHelpers.cs
- BuildDependencySet.cs
- CreateBookmarkScope.cs
- DictionaryBase.cs
- DeadCharTextComposition.cs
- GeometryCollection.cs
- Point3DCollection.cs
- XmlEventCache.cs
- securestring.cs
- StringKeyFrameCollection.cs
- XmlComplianceUtil.cs
- NameHandler.cs
- ItemAutomationPeer.cs
- Camera.cs
- HttpCapabilitiesSectionHandler.cs
- GroupStyle.cs
- SerializationException.cs
- KeyedByTypeCollection.cs
- dbdatarecord.cs
- DelimitedListTraceListener.cs
- AccessDataSource.cs
- IsolatedStorageException.cs
- TabOrder.cs
- ColumnCollection.cs
- XmlSerializationGeneratedCode.cs
- QualifierSet.cs
- DataBindingValueUIHandler.cs
- WorkflowTimerService.cs
- TypeSemantics.cs
- PassportAuthentication.cs
- RenameRuleObjectDialog.cs
- TypeElementCollection.cs
- UserControlAutomationPeer.cs
- TypeElement.cs
- BrowserCapabilitiesFactoryBase.cs
- ProviderSettings.cs
- RangeValuePattern.cs
- SemaphoreFullException.cs
- WpfSharedBamlSchemaContext.cs
- ParallelTimeline.cs
- ReaderOutput.cs
- SocketManager.cs
- SecurityException.cs
- BitmapFrame.cs
- BuildProviderInstallComponent.cs
- oledbconnectionstring.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- UniqueID.cs
- TranslateTransform.cs
- SqlMultiplexer.cs
- PolyLineSegment.cs
- HtmlFormParameterWriter.cs
- LayoutDump.cs
- DataRelationCollection.cs
- SQlBooleanStorage.cs
- XmlnsCompatibleWithAttribute.cs
- LayoutTableCell.cs
- KoreanLunisolarCalendar.cs
- DigitShape.cs
- DictionaryEditChange.cs
- IPEndPointCollection.cs
- FrameworkElement.cs
- ToolboxItemAttribute.cs
- WebResponse.cs
- Help.cs
- PartialList.cs
- Collection.cs
- AssemblyBuilder.cs
- SendMessageChannelCache.cs
- COM2IDispatchConverter.cs
- Vector3D.cs
- UnknownBitmapEncoder.cs
- SystemWebCachingSectionGroup.cs
- DataBindingExpressionBuilder.cs
- RegexNode.cs
- CfgSemanticTag.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ComponentCollection.cs
- DataSourceConverter.cs