Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- VolatileResourceManager.cs
- PersistenceTypeAttribute.cs
- VerificationAttribute.cs
- SqlEnums.cs
- HitTestWithGeometryDrawingContextWalker.cs
- basenumberconverter.cs
- InternalConfigConfigurationFactory.cs
- Select.cs
- Transform.cs
- WebServiceErrorEvent.cs
- GridItemCollection.cs
- SynchronizedDispatch.cs
- ThreadAttributes.cs
- ComponentRenameEvent.cs
- BookmarkUndoUnit.cs
- ChannelBinding.cs
- ScrollPattern.cs
- ZoomingMessageFilter.cs
- FixedSchema.cs
- ZeroOpNode.cs
- AppModelKnownContentFactory.cs
- SafeSecurityHelper.cs
- IndentedWriter.cs
- ModelFactory.cs
- MetaModel.cs
- XmlSignatureManifest.cs
- SymbolTable.cs
- ParameterCollection.cs
- IntSecurity.cs
- TextDecoration.cs
- NativeActivityTransactionContext.cs
- Camera.cs
- SwitchLevelAttribute.cs
- LinqDataSourceValidationException.cs
- KeysConverter.cs
- EmptyCollection.cs
- ObjectStateFormatter.cs
- ConstNode.cs
- EventLogger.cs
- FilterEventArgs.cs
- ClrPerspective.cs
- BoolExpression.cs
- InsufficientMemoryException.cs
- RectAnimationBase.cs
- SchemaAttDef.cs
- TypeDescriptionProviderAttribute.cs
- InternalConfigHost.cs
- SymbolType.cs
- SafeViewOfFileHandle.cs
- ServicesUtilities.cs
- MaskedTextBoxDesignerActionList.cs
- SqlDataSourceCache.cs
- BorderGapMaskConverter.cs
- AuthenticationModeHelper.cs
- BrushValueSerializer.cs
- CompilerScopeManager.cs
- ThemeDirectoryCompiler.cs
- GorillaCodec.cs
- IndexedWhereQueryOperator.cs
- FixedTextView.cs
- ToolStripGrip.cs
- SqlNode.cs
- WindowsStatusBar.cs
- DataRelationPropertyDescriptor.cs
- ToolStripPanelRow.cs
- UnknownWrapper.cs
- MobileCategoryAttribute.cs
- NativeActivity.cs
- KnownAssembliesSet.cs
- NeedSkipTokenVisitor.cs
- Evaluator.cs
- CultureInfo.cs
- TextContainer.cs
- StickyNoteAnnotations.cs
- DataKey.cs
- AuthStoreRoleProvider.cs
- TypeBuilder.cs
- RootCodeDomSerializer.cs
- SQLCharsStorage.cs
- CompilerGeneratedAttribute.cs
- NotImplementedException.cs
- ThreadAttributes.cs
- LinkArea.cs
- FreezableOperations.cs
- WebResourceAttribute.cs
- ClosableStream.cs
- InputElement.cs
- Double.cs
- DesignerDeviceConfig.cs
- EncoderParameter.cs
- NamespaceMapping.cs
- ContentElementCollection.cs
- SamlSerializer.cs
- AssemblyNameProxy.cs
- KeyValuePairs.cs
- GlyphingCache.cs
- ViewCellRelation.cs
- MsmqHostedTransportManager.cs
- SurrogateDataContract.cs
- DecimalConverter.cs