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
- BypassElementCollection.cs
- VBIdentifierNameEditor.cs
- TrackPoint.cs
- ContentIterators.cs
- TrackingProfileManager.cs
- RefreshEventArgs.cs
- MatrixTransform3D.cs
- ClientSideProviderDescription.cs
- AffineTransform3D.cs
- DodSequenceMerge.cs
- COM2PropertyBuilderUITypeEditor.cs
- ContentValidator.cs
- CollectionType.cs
- WindowsGraphicsCacheManager.cs
- BaseContextMenu.cs
- SessionPageStateSection.cs
- Encoding.cs
- Scanner.cs
- ApplicationFileCodeDomTreeGenerator.cs
- UInt16Converter.cs
- CommonObjectSecurity.cs
- PermissionToken.cs
- ExpressionBuilderCollection.cs
- ResolvedKeyFrameEntry.cs
- FunctionNode.cs
- StringKeyFrameCollection.cs
- ContentPropertyAttribute.cs
- WebBrowserSiteBase.cs
- RoleBoolean.cs
- WmpBitmapEncoder.cs
- ArrayElementGridEntry.cs
- MergePropertyDescriptor.cs
- TdsValueSetter.cs
- SpeechAudioFormatInfo.cs
- DrawingContext.cs
- StateBag.cs
- _SSPIWrapper.cs
- WebDisplayNameAttribute.cs
- CacheEntry.cs
- SimpleMailWebEventProvider.cs
- RichTextBoxAutomationPeer.cs
- SecureEnvironment.cs
- PrinterResolution.cs
- TokenFactoryFactory.cs
- DrawItemEvent.cs
- OperationAbortedException.cs
- Int64AnimationUsingKeyFrames.cs
- XmlReaderSettings.cs
- WebPartConnectionsCancelEventArgs.cs
- XpsSerializerFactory.cs
- DateTimeAutomationPeer.cs
- AssemblyBuilder.cs
- SerializerWriterEventHandlers.cs
- SharedDp.cs
- TemplateInstanceAttribute.cs
- SoapParser.cs
- ComponentConverter.cs
- RemotingConfiguration.cs
- NetNamedPipeBinding.cs
- MonthCalendar.cs
- TypeUsage.cs
- Stroke2.cs
- RecordManager.cs
- RetrieveVirtualItemEventArgs.cs
- TypeElement.cs
- SrgsToken.cs
- TextEndOfParagraph.cs
- CompatibleComparer.cs
- OutputCacheSettingsSection.cs
- ConfigurationSchemaErrors.cs
- HttpCookiesSection.cs
- TreeNodeCollectionEditor.cs
- Rotation3DKeyFrameCollection.cs
- AdapterDictionary.cs
- HandledEventArgs.cs
- JpegBitmapEncoder.cs
- ExtendedPropertiesHandler.cs
- NavigatorInput.cs
- TextFormatterImp.cs
- Filter.cs
- XmlTypeMapping.cs
- MimeWriter.cs
- LineInfo.cs
- OdbcStatementHandle.cs
- KeyGesture.cs
- CatalogPart.cs
- AssemblyNameUtility.cs
- DbProviderFactories.cs
- MetadataCacheItem.cs
- TextCompositionEventArgs.cs
- MutexSecurity.cs
- LinearGradientBrush.cs
- DataGridViewCheckBoxCell.cs
- DetailsViewDeleteEventArgs.cs
- RestHandler.cs
- DbQueryCommandTree.cs
- Dictionary.cs
- WindowsPrincipal.cs
- WebPartHeaderCloseVerb.cs
- TrustManagerPromptUI.cs