Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- UnsafeMethods.cs
- PingOptions.cs
- TreeChangeInfo.cs
- ParseChildrenAsPropertiesAttribute.cs
- DESCryptoServiceProvider.cs
- CommentGlyph.cs
- DataControlFieldCell.cs
- NegatedConstant.cs
- PrintDocument.cs
- ValueChangedEventManager.cs
- AsymmetricKeyExchangeFormatter.cs
- RegexFCD.cs
- ConfigurationValue.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- EntityClassGenerator.cs
- ConfigurationPermission.cs
- ConstructorBuilder.cs
- ConsoleTraceListener.cs
- ErrorBehavior.cs
- ContainerControl.cs
- X509IssuerSerialKeyIdentifierClause.cs
- Exceptions.cs
- SkinBuilder.cs
- ManifestBasedResourceGroveler.cs
- Propagator.ExtentPlaceholderCreator.cs
- EntryWrittenEventArgs.cs
- LicenseManager.cs
- TypeHelper.cs
- SystemIcmpV6Statistics.cs
- GridItem.cs
- ObjectHelper.cs
- FormsIdentity.cs
- CacheEntry.cs
- DesignerForm.cs
- CodeNamespaceImport.cs
- CollectionChangeEventArgs.cs
- MethodResolver.cs
- ToolStripScrollButton.cs
- EmbeddedObject.cs
- NativeMethods.cs
- Matrix.cs
- Visual3DCollection.cs
- BrowserCapabilitiesCodeGenerator.cs
- ImageCodecInfo.cs
- MSG.cs
- VirtualizingPanel.cs
- ObjectSet.cs
- DocumentViewerAutomationPeer.cs
- MemberCollection.cs
- PageAsyncTaskManager.cs
- TypeDescriptor.cs
- ConfigXmlCDataSection.cs
- ClipboardData.cs
- MouseButton.cs
- Visual.cs
- LoginUtil.cs
- ExpressionBuilder.cs
- Switch.cs
- FixedPageAutomationPeer.cs
- ObjectQueryState.cs
- X509Certificate2Collection.cs
- DataTableNameHandler.cs
- WindowsListBox.cs
- FixedTextView.cs
- CharStorage.cs
- PropertyItemInternal.cs
- TimeSpan.cs
- FormatterConverter.cs
- EntitySqlQueryCacheEntry.cs
- _CommandStream.cs
- PersistChildrenAttribute.cs
- GridViewPageEventArgs.cs
- ListViewDataItem.cs
- SHA1CryptoServiceProvider.cs
- SystemBrushes.cs
- CloudCollection.cs
- RepeatInfo.cs
- EmptyCollection.cs
- ContextInformation.cs
- TimestampInformation.cs
- FillErrorEventArgs.cs
- RowBinding.cs
- RSAOAEPKeyExchangeFormatter.cs
- HuffModule.cs
- SwitchLevelAttribute.cs
- ToolStripItemDataObject.cs
- BoundField.cs
- KeyboardNavigation.cs
- XmlCodeExporter.cs
- dataobject.cs
- IsolationInterop.cs
- IntegerValidator.cs
- CompressedStack.cs
- sqlmetadatafactory.cs
- StrokeDescriptor.cs
- BrowserDefinitionCollection.cs
- TextBoxAutoCompleteSourceConverter.cs
- SymmetricAlgorithm.cs
- Viewport3DVisual.cs
- TypeResolvingOptionsAttribute.cs