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
- EventLogEntry.cs
- ConsumerConnectionPoint.cs
- StorageMappingItemLoader.cs
- TypeUtils.cs
- LogEntryHeaderSerializer.cs
- XamlToRtfParser.cs
- UserInitiatedNavigationPermission.cs
- DocumentEventArgs.cs
- DeviceContext.cs
- Privilege.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- WindowsGraphics2.cs
- PropertyChangedEventArgs.cs
- Module.cs
- ToolStripOverflow.cs
- SqlDataSourceQueryEditorForm.cs
- UnmanagedMemoryStreamWrapper.cs
- UIntPtr.cs
- Separator.cs
- TextBounds.cs
- HybridDictionary.cs
- elementinformation.cs
- XpsManager.cs
- SqlClientFactory.cs
- EditCommandColumn.cs
- EnlistmentTraceIdentifier.cs
- WeakReference.cs
- XmlSchemaComplexContentRestriction.cs
- CubicEase.cs
- AliasExpr.cs
- ScheduleChanges.cs
- RuntimeEnvironment.cs
- LightweightCodeGenerator.cs
- CannotUnloadAppDomainException.cs
- WebPartZoneCollection.cs
- MasterPage.cs
- ScriptControl.cs
- CmsInterop.cs
- EventMappingSettings.cs
- SmiEventSink.cs
- columnmapfactory.cs
- SocketElement.cs
- MasterPage.cs
- VoiceObjectToken.cs
- ParseHttpDate.cs
- ExpandedWrapper.cs
- ClockController.cs
- _HeaderInfo.cs
- StreamGeometry.cs
- AliasedExpr.cs
- BlurEffect.cs
- QueryResponse.cs
- GridItemProviderWrapper.cs
- Set.cs
- ConfigurationManagerInternalFactory.cs
- RawMouseInputReport.cs
- TextServicesPropertyRanges.cs
- MethodRental.cs
- AssemblySettingAttributes.cs
- AssemblyFilter.cs
- XsltContext.cs
- RSAProtectedConfigurationProvider.cs
- ParallelTimeline.cs
- PropertyInfo.cs
- StoryFragments.cs
- SpeechRecognitionEngine.cs
- DockEditor.cs
- WizardStepBase.cs
- FontStyleConverter.cs
- BasicExpandProvider.cs
- RightNameExpirationInfoPair.cs
- WebServiceHandler.cs
- MessageQueue.cs
- dbenumerator.cs
- DataFormats.cs
- ActiveDesignSurfaceEvent.cs
- SiteMapNode.cs
- Parameter.cs
- SHA256.cs
- NativeObjectSecurity.cs
- HandleValueEditor.cs
- AutoResizedEvent.cs
- UnhandledExceptionEventArgs.cs
- QueryLifecycle.cs
- CodeTypeDelegate.cs
- CodeConstructor.cs
- ActivityTrace.cs
- FrameworkContextData.cs
- WebPart.cs
- AuthStoreRoleProvider.cs
- DbConnectionFactory.cs
- SQLBinaryStorage.cs
- PrintDocument.cs
- ParentUndoUnit.cs
- HybridObjectCache.cs
- ImageAnimator.cs
- CriticalFinalizerObject.cs
- EntityDataSourceSelectedEventArgs.cs
- RelatedPropertyManager.cs
- AdornerLayer.cs