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
- ComboBoxRenderer.cs
- X509CertificateValidator.cs
- RawStylusInputCustomData.cs
- IPEndPointCollection.cs
- Transform3DGroup.cs
- CompilerGeneratedAttribute.cs
- TypedTableBaseExtensions.cs
- COM2Enum.cs
- TimeSpanSecondsConverter.cs
- ILGenerator.cs
- BreakSafeBase.cs
- SQLInt16Storage.cs
- DesignerLoader.cs
- HtmlInputReset.cs
- PreviewKeyDownEventArgs.cs
- XmlQueryStaticData.cs
- PrintController.cs
- ClientProxyGenerator.cs
- MeshGeometry3D.cs
- BinaryWriter.cs
- FontDriver.cs
- ObjectStateFormatter.cs
- QueuePathDialog.cs
- ProxySimple.cs
- RegistryPermission.cs
- _HeaderInfoTable.cs
- shaperfactory.cs
- RegexTypeEditor.cs
- HostExecutionContextManager.cs
- MachineKeyConverter.cs
- MemberNameValidator.cs
- UnaryQueryOperator.cs
- SecurityRuntime.cs
- TextSpanModifier.cs
- EditingCommands.cs
- DurableEnlistmentState.cs
- FormCollection.cs
- ConfigurationManagerHelper.cs
- __TransparentProxy.cs
- ValueQuery.cs
- BookmarkOptionsHelper.cs
- Animatable.cs
- ConnectionStringsExpressionBuilder.cs
- OpCellTreeNode.cs
- Repeater.cs
- HttpApplicationFactory.cs
- HttpListener.cs
- PageStatePersister.cs
- COM2TypeInfoProcessor.cs
- TextContainerChangeEventArgs.cs
- ConfigurationSettings.cs
- _CommandStream.cs
- WebPartCatalogAddVerb.cs
- CheckBoxRenderer.cs
- LabelAutomationPeer.cs
- RemotingAttributes.cs
- DynamicResourceExtensionConverter.cs
- COM2PictureConverter.cs
- MenuItemStyle.cs
- LinqDataSourceContextData.cs
- ZipFileInfoCollection.cs
- MappingMetadataHelper.cs
- MsmqIntegrationInputChannel.cs
- AssociativeAggregationOperator.cs
- Transactions.cs
- SelectedPathEditor.cs
- WebUtil.cs
- FirewallWrapper.cs
- ContextStaticAttribute.cs
- IxmlLineInfo.cs
- AuditLogLocation.cs
- StringKeyFrameCollection.cs
- MonthChangedEventArgs.cs
- HttpModule.cs
- TextViewBase.cs
- ObjRef.cs
- MethodRental.cs
- XmlQuerySequence.cs
- GridViewSelectEventArgs.cs
- SessionStateItemCollection.cs
- DocumentOrderQuery.cs
- TypeDelegator.cs
- TCPListener.cs
- BufferModeSettings.cs
- ClientBuildManager.cs
- TextBoxLine.cs
- DefaultMemberAttribute.cs
- DataList.cs
- ImageMetadata.cs
- XmlWrappingWriter.cs
- TreeBuilder.cs
- ArgIterator.cs
- KnownTypesProvider.cs
- ProfileParameter.cs
- UnsafeNetInfoNativeMethods.cs
- SocketElement.cs
- PrimitiveSchema.cs
- Predicate.cs
- WorkflowValidationFailedException.cs
- SpecularMaterial.cs