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
- _RequestLifetimeSetter.cs
- WorkflowDesigner.cs
- CompareValidator.cs
- ServicePoint.cs
- IOException.cs
- URLIdentityPermission.cs
- VisualBrush.cs
- StorageComplexPropertyMapping.cs
- FrameSecurityDescriptor.cs
- DateBoldEvent.cs
- Win32PrintDialog.cs
- IssuanceLicense.cs
- FontEditor.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- NamedServiceModelExtensionCollectionElement.cs
- MultiPropertyDescriptorGridEntry.cs
- UrlMapping.cs
- SqlWebEventProvider.cs
- TimeZone.cs
- EditingScopeUndoUnit.cs
- ProviderCommandInfoUtils.cs
- HttpResponseInternalBase.cs
- PageThemeCodeDomTreeGenerator.cs
- RightsManagementSuppressedStream.cs
- ExpressionBindingsDialog.cs
- _HelperAsyncResults.cs
- ErrorFormatter.cs
- CacheDependency.cs
- DockPatternIdentifiers.cs
- _RequestCacheProtocol.cs
- HttpClientCertificate.cs
- SamlSubjectStatement.cs
- DataKey.cs
- TemplateApplicationHelper.cs
- CssTextWriter.cs
- DynamicControlParameter.cs
- Merger.cs
- TextEditorSelection.cs
- SplitterPanel.cs
- GroupBoxRenderer.cs
- AmbientProperties.cs
- TransformGroup.cs
- CultureTable.cs
- JsonDataContract.cs
- UidManager.cs
- Misc.cs
- safelink.cs
- SliderAutomationPeer.cs
- ToolTip.cs
- ColorBlend.cs
- SequentialUshortCollection.cs
- HtmlSelect.cs
- TextCharacters.cs
- PrimaryKeyTypeConverter.cs
- DataControlCommands.cs
- ProgressBar.cs
- PixelFormats.cs
- HostSecurityManager.cs
- ResourceReferenceExpressionConverter.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- RawUIStateInputReport.cs
- HashMembershipCondition.cs
- BaseComponentEditor.cs
- PointAnimationClockResource.cs
- DecimalFormatter.cs
- SelectingProviderEventArgs.cs
- RegexGroupCollection.cs
- ListBoxItemAutomationPeer.cs
- BinaryObjectInfo.cs
- ImageAnimator.cs
- FileLogRecordStream.cs
- CodeIterationStatement.cs
- SqlBinder.cs
- PrefixQName.cs
- ContractBase.cs
- AstTree.cs
- MenuItemCollection.cs
- ObjectQueryProvider.cs
- CompilationPass2Task.cs
- UIElementIsland.cs
- Visual3D.cs
- WebBrowser.cs
- HScrollProperties.cs
- SourceFileInfo.cs
- FileDialogCustomPlace.cs
- PackageDigitalSignatureManager.cs
- TextEncodedRawTextWriter.cs
- RoleGroupCollection.cs
- validation.cs
- DPCustomTypeDescriptor.cs
- AuthenticationModulesSection.cs
- ErrorHandlingAcceptor.cs
- httpserverutility.cs
- DocumentSequenceHighlightLayer.cs
- SimpleType.cs
- TimersDescriptionAttribute.cs
- SqlReferenceCollection.cs
- InvokeMethodDesigner.xaml.cs
- SurrogateSelector.cs
- Pair.cs