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
- ParsedAttributeCollection.cs
- AsmxEndpointPickerExtension.cs
- PropertyStore.cs
- ActivityExecutor.cs
- JoinGraph.cs
- SamlAuthorizationDecisionClaimResource.cs
- GC.cs
- MailWriter.cs
- OpCopier.cs
- Thread.cs
- SimpleNameService.cs
- FontResourceCache.cs
- NominalTypeEliminator.cs
- ParseNumbers.cs
- ToolStripDropTargetManager.cs
- PersonalizationState.cs
- CreateParams.cs
- ParallelQuery.cs
- ParameterElementCollection.cs
- Rotation3DKeyFrameCollection.cs
- PropertyDescriptor.cs
- SystemFonts.cs
- IListConverters.cs
- TableItemStyle.cs
- ScriptReferenceEventArgs.cs
- WebPartMinimizeVerb.cs
- BridgeDataReader.cs
- InstanceKeyCompleteException.cs
- EventLogInformation.cs
- OpCodes.cs
- MobileCategoryAttribute.cs
- TripleDES.cs
- Pens.cs
- DesignerActionPropertyItem.cs
- GeometryHitTestResult.cs
- documentation.cs
- IPAddressCollection.cs
- WebPartsPersonalization.cs
- TopClause.cs
- Debug.cs
- DefaultEventAttribute.cs
- CapabilitiesSection.cs
- BrowserDefinitionCollection.cs
- PassportAuthenticationModule.cs
- PrintPreviewDialog.cs
- RewritingSimplifier.cs
- CounterSampleCalculator.cs
- CodeEventReferenceExpression.cs
- OracleNumber.cs
- SecurityUtils.cs
- TextBlockAutomationPeer.cs
- MultilineStringConverter.cs
- SoapSchemaMember.cs
- XpsSerializationManager.cs
- AdornerHitTestResult.cs
- EventArgs.cs
- DataControlButton.cs
- SessionState.cs
- TextCharacters.cs
- SystemSounds.cs
- XmlDataSourceNodeDescriptor.cs
- XmlEventCache.cs
- Int32AnimationUsingKeyFrames.cs
- UserPreferenceChangingEventArgs.cs
- DbTransaction.cs
- MessageVersionConverter.cs
- TextContainerHelper.cs
- XmlElementAttributes.cs
- HttpMethodConstraint.cs
- AddInToken.cs
- DataServiceKeyAttribute.cs
- Thread.cs
- ResourceDictionary.cs
- IsolatedStorageSecurityState.cs
- EnterpriseServicesHelper.cs
- URI.cs
- NotifyParentPropertyAttribute.cs
- FormViewUpdatedEventArgs.cs
- RIPEMD160.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- JsonStringDataContract.cs
- _WebProxyDataBuilder.cs
- Expression.cs
- ProtectedConfigurationProviderCollection.cs
- TemplatePartAttribute.cs
- DebuggerService.cs
- TreeIterator.cs
- Helpers.cs
- IERequestCache.cs
- PropertyGridView.cs
- LambdaCompiler.Statements.cs
- PerformanceCountersElement.cs
- FullTextLine.cs
- SHA512Managed.cs
- storepermissionattribute.cs
- RegexCapture.cs
- ValidatedControlConverter.cs
- ReadOnlyDictionary.cs
- GridViewEditEventArgs.cs
- dbdatarecord.cs