Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / XmlUtils / System / Xml / Xsl / Xslt / QilStrConcatenator.cs / 1 / QilStrConcatenator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; using System.Xml; using System.Xml.Schema; using System.Xml.Xsl.XPath; using System.Xml.Xsl.Qil; namespace System.Xml.Xsl.Xslt { internal class QilStrConcatenator { private XPathQilFactory f; private BufferBuilder builder; private QilList concat; private bool inUse = false; public QilStrConcatenator(XPathQilFactory f) { this.f = f; builder = new BufferBuilder(); } public void Reset() { Debug.Assert(! inUse); inUse = true; builder.Clear(); concat = null; } private void FlushBuilder() { if (concat == null) { concat = f.BaseFactory.Sequence(); } if (builder.Length != 0) { concat.Add(f.String(builder.ToString())); builder.Length = 0; } } public void Append(string value) { Debug.Assert(inUse, "Reset() wasn't called"); builder.Append(value); } public void Append(char value) { Debug.Assert(inUse, "Reset() wasn't called"); builder.Append(value); } public void Append(QilNode value) { Debug.Assert(inUse, "Reset() wasn't called"); if (value != null) { Debug.Assert(value.XmlType.TypeCode == XmlTypeCode.String); if (value.NodeType == QilNodeType.LiteralString) { builder.Append((string)(QilLiteral)value); } else { FlushBuilder(); concat.Add(value); } } } public QilNode ToQil() { Debug.Assert(inUse); // If we want allow multiple calls to ToQil() this logic should be changed inUse = false; if (concat == null) { return f.String(builder.ToString()); } else { FlushBuilder(); return f.StrConcat(concat); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; using System.Xml; using System.Xml.Schema; using System.Xml.Xsl.XPath; using System.Xml.Xsl.Qil; namespace System.Xml.Xsl.Xslt { internal class QilStrConcatenator { private XPathQilFactory f; private BufferBuilder builder; private QilList concat; private bool inUse = false; public QilStrConcatenator(XPathQilFactory f) { this.f = f; builder = new BufferBuilder(); } public void Reset() { Debug.Assert(! inUse); inUse = true; builder.Clear(); concat = null; } private void FlushBuilder() { if (concat == null) { concat = f.BaseFactory.Sequence(); } if (builder.Length != 0) { concat.Add(f.String(builder.ToString())); builder.Length = 0; } } public void Append(string value) { Debug.Assert(inUse, "Reset() wasn't called"); builder.Append(value); } public void Append(char value) { Debug.Assert(inUse, "Reset() wasn't called"); builder.Append(value); } public void Append(QilNode value) { Debug.Assert(inUse, "Reset() wasn't called"); if (value != null) { Debug.Assert(value.XmlType.TypeCode == XmlTypeCode.String); if (value.NodeType == QilNodeType.LiteralString) { builder.Append((string)(QilLiteral)value); } else { FlushBuilder(); concat.Add(value); } } } public QilNode ToQil() { Debug.Assert(inUse); // If we want allow multiple calls to ToQil() this logic should be changed inUse = false; if (concat == null) { return f.String(builder.ToString()); } else { FlushBuilder(); return f.StrConcat(concat); } } } } // 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
- SecurityException.cs
- AnnotationResourceCollection.cs
- Trace.cs
- TableItemProviderWrapper.cs
- CustomAttributeBuilder.cs
- UnmanagedMemoryStream.cs
- StatusBarItemAutomationPeer.cs
- WpfSharedBamlSchemaContext.cs
- InlineCategoriesDocument.cs
- ClientScriptManager.cs
- BufferedReadStream.cs
- EventMap.cs
- DefinitionUpdate.cs
- VisualBasicHelper.cs
- DbConnectionInternal.cs
- SocketException.cs
- TraceHandler.cs
- unsafenativemethodstextservices.cs
- TraceUtility.cs
- SapiRecoInterop.cs
- StandardCommands.cs
- TranslateTransform.cs
- DiagnosticStrings.cs
- AnalyzedTree.cs
- EmptyStringExpandableObjectConverter.cs
- ButtonRenderer.cs
- InputScope.cs
- XmlAggregates.cs
- FrameworkRichTextComposition.cs
- LateBoundBitmapDecoder.cs
- ExpandSegmentCollection.cs
- CodeAttributeDeclarationCollection.cs
- NativeCppClassAttribute.cs
- DetailsViewUpdatedEventArgs.cs
- CodeVariableReferenceExpression.cs
- webeventbuffer.cs
- XmlDataSource.cs
- WSHttpBindingBaseElement.cs
- WindowsToolbarAsMenu.cs
- WindowsContainer.cs
- MSAANativeProvider.cs
- StopStoryboard.cs
- RepeatButton.cs
- GZipDecoder.cs
- SerTrace.cs
- UniqueEventHelper.cs
- BookmarkOptionsHelper.cs
- XmlCodeExporter.cs
- OleDbTransaction.cs
- MarshalDirectiveException.cs
- RSAOAEPKeyExchangeDeformatter.cs
- QuerySetOp.cs
- CryptoKeySecurity.cs
- ReferencedType.cs
- Selection.cs
- PropertyValue.cs
- BitStack.cs
- SourceFileBuildProvider.cs
- Int32KeyFrameCollection.cs
- StackSpiller.Generated.cs
- FieldNameLookup.cs
- PolyLineSegmentFigureLogic.cs
- MasterPageBuildProvider.cs
- FragmentQueryKB.cs
- dbdatarecord.cs
- cryptoapiTransform.cs
- HtmlControlAdapter.cs
- RSAOAEPKeyExchangeFormatter.cs
- ToolStripRenderer.cs
- DesignBindingPropertyDescriptor.cs
- EventLogEntry.cs
- _TimerThread.cs
- ProcessModelSection.cs
- ColorTranslator.cs
- ValidationHelper.cs
- EntityProviderServices.cs
- MILUtilities.cs
- DataBoundLiteralControl.cs
- FilterRepeater.cs
- CancelRequestedRecord.cs
- LogRecordSequence.cs
- InfoCardAsymmetricCrypto.cs
- XPathDocumentIterator.cs
- DesignerLoader.cs
- CustomErrorCollection.cs
- InvocationExpression.cs
- MembershipAdapter.cs
- CaretElement.cs
- PropertyPathConverter.cs
- UIElementParaClient.cs
- BamlRecordReader.cs
- RichTextBoxAutomationPeer.cs
- MimeFormatExtensions.cs
- BoundingRectTracker.cs
- Comparer.cs
- EnumUnknown.cs
- ExceptionValidationRule.cs
- objectresult_tresulttype.cs
- SettingsBase.cs
- FunctionOverloadResolver.cs