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
- SiteMapDataSourceView.cs
- NestPullup.cs
- AttributeEmitter.cs
- NominalTypeEliminator.cs
- PenLineCapValidation.cs
- SerialReceived.cs
- WindowsRegion.cs
- CollectionViewGroupRoot.cs
- XmlRootAttribute.cs
- ViewSimplifier.cs
- UnsafeNativeMethodsCLR.cs
- TriggerAction.cs
- Command.cs
- OracleParameter.cs
- Application.cs
- CodeTypeDeclarationCollection.cs
- SchemaUtility.cs
- RouteTable.cs
- ScrollBarAutomationPeer.cs
- ObjectListTitleAttribute.cs
- Group.cs
- MediaElement.cs
- PrivilegeNotHeldException.cs
- XmlResolver.cs
- PropertyEmitterBase.cs
- SafeArrayRankMismatchException.cs
- HttpStaticObjectsCollectionWrapper.cs
- TextWriter.cs
- safelink.cs
- EntityContainer.cs
- OpenTypeLayout.cs
- IndexingContentUnit.cs
- PatternMatcher.cs
- TableColumn.cs
- RequestCacheValidator.cs
- WebPartTransformer.cs
- HttpConfigurationContext.cs
- GeometryCombineModeValidation.cs
- UndoEngine.cs
- SHA1Managed.cs
- ButtonRenderer.cs
- X509DefaultServiceCertificateElement.cs
- FontClient.cs
- SystemFonts.cs
- SocketElement.cs
- StateItem.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- TableLayoutStyle.cs
- GraphicsContainer.cs
- XmlSchemaAnyAttribute.cs
- HtmlGenericControl.cs
- MimeTypePropertyAttribute.cs
- PrePrepareMethodAttribute.cs
- ScriptMethodAttribute.cs
- ByteAnimation.cs
- Rule.cs
- dataSvcMapFileLoader.cs
- UInt32Converter.cs
- WebPartTransformerCollection.cs
- TimeSpanParse.cs
- ConnectionProviderAttribute.cs
- InkCanvasSelection.cs
- ThemeableAttribute.cs
- TaskFileService.cs
- UIInitializationException.cs
- LinearKeyFrames.cs
- EnumConverter.cs
- RequestQueue.cs
- AspCompat.cs
- PrintPreviewControl.cs
- parserscommon.cs
- IndexedString.cs
- SplayTreeNode.cs
- EdmError.cs
- XmlNodeReader.cs
- XmlDataDocument.cs
- PointAnimationUsingKeyFrames.cs
- ProfileModule.cs
- NativeMethods.cs
- ColumnWidthChangedEvent.cs
- ListViewContainer.cs
- Mouse.cs
- ISAPIApplicationHost.cs
- MethodSignatureGenerator.cs
- ObjectManager.cs
- GridSplitter.cs
- EntityDataSourceWrapper.cs
- StringAnimationUsingKeyFrames.cs
- CredentialCache.cs
- SerializationUtility.cs
- DataPagerField.cs
- DesignObjectWrapper.cs
- CellTreeNode.cs
- EmbeddedObject.cs
- EncryptedData.cs
- SettingsBase.cs
- WindowsFormsLinkLabel.cs
- OletxVolatileEnlistment.cs
- FileDialogCustomPlacesCollection.cs
- AssemblyBuilderData.cs