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
- RestClientProxyHandler.cs
- WebBaseEventKeyComparer.cs
- XDeferredAxisSource.cs
- RouteData.cs
- PriorityItem.cs
- LoginDesigner.cs
- ResourceProviderFactory.cs
- OpenFileDialog.cs
- XmlUnspecifiedAttribute.cs
- GeometryCollection.cs
- WsdlHelpGeneratorElement.cs
- CodeCastExpression.cs
- _emptywebproxy.cs
- AspCompat.cs
- SystemIPAddressInformation.cs
- WeakReference.cs
- ResourceDictionaryCollection.cs
- StreamUpdate.cs
- QueryNode.cs
- SyndicationFeed.cs
- HtmlInputControl.cs
- TreeNodeEventArgs.cs
- Base64Decoder.cs
- Icon.cs
- SQLDateTime.cs
- EditorZoneDesigner.cs
- Error.cs
- SliderAutomationPeer.cs
- FormsIdentity.cs
- _ProxyRegBlob.cs
- Ray3DHitTestResult.cs
- Visual.cs
- MsmqDecodeHelper.cs
- DataGridViewIntLinkedList.cs
- MenuItemAutomationPeer.cs
- COM2ColorConverter.cs
- Padding.cs
- ContextProperty.cs
- WorkflowService.cs
- sortedlist.cs
- SelectionProcessor.cs
- UrlMappingsSection.cs
- WorkflowDesignerColors.cs
- NativeCompoundFileAPIs.cs
- DialogResultConverter.cs
- ClickablePoint.cs
- ZipFileInfo.cs
- SiteMapPath.cs
- Expr.cs
- CookieProtection.cs
- serverconfig.cs
- Message.cs
- RequestCacheEntry.cs
- ConfigXmlAttribute.cs
- COM2IDispatchConverter.cs
- DetailsViewModeEventArgs.cs
- Attributes.cs
- ResizeBehavior.cs
- SymbolMethod.cs
- MasterPage.cs
- BooleanAnimationBase.cs
- RawAppCommandInputReport.cs
- DataBinder.cs
- TextProperties.cs
- RemotingSurrogateSelector.cs
- NameValueFileSectionHandler.cs
- AppDomainUnloadedException.cs
- HyperLinkColumn.cs
- DataControlButton.cs
- DetailsViewRowCollection.cs
- ParseNumbers.cs
- SafeLibraryHandle.cs
- CodeBlockBuilder.cs
- ChtmlTextWriter.cs
- DataGridPageChangedEventArgs.cs
- SelectionListDesigner.cs
- EditorZoneDesigner.cs
- ExtenderControl.cs
- InvalidPrinterException.cs
- StylusPointPropertyId.cs
- TextWriterTraceListener.cs
- AbstractDataSvcMapFileLoader.cs
- SimpleFileLog.cs
- OleDbConnectionInternal.cs
- XmlFormatReaderGenerator.cs
- WebPartVerb.cs
- DateTimeFormat.cs
- SuppressIldasmAttribute.cs
- QuaternionKeyFrameCollection.cs
- Section.cs
- ExceptQueryOperator.cs
- InputLanguageCollection.cs
- JsonSerializer.cs
- PackWebRequest.cs
- HeaderedContentControl.cs
- ServiceInfoCollection.cs
- TypedDataSetSchemaImporterExtension.cs
- MenuItemStyle.cs
- ItemCollection.cs
- basenumberconverter.cs