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
- ContextToken.cs
- StrokeCollection.cs
- WebPartHeaderCloseVerb.cs
- CommentAction.cs
- DrawingVisualDrawingContext.cs
- SqlDataSourceCache.cs
- XmlSchemaException.cs
- RegistryPermission.cs
- ColumnResizeAdorner.cs
- AddInAttribute.cs
- DocumentNUp.cs
- LogSwitch.cs
- SqlEnums.cs
- BuildTopDownAttribute.cs
- PerformanceCounter.cs
- DuplicateMessageDetector.cs
- ThreadStartException.cs
- COM2EnumConverter.cs
- SqlSelectClauseBuilder.cs
- CqlErrorHelper.cs
- TabItemWrapperAutomationPeer.cs
- hebrewshape.cs
- BaseResourcesBuildProvider.cs
- PopOutPanel.cs
- Pair.cs
- TextElement.cs
- WaitingCursor.cs
- DataTransferEventArgs.cs
- MenuAdapter.cs
- OracleTimeSpan.cs
- MessageProtectionOrder.cs
- XmlJsonWriter.cs
- Function.cs
- TextDecorationCollection.cs
- CqlGenerator.cs
- WebPartEventArgs.cs
- DataServiceRequestException.cs
- AffineTransform3D.cs
- HelpEvent.cs
- PresentationAppDomainManager.cs
- ChtmlFormAdapter.cs
- SqlBuilder.cs
- TableLayoutColumnStyleCollection.cs
- ResourceDictionary.cs
- ListSourceHelper.cs
- _LocalDataStoreMgr.cs
- WorkflowRuntimeServiceElementCollection.cs
- WebHttpBindingCollectionElement.cs
- ReflectTypeDescriptionProvider.cs
- LOSFormatter.cs
- EdmError.cs
- AuthenticationException.cs
- _DynamicWinsockMethods.cs
- milexports.cs
- Line.cs
- KnownTypesHelper.cs
- Tuple.cs
- CounterSample.cs
- RadioButton.cs
- FontTypeConverter.cs
- CheckBoxRenderer.cs
- OutOfProcStateClientManager.cs
- ColorComboBox.cs
- WebFormDesignerActionService.cs
- SamlAudienceRestrictionCondition.cs
- PrimitiveList.cs
- XmlWriterTraceListener.cs
- WindowsToolbar.cs
- ComAwareEventInfo.cs
- Int32Storage.cs
- CodeAttributeDeclaration.cs
- SchemaSetCompiler.cs
- PointF.cs
- ProtocolsSection.cs
- RootAction.cs
- RichTextBoxAutomationPeer.cs
- AmbientEnvironment.cs
- HexParser.cs
- DataListItemEventArgs.cs
- CollectionEditor.cs
- DateTimeUtil.cs
- ValidationErrorInfo.cs
- ControlDesigner.cs
- SqlFunctionAttribute.cs
- NameValueConfigurationCollection.cs
- UpDownBase.cs
- MappedMetaModel.cs
- EventRouteFactory.cs
- DocumentPage.cs
- BitHelper.cs
- Reference.cs
- IfElseDesigner.xaml.cs
- DefaultPrintController.cs
- ComplusTypeValidator.cs
- FormViewDeleteEventArgs.cs
- DataTrigger.cs
- QfeChecker.cs
- HostingEnvironment.cs
- IndentedTextWriter.cs
- BindingMemberInfo.cs