Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / Xslt / QilStrConcatenator.cs / 1305376 / QilStrConcatenator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; using System.Xml; using System.Text; 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 StringBuilder builder; private QilList concat; private bool inUse = false; public QilStrConcatenator(XPathQilFactory f) { this.f = f; builder = new StringBuilder(); } public void Reset() { Debug.Assert(! inUse); inUse = true; builder.Length = 0; 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.Text; 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 StringBuilder builder; private QilList concat; private bool inUse = false; public QilStrConcatenator(XPathQilFactory f) { this.f = f; builder = new StringBuilder(); } public void Reset() { Debug.Assert(! inUse); inUse = true; builder.Length = 0; 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
- XmlResolver.cs
- AutoResizedEvent.cs
- Geometry3D.cs
- ExtendedTransformFactory.cs
- CustomAttribute.cs
- InstanceKey.cs
- IisNotInstalledException.cs
- WebBrowserEvent.cs
- PolicyUtility.cs
- EdmEntityTypeAttribute.cs
- DataGridCheckBoxColumn.cs
- X509CertificateCollection.cs
- HMACSHA384.cs
- UnsafeNativeMethods.cs
- Hash.cs
- SafeEventLogWriteHandle.cs
- RoutedEventHandlerInfo.cs
- AttributeQuery.cs
- SingleObjectCollection.cs
- GridViewEditEventArgs.cs
- MouseWheelEventArgs.cs
- CodeAssignStatement.cs
- MenuItem.cs
- DbDeleteCommandTree.cs
- TransformationRules.cs
- WebFormDesignerActionService.cs
- BaseParser.cs
- InputLanguageCollection.cs
- graph.cs
- SelectionUIService.cs
- DataGridItemEventArgs.cs
- BuilderPropertyEntry.cs
- StateMachineTimers.cs
- Lasso.cs
- RecognizeCompletedEventArgs.cs
- SecureEnvironment.cs
- ContentAlignmentEditor.cs
- GridViewSelectEventArgs.cs
- Color.cs
- TextBox.cs
- DataBoundLiteralControl.cs
- WSSecurityPolicy12.cs
- XmlJsonReader.cs
- FileVersionInfo.cs
- VideoDrawing.cs
- NotifyIcon.cs
- ChannelManager.cs
- TypeConstant.cs
- UnsafeNativeMethods.cs
- InvalidCastException.cs
- IResourceProvider.cs
- ImageIndexConverter.cs
- BitmapSource.cs
- TransactionFlowBindingElementImporter.cs
- BitmapMetadataBlob.cs
- PrintDialog.cs
- StopStoryboard.cs
- Clause.cs
- UIPermission.cs
- ErrorRuntimeConfig.cs
- InteropBitmapSource.cs
- SplitContainer.cs
- XmlTextReader.cs
- SqlCharStream.cs
- CompositionTarget.cs
- DropShadowEffect.cs
- TypeBuilder.cs
- mediaeventargs.cs
- PackWebResponse.cs
- MouseActionConverter.cs
- DataControlImageButton.cs
- AsyncPostBackErrorEventArgs.cs
- Rotation3D.cs
- LockingPersistenceProvider.cs
- Binding.cs
- dataSvcMapFileLoader.cs
- SafeEventHandle.cs
- updateconfighost.cs
- TextSimpleMarkerProperties.cs
- messageonlyhwndwrapper.cs
- Utils.cs
- DefaultBinder.cs
- PointAnimationUsingKeyFrames.cs
- ListSourceHelper.cs
- ContainerAction.cs
- IndexedEnumerable.cs
- CubicEase.cs
- MessageSecurityOverHttpElement.cs
- HtmlInputCheckBox.cs
- ExecutionProperties.cs
- SafeLibraryHandle.cs
- ItemCollection.cs
- TypeTypeConverter.cs
- DataGridViewTopLeftHeaderCell.cs
- CodeTypeDelegate.cs
- SByte.cs
- ConfigurationSettings.cs
- GlobalDataBindingHandler.cs
- ViewManager.cs
- SystemResourceHost.cs