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
- Rights.cs
- SchemaAttDef.cs
- EntityKeyElement.cs
- DataTable.cs
- JoinCqlBlock.cs
- SqlRemoveConstantOrderBy.cs
- ColumnMapTranslator.cs
- XmlTextReaderImplHelpers.cs
- Scripts.cs
- OneOfTypeConst.cs
- DocumentPageTextView.cs
- AbandonedMutexException.cs
- Debugger.cs
- RightsManagementSuppressedStream.cs
- DummyDataSource.cs
- XmlNamespaceMappingCollection.cs
- DecoderReplacementFallback.cs
- ContentValidator.cs
- ServiceMetadataPublishingElement.cs
- SQLUtility.cs
- PropertyItem.cs
- IgnoreDataMemberAttribute.cs
- ClientSession.cs
- ServiceHttpHandlerFactory.cs
- InputLanguageProfileNotifySink.cs
- ProgressBar.cs
- MasterPage.cs
- KeyedCollection.cs
- Input.cs
- DataGridViewComboBoxColumn.cs
- NavigationPropertyEmitter.cs
- TextOutput.cs
- IntSecurity.cs
- CSharpCodeProvider.cs
- SettingsAttributes.cs
- SqlCacheDependency.cs
- CodeArgumentReferenceExpression.cs
- CursorConverter.cs
- SkewTransform.cs
- DateTimeConstantAttribute.cs
- TargetParameterCountException.cs
- OleDbPropertySetGuid.cs
- MimeMultiPart.cs
- TreeNodeBindingCollection.cs
- TripleDES.cs
- DataKey.cs
- brushes.cs
- DefaultShape.cs
- DecimalAnimation.cs
- CollectionViewSource.cs
- PagerSettings.cs
- RepeaterDataBoundAdapter.cs
- CodeTypeDeclarationCollection.cs
- _ContextAwareResult.cs
- TraversalRequest.cs
- SqlXml.cs
- Pair.cs
- DataControlField.cs
- TypeBuilder.cs
- BlurBitmapEffect.cs
- TCPListener.cs
- RelationshipType.cs
- AlternateViewCollection.cs
- unitconverter.cs
- RoutedUICommand.cs
- GenericEnumerator.cs
- UrlPath.cs
- ImageBrush.cs
- BitmapDecoder.cs
- connectionpool.cs
- TransactionScope.cs
- CommandDevice.cs
- RestrictedTransactionalPackage.cs
- FilePrompt.cs
- MemberMaps.cs
- _ShellExpression.cs
- OrderPreservingPipeliningMergeHelper.cs
- PropertyPathWorker.cs
- ArraySubsetEnumerator.cs
- Size.cs
- DataGridViewUtilities.cs
- WebPartDisplayModeEventArgs.cs
- EntityDataSourceContextCreatedEventArgs.cs
- IgnoreFlushAndCloseStream.cs
- ConnectionManagementElement.cs
- SettingsSection.cs
- EditorResources.cs
- _OSSOCK.cs
- CmsInterop.cs
- SignHashRequest.cs
- IListConverters.cs
- TemplateBuilder.cs
- CacheModeConverter.cs
- Single.cs
- ProxyDataContractResolver.cs
- PreProcessor.cs
- CFStream.cs
- TransformerTypeCollection.cs
- XmlSchemaCollection.cs
- SymbolMethod.cs