Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / QueryCoreOp.cs / 1 / QueryCoreOp.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.Diagnostics; using System.Collections; using System.Threading; using System.Xml.Xsl; using System.Xml.XPath; internal class PushContextNodeOpcode : Opcode { internal PushContextNodeOpcode() : base(OpcodeID.PushContextNode) { } internal override Opcode Eval(ProcessingContext context) { context.PushContextSequenceFrame(); NodeSequence seq = context.CreateSequence(); seq.StartNodeset(); seq.Add(context.Processor.ContextNode); seq.StopNodeset(); context.PushSequence(seq); return this.next; } } internal class PushContextPositionOpcode : Opcode { internal PushContextPositionOpcode() : base(OpcodeID.PushPosition) { } internal override Opcode Eval(ProcessingContext context) { context.TransferSequencePositions(); return this.next; } } internal class PopSequenceToValueStackOpcode : Opcode { internal PopSequenceToValueStackOpcode() : base(OpcodeID.PopSequenceToValueStack) { } internal override Opcode Eval(ProcessingContext context) { context.PopSequenceFrameToValueStack(); return this.next; } } internal class PopSequenceToSequenceStackOpcode : Opcode { internal PopSequenceToSequenceStackOpcode() : base(OpcodeID.PopSequenceToSequenceStack) { } internal override Opcode Eval(ProcessingContext context) { context.PushSequenceFrameFromValueStack(); return this.next; } } #if NO internal class PushContextCopy : Opcode { internal PushContextCopy() : base(OpcodeID.PushContextCopy) { } internal override Opcode Eval(ProcessingContext context) { NodeSequenceStack stack = context.SequenceStack; StackFrame sequences = stack.TopArg; stack.PushFrame(); for (int i = 0; i < sequences.count; ++i) { NodeSequence sourceSeq = stack.Sequences[sequences[i]]; sourceSeq.refCount++; stack.Push(sourceSeq); } return this.next; } } #endif internal class PopContextNodes : Opcode { internal PopContextNodes() : base(OpcodeID.PopContextNodes) { } internal override Opcode Eval(ProcessingContext context) { context.PopContextSequenceFrame(); return this.next; } } #if NO internal class PopValueFrameOpcode : Opcode { internal PopValueFrameOpcode() : base(OpcodeID.PopValueFrame) { } internal override Opcode Eval(ProcessingContext context) { context.PopFrame(); return this.next; } } #endif internal class PushStringOpcode : Opcode { string literal; internal PushStringOpcode(string literal) : base(OpcodeID.PushString) { DiagnosticUtility.DebugAssert(null != literal, ""); this.literal = literal; this.flags |= OpcodeFlags.Literal; } internal override bool Equals(Opcode op) { if (base.Equals(op)) { return (this.literal == ((PushStringOpcode) op).literal); } return false; } internal override Opcode Eval(ProcessingContext context) { context.PushFrame(); int count = context.IterationCount; if (count > 0) { context.Push(this.literal, count); } return this.next; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.literal); } #endif } internal class PushNumberOpcode : Opcode { double literal; internal PushNumberOpcode(double literal) : base(OpcodeID.PushDouble) { this.literal = literal; this.flags |= OpcodeFlags.Literal; } internal override bool Equals(Opcode op) { if (base.Equals(op)) { return (this.literal == ((PushNumberOpcode) op).literal); } return false; } internal override Opcode Eval(ProcessingContext context) { context.PushFrame(); int count = context.IterationCount; if (count > 0) { context.Push(this.literal, count); } return this.next; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.literal); } #endif } internal class PushBooleanOpcode : Opcode { bool literal; internal PushBooleanOpcode(bool literal) : base(OpcodeID.PushBool) { this.literal = literal; this.flags |= OpcodeFlags.Literal; } internal override bool Equals(Opcode op) { if (base.Equals(op)) { return (this.literal == ((PushBooleanOpcode) op).literal); } return false; } internal override Opcode Eval(ProcessingContext context) { context.PushFrame(); int count = context.IterationCount; if (count > 0) { context.Push(this.literal, count); } return this.next; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.literal); } #endif } internal class PushXsltVariableOpcode : Opcode { XsltContext xsltContext; IXsltContextVariable variable; ValueDataType type; internal PushXsltVariableOpcode(XsltContext context, IXsltContextVariable variable) : base(OpcodeID.PushXsltVariable) { DiagnosticUtility.DebugAssert(null != context && null != variable, ""); this.xsltContext = context; this.variable = variable; this.type = XPathXsltFunctionExpr.ConvertTypeFromXslt(variable.VariableType); // Make sure the type is supported switch(this.type) { case ValueDataType.Boolean: case ValueDataType.Double: case ValueDataType.String: case ValueDataType.Sequence: break; default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidType, SR.GetString(SR.QueryVariableTypeNotSupported, this.variable.VariableType.ToString()))); } } internal override bool Equals(Opcode op) { if (base.Equals(op)) { PushXsltVariableOpcode var = op as PushXsltVariableOpcode; if(var != null) { return this.xsltContext == var.xsltContext && this.variable == var.variable; } } return false; } internal override Opcode Eval(ProcessingContext context) { context.PushFrame(); int count = context.IterationCount; if(count > 0) { object o = this.variable.Evaluate(this.xsltContext); if(o == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryProcessingException(QueryProcessingError.Unexpected, SR.GetString(SR.QueryVariableNull))); } switch(this.type) { case ValueDataType.Boolean: context.Push((bool)o, count); break; case ValueDataType.Double: context.Push((double)o, count); break; case ValueDataType.String: context.Push((string)o, count); break; case ValueDataType.Sequence: XPathNodeIterator iter = (XPathNodeIterator)o; NodeSequence seq = context.CreateSequence(); while(iter.MoveNext()) { SeekableXPathNavigator nav = iter.Current as SeekableXPathNavigator; if(nav != null) { seq.Add(nav); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryProcessingException(QueryProcessingError.Unexpected, SR.GetString(SR.QueryMustBeSeekable))); } } context.Push(seq, count); break; default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.Unexpected, SR.GetString(SR.QueryVariableTypeNotSupported, this.variable.VariableType.ToString()))); } } return this.next; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} IXsltContextVariable: {1}", base.ToString(), this.variable.ToString()); } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjectItemConventionAssemblyLoader.cs
- XmlReader.cs
- Completion.cs
- ModifiableIteratorCollection.cs
- ResourcePart.cs
- _AutoWebProxyScriptWrapper.cs
- LayoutTable.cs
- Style.cs
- GridItem.cs
- TextLine.cs
- URL.cs
- MouseActionConverter.cs
- FormatException.cs
- WebPartsPersonalization.cs
- ClientRuntimeConfig.cs
- CodeTypeDelegate.cs
- MouseEvent.cs
- XmlSchemaAnyAttribute.cs
- StringValidatorAttribute.cs
- SqlAliasesReferenced.cs
- RemotingSurrogateSelector.cs
- SQLGuid.cs
- smtppermission.cs
- TimeSpanValidatorAttribute.cs
- SizeChangedEventArgs.cs
- Helper.cs
- ManagementPath.cs
- SymLanguageType.cs
- WorkingDirectoryEditor.cs
- IntPtr.cs
- WaitHandle.cs
- GridViewColumnHeaderAutomationPeer.cs
- SchemaImporterExtensionElement.cs
- ZipIOLocalFileDataDescriptor.cs
- ToolStripDropDownClosingEventArgs.cs
- DataGridViewCellStyleEditor.cs
- XmlTextWriter.cs
- BitmapEffectInputData.cs
- CheckBoxFlatAdapter.cs
- RewritingSimplifier.cs
- DataColumnMapping.cs
- SqlCommand.cs
- UrlAuthFailureHandler.cs
- XmlNamespaceMapping.cs
- HttpCapabilitiesSectionHandler.cs
- HMACSHA512.cs
- CodeEntryPointMethod.cs
- WindowsIPAddress.cs
- WindowsListViewItemCheckBox.cs
- DescendantQuery.cs
- ComponentCollection.cs
- Socket.cs
- ContextMenu.cs
- StateMachineSubscription.cs
- MailDefinition.cs
- PersistenceTypeAttribute.cs
- PasswordRecovery.cs
- DataTablePropertyDescriptor.cs
- MarshalByValueComponent.cs
- ParentUndoUnit.cs
- DBConnection.cs
- Error.cs
- SmiXetterAccessMap.cs
- SystemIPGlobalStatistics.cs
- PanningMessageFilter.cs
- ReferentialConstraint.cs
- ProbeDuplexCD1AsyncResult.cs
- ItemList.cs
- DataPointer.cs
- FaultException.cs
- XPathConvert.cs
- CommandDevice.cs
- ProcessManager.cs
- ReaderWriterLockWrapper.cs
- ElementNotAvailableException.cs
- ModuleConfigurationInfo.cs
- BCryptSafeHandles.cs
- PageAdapter.cs
- RemotingHelper.cs
- EventEntry.cs
- GroupLabel.cs
- ResourceLoader.cs
- EventSetter.cs
- FormClosedEvent.cs
- SqlColumnizer.cs
- XmlLanguageConverter.cs
- MLangCodePageEncoding.cs
- TypeConverterBase.cs
- WebPartConnectionsConnectVerb.cs
- PolicyException.cs
- SerializationStore.cs
- DeploymentExceptionMapper.cs
- DataRelationPropertyDescriptor.cs
- QuotedStringWriteStateInfo.cs
- Vector3DAnimation.cs
- XPathCompileException.cs
- Site.cs
- CodeDomExtensionMethods.cs
- XmlIlTypeHelper.cs
- TraceUtils.cs