Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OdbcConnectionPoolProviderInfo.cs
- ControlIdConverter.cs
- NullableLongAverageAggregationOperator.cs
- SmiEventStream.cs
- Page.cs
- XamlClipboardData.cs
- OrderedDictionaryStateHelper.cs
- HotCommands.cs
- WsatConfiguration.cs
- IntPtr.cs
- InternalPolicyElement.cs
- FileIOPermission.cs
- DataServiceQueryProvider.cs
- MdImport.cs
- DoubleAnimationClockResource.cs
- SqlException.cs
- RuntimeWrappedException.cs
- PriorityItem.cs
- HttpHandlerAction.cs
- DecoderFallbackWithFailureFlag.cs
- Form.cs
- MessageAction.cs
- DefaultBindingPropertyAttribute.cs
- ModifierKeysValueSerializer.cs
- CopyCodeAction.cs
- SerializationSectionGroup.cs
- ObjRef.cs
- ColorBlend.cs
- ComboBoxItem.cs
- CurrencyWrapper.cs
- EntitySqlQueryCacheEntry.cs
- UserNameSecurityTokenProvider.cs
- BitmapCache.cs
- ConfigXmlCDataSection.cs
- OutputCacheProfile.cs
- UserPreferenceChangingEventArgs.cs
- TableCellCollection.cs
- TranslateTransform3D.cs
- AuthenticationException.cs
- MailAddressCollection.cs
- SettingsProperty.cs
- Triplet.cs
- StylusCaptureWithinProperty.cs
- Roles.cs
- XmlSchemaSimpleTypeRestriction.cs
- Menu.cs
- SourceLocation.cs
- SessionPageStateSection.cs
- HtmlFormWrapper.cs
- FileUtil.cs
- CanonicalizationDriver.cs
- DataControlPagerLinkButton.cs
- PasswordTextNavigator.cs
- SqlResolver.cs
- XmlSchemaGroupRef.cs
- StrokeNode.cs
- ProtocolViolationException.cs
- DataGridViewCheckBoxCell.cs
- OdbcInfoMessageEvent.cs
- QuaternionRotation3D.cs
- SerializationObjectManager.cs
- RegistrySecurity.cs
- SystemGatewayIPAddressInformation.cs
- StorageMappingFragment.cs
- RemoteWebConfigurationHostStream.cs
- InstanceLockQueryResult.cs
- RoleGroupCollection.cs
- HebrewNumber.cs
- TextServicesProperty.cs
- XmlFormatReaderGenerator.cs
- EncryptedXml.cs
- ListViewEditEventArgs.cs
- AutomationEvent.cs
- CustomErrorCollection.cs
- Stack.cs
- StrokeCollection.cs
- ToolboxBitmapAttribute.cs
- WebPartMenu.cs
- BooleanFunctions.cs
- KeyPressEvent.cs
- SystemResources.cs
- NameValueSectionHandler.cs
- TemplateBindingExtension.cs
- SpnEndpointIdentity.cs
- _SafeNetHandles.cs
- SafeViewOfFileHandle.cs
- WebDescriptionAttribute.cs
- WebRequestModuleElement.cs
- NativeMethods.cs
- ProviderIncompatibleException.cs
- DataControlFieldCollection.cs
- KerberosSecurityTokenAuthenticator.cs
- EntityContainer.cs
- SystemIPInterfaceProperties.cs
- BezierSegment.cs
- FixedPageProcessor.cs
- TargetConverter.cs
- WebConfigurationFileMap.cs
- CompressionTracing.cs
- UniqueIdentifierService.cs