Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ReaderWriterLock.cs
- Pool.cs
- ObjectPersistData.cs
- ReflectionUtil.cs
- IsolatedStorage.cs
- DescendantBaseQuery.cs
- OracleParameter.cs
- ApplicationFileCodeDomTreeGenerator.cs
- HttpListenerContext.cs
- WeakHashtable.cs
- XmlSchemaSimpleType.cs
- OutputWindow.cs
- ToolStripArrowRenderEventArgs.cs
- DataGridViewColumnConverter.cs
- PrintEvent.cs
- CacheOutputQuery.cs
- AdornerPresentationContext.cs
- QueueSurrogate.cs
- BitmapEffectInput.cs
- Helpers.cs
- CounterCreationDataCollection.cs
- MetadataArtifactLoaderCompositeResource.cs
- ConnectionStringsExpressionBuilder.cs
- UrlAuthFailedErrorFormatter.cs
- LinqToSqlWrapper.cs
- TableCellCollection.cs
- AvTrace.cs
- DataGridItemAttachedStorage.cs
- MonthCalendar.cs
- RotateTransform3D.cs
- ExpressionDumper.cs
- DBDataPermission.cs
- Bits.cs
- SqlRowUpdatedEvent.cs
- VirtualizedContainerService.cs
- SafeTimerHandle.cs
- PathFigureCollectionConverter.cs
- DayRenderEvent.cs
- LowerCaseStringConverter.cs
- ToolBarButton.cs
- CharEntityEncoderFallback.cs
- SoapCodeExporter.cs
- RequestNavigateEventArgs.cs
- WindowAutomationPeer.cs
- DefaultDiscoveryServiceExtension.cs
- ResourceContainer.cs
- ImmutableCollection.cs
- WorkflowPersistenceContext.cs
- ContextInformation.cs
- CheckBoxStandardAdapter.cs
- ScrollChrome.cs
- DbConnectionPoolCounters.cs
- SymbolEqualComparer.cs
- Rotation3DAnimationBase.cs
- PagePropertiesChangingEventArgs.cs
- ToolStripItemClickedEventArgs.cs
- ExecutionContext.cs
- TextParagraphProperties.cs
- NotCondition.cs
- ReturnEventArgs.cs
- ValueSerializerAttribute.cs
- ExceptionWrapper.cs
- _NetworkingPerfCounters.cs
- SingleAnimationBase.cs
- XmlHierarchyData.cs
- ServiceOperationListItemList.cs
- TextCompositionEventArgs.cs
- VirtualPath.cs
- DbConnectionPool.cs
- SlipBehavior.cs
- MetadataCollection.cs
- SQLInt16.cs
- EncodingNLS.cs
- TaskHelper.cs
- SymbolPair.cs
- GorillaCodec.cs
- InputGestureCollection.cs
- GreenMethods.cs
- CounterCreationDataCollection.cs
- CLSCompliantAttribute.cs
- MouseEvent.cs
- PropertyDescriptor.cs
- _SingleItemRequestCache.cs
- XNodeValidator.cs
- StaticExtension.cs
- ColumnMapTranslator.cs
- CompilerParameters.cs
- MouseButtonEventArgs.cs
- FrameDimension.cs
- TreeViewImageIndexConverter.cs
- AudienceUriMode.cs
- TakeQueryOptionExpression.cs
- VectorValueSerializer.cs
- TextEditorThreadLocalStore.cs
- TranslateTransform.cs
- ComponentTray.cs
- ExtensionFile.cs
- Rectangle.cs
- SmiEventSink_DeferedProcessing.cs
- LogFlushAsyncResult.cs