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
- PolyBezierSegmentFigureLogic.cs
- PeerToPeerException.cs
- ProcessThreadCollection.cs
- TextServicesLoader.cs
- HttpHandlersInstallComponent.cs
- WinInetCache.cs
- SignedPkcs7.cs
- PropertyEmitter.cs
- KoreanLunisolarCalendar.cs
- CodeAttributeArgumentCollection.cs
- InputScopeNameConverter.cs
- GuidTagList.cs
- WizardStepBase.cs
- WebPartMenu.cs
- ActivityExecutor.cs
- CqlGenerator.cs
- AdapterUtil.cs
- DataMemberFieldConverter.cs
- TypeConverterHelper.cs
- TextCharacters.cs
- FileCodeGroup.cs
- XPathNodeList.cs
- AxisAngleRotation3D.cs
- SrgsElement.cs
- ContentDisposition.cs
- RIPEMD160Managed.cs
- NoneExcludedImageIndexConverter.cs
- XmlSchemaRedefine.cs
- DesignConnection.cs
- VisemeEventArgs.cs
- PrintControllerWithStatusDialog.cs
- AddInAdapter.cs
- DataTableReaderListener.cs
- BitmapFrameEncode.cs
- ObjectAnimationBase.cs
- SchemaInfo.cs
- TrailingSpaceComparer.cs
- HandledEventArgs.cs
- DragSelectionMessageFilter.cs
- _DigestClient.cs
- AxisAngleRotation3D.cs
- BaseInfoTable.cs
- ResXResourceWriter.cs
- LinqDataSourceDeleteEventArgs.cs
- MenuRenderer.cs
- PerspectiveCamera.cs
- MaskedTextBoxDesigner.cs
- HttpInputStream.cs
- Logging.cs
- CheckBoxFlatAdapter.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- ManifestResourceInfo.cs
- HostedAspNetEnvironment.cs
- PixelFormats.cs
- PropertyDescriptorGridEntry.cs
- DictionaryCustomTypeDescriptor.cs
- SQLDateTime.cs
- WizardStepBase.cs
- GeometryGroup.cs
- WizardStepBase.cs
- FileSystemEventArgs.cs
- CurrentChangingEventArgs.cs
- BaseValidator.cs
- Command.cs
- EncryptedKeyIdentifierClause.cs
- EpmContentSerializer.cs
- ObjectViewQueryResultData.cs
- RightNameExpirationInfoPair.cs
- ModelItemCollection.cs
- CodeSnippetCompileUnit.cs
- TextEmbeddedObject.cs
- ETagAttribute.cs
- ResourceExpressionBuilder.cs
- DataGridViewCellCollection.cs
- DbConnectionFactory.cs
- AdornerDecorator.cs
- RegexCode.cs
- OraclePermission.cs
- MobileControlsSectionHelper.cs
- Aggregates.cs
- StructuredProperty.cs
- TemplateLookupAction.cs
- StreamUpgradeBindingElement.cs
- ADMembershipProvider.cs
- TagElement.cs
- PerformanceCounterPermissionEntry.cs
- FlowThrottle.cs
- Camera.cs
- BufferAllocator.cs
- DetailsViewCommandEventArgs.cs
- DecoderReplacementFallback.cs
- List.cs
- FormattedTextSymbols.cs
- SqlConnectionFactory.cs
- HitTestParameters.cs
- SiteMap.cs
- WriteTimeStream.cs
- ConnectionInterfaceCollection.cs
- MarkerProperties.cs
- KeyedCollection.cs