Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / UriTemplatePathSegment.cs / 2 / UriTemplatePathSegment.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System { using System.Collections.Specialized; using System.Diagnostics; using System.ServiceModel.Web; using System.Text; // This represents a Path segment, which can either be a Literal, a Variable or a Compound [DebuggerDisplay("Segment={originalSegment} Nature={nature}")] abstract class UriTemplatePathSegment { readonly bool endsWithSlash; readonly UriTemplatePartType nature; readonly string originalSegment; protected UriTemplatePathSegment(string originalSegment, UriTemplatePartType nature, bool endsWithSlash) { this.originalSegment = originalSegment; this.nature = nature; this.endsWithSlash = endsWithSlash; } public bool EndsWithSlash { get { return this.endsWithSlash; } } public UriTemplatePartType Nature { get { return this.nature; } } public string OriginalSegment { get { return this.originalSegment; } } public static UriTemplatePathSegment CreateFromUriTemplate(string segment, UriTemplate template) { // Identifying the type of segment - Literal|Compound|Variable switch (UriTemplateHelpers.IdentifyPartType(segment)) { case UriTemplatePartType.Literal: return UriTemplateLiteralPathSegment.CreateFromUriTemplate(segment, template); case UriTemplatePartType.Compound: return UriTemplateCompoundPathSegment.CreateFromUriTemplate(segment, template); case UriTemplatePartType.Variable: if (segment.EndsWith("/", StringComparison.Ordinal)) { string varName = template.AddPathVariable(UriTemplatePartType.Variable, segment.Substring(1, segment.Length - 3)); return new UriTemplateVariablePathSegment(segment, true, varName); } else { string varName = template.AddPathVariable(UriTemplatePartType.Variable, segment.Substring(1, segment.Length - 2)); return new UriTemplateVariablePathSegment(segment, false, varName); } default: Fx.Assert("Invalid value from IdentifyStringNature"); return null; } } public abstract void Bind(string[] values, ref int valueIndex, StringBuilder path); public abstract bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash); public bool IsMatch(UriTemplateLiteralPathSegment segment) { return IsMatch(segment, false); } public abstract bool IsMatch(UriTemplateLiteralPathSegment segment, bool ignoreTrailingSlash); public abstract void Lookup(string segment, NameValueCollection boundParameters); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CustomError.cs
- ProxyElement.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- SqlInternalConnectionSmi.cs
- LongTypeConverter.cs
- NegotiateStream.cs
- Double.cs
- CompiledIdentityConstraint.cs
- XmlSchemaSimpleContentRestriction.cs
- TextElementAutomationPeer.cs
- TableRowCollection.cs
- ImageAttributes.cs
- ListMarkerLine.cs
- InvalidFilterCriteriaException.cs
- DataServiceException.cs
- AsyncStreamReader.cs
- ConfigPathUtility.cs
- MetadataAssemblyHelper.cs
- CultureMapper.cs
- Timer.cs
- RichTextBoxConstants.cs
- SafeNativeMethods.cs
- AvTraceDetails.cs
- AdornerLayer.cs
- Source.cs
- ListItemsCollectionEditor.cs
- Hex.cs
- DataGridItemCollection.cs
- ProfileSection.cs
- StylusTip.cs
- _AutoWebProxyScriptHelper.cs
- QuotedPairReader.cs
- TextElementEditingBehaviorAttribute.cs
- QueryableFilterUserControl.cs
- FacetEnabledSchemaElement.cs
- ForwardPositionQuery.cs
- LoaderAllocator.cs
- FieldToken.cs
- LongValidator.cs
- ZoneMembershipCondition.cs
- CreateUserWizardStep.cs
- Matrix3DStack.cs
- InputBuffer.cs
- AppliedDeviceFiltersDialog.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- TypeDescriptor.cs
- LassoHelper.cs
- DbConnectionInternal.cs
- _UriSyntax.cs
- AdapterUtil.cs
- VirtualDirectoryMapping.cs
- EnvelopedPkcs7.cs
- TextMarkerSource.cs
- WeakReferenceKey.cs
- EndpointDiscoveryMetadataCD1.cs
- LassoSelectionBehavior.cs
- IisTraceWebEventProvider.cs
- EtwTrace.cs
- SeparatorAutomationPeer.cs
- HierarchicalDataBoundControl.cs
- XmlTextEncoder.cs
- XmlSchemaSimpleContent.cs
- SizeConverter.cs
- MemberBinding.cs
- DbDataAdapter.cs
- SpoolingTask.cs
- Brush.cs
- Vector.cs
- RemotingConfigParser.cs
- Highlights.cs
- MatrixIndependentAnimationStorage.cs
- HostExecutionContextManager.cs
- SqlMultiplexer.cs
- UrlAuthorizationModule.cs
- NativeMethods.cs
- RedistVersionInfo.cs
- WebPartMovingEventArgs.cs
- LinearKeyFrames.cs
- OracleConnection.cs
- WizardStepBase.cs
- ApplicationActivator.cs
- PointLight.cs
- ListViewItemEventArgs.cs
- DataReceivedEventArgs.cs
- TextBox.cs
- SystemIPv6InterfaceProperties.cs
- HostProtectionPermission.cs
- FileSystemInfo.cs
- BamlLocalizabilityResolver.cs
- BinaryUtilClasses.cs
- StylusPlugin.cs
- _BufferOffsetSize.cs
- ExtensionElement.cs
- DbConnectionClosed.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ExtractorMetadata.cs
- SmtpException.cs
- AppendHelper.cs
- CodeArgumentReferenceExpression.cs
- EntitySet.cs