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
- HandlerFactoryCache.cs
- SerializationAttributes.cs
- SecurityUtils.cs
- FormatterServices.cs
- DragStartedEventArgs.cs
- HostedTransportConfigurationBase.cs
- _ListenerResponseStream.cs
- XslTransform.cs
- ClientBuildManager.cs
- WizardStepBase.cs
- AspCompat.cs
- DispatcherExceptionFilterEventArgs.cs
- PngBitmapDecoder.cs
- DecimalAnimationUsingKeyFrames.cs
- TabPage.cs
- EnumValAlphaComparer.cs
- CodeDelegateInvokeExpression.cs
- CellIdBoolean.cs
- DesigntimeLicenseContext.cs
- BuildProvider.cs
- XsdValidatingReader.cs
- FormView.cs
- AsyncCompletedEventArgs.cs
- SmtpException.cs
- DotAtomReader.cs
- BitmapEffectOutputConnector.cs
- LessThanOrEqual.cs
- DefaultValueAttribute.cs
- DocumentPageView.cs
- ICollection.cs
- SQLRoleProvider.cs
- KeyProperty.cs
- TextPattern.cs
- StackOverflowException.cs
- ListParagraph.cs
- SemaphoreSecurity.cs
- CollectionDataContractAttribute.cs
- ListViewUpdatedEventArgs.cs
- EmissiveMaterial.cs
- PolyLineSegment.cs
- Point3DAnimationBase.cs
- FlowDocumentView.cs
- _HeaderInfoTable.cs
- HttpPostServerProtocol.cs
- ACL.cs
- OrderedHashRepartitionStream.cs
- FuncTypeConverter.cs
- Gdiplus.cs
- DataSourceView.cs
- ResourceDisplayNameAttribute.cs
- PreviewPrintController.cs
- TdsParserStaticMethods.cs
- DigestComparer.cs
- NaturalLanguageHyphenator.cs
- SignedPkcs7.cs
- DefaultPrintController.cs
- ConnectionProviderAttribute.cs
- ListViewContainer.cs
- ProjectionPathSegment.cs
- JsonReader.cs
- ReadOnlyDataSource.cs
- Visual.cs
- DataSourceProvider.cs
- DbTypeMap.cs
- XPathNodePointer.cs
- StreamInfo.cs
- EntityConnectionStringBuilderItem.cs
- WebPartZoneCollection.cs
- ServicePoint.cs
- ToolStripContentPanel.cs
- IPHostEntry.cs
- ItemType.cs
- SecuritySessionServerSettings.cs
- FullTextBreakpoint.cs
- OutgoingWebRequestContext.cs
- TrimSurroundingWhitespaceAttribute.cs
- SynchronizedKeyedCollection.cs
- TextServicesContext.cs
- RawStylusInputCustomData.cs
- Utility.cs
- Decoder.cs
- TemplateLookupAction.cs
- SqlUserDefinedTypeAttribute.cs
- SessionStateContainer.cs
- StylesEditorDialog.cs
- InputMethodStateChangeEventArgs.cs
- ExtenderControl.cs
- DataKey.cs
- SchemaAttDef.cs
- ExpressionBuilderContext.cs
- brushes.cs
- HtmlInputControl.cs
- Processor.cs
- FrameworkTemplate.cs
- RegularExpressionValidator.cs
- ConfigXmlSignificantWhitespace.cs
- ServicesSection.cs
- SpeakInfo.cs
- OracleConnectionString.cs
- TextDecorationCollectionConverter.cs