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
- ProfileEventArgs.cs
- ListViewItemSelectionChangedEvent.cs
- BrowserCapabilitiesCodeGenerator.cs
- ParserStreamGeometryContext.cs
- ShimAsPublicXamlType.cs
- RelatedCurrencyManager.cs
- TextSelection.cs
- InfoCardCryptoHelper.cs
- HandlerWithFactory.cs
- ConfigurationElementCollection.cs
- SerializationHelper.cs
- IisTraceListener.cs
- WorkItem.cs
- AssemblyCollection.cs
- UseLicense.cs
- DispatchWrapper.cs
- ZoomPercentageConverter.cs
- DynamicFilterExpression.cs
- Manipulation.cs
- RepeatBehavior.cs
- DesignerSerializationManager.cs
- XhtmlBasicValidatorAdapter.cs
- ByteAnimation.cs
- CryptoHandle.cs
- ConnectionInterfaceCollection.cs
- AnnotationService.cs
- XmlSiteMapProvider.cs
- ProtocolsConfigurationEntry.cs
- UnicodeEncoding.cs
- DetailsViewInsertedEventArgs.cs
- ApplicationServiceManager.cs
- WorkflowDesigner.cs
- Thread.cs
- XsltArgumentList.cs
- RefreshEventArgs.cs
- ClickablePoint.cs
- AlphabeticalEnumConverter.cs
- ConfigurationValidatorBase.cs
- BitmapCache.cs
- Unit.cs
- TextTreeText.cs
- TextServicesContext.cs
- ComPersistableTypeElementCollection.cs
- InteropExecutor.cs
- TypeRefElement.cs
- SystemIPv4InterfaceProperties.cs
- TCPClient.cs
- ConditionCollection.cs
- UnsafeNativeMethods.cs
- AtomPub10CategoriesDocumentFormatter.cs
- BufferedOutputAsyncStream.cs
- MsmqChannelListenerBase.cs
- SelectionManager.cs
- TextContainerChangedEventArgs.cs
- BitmapDownload.cs
- StructuralObject.cs
- UTF7Encoding.cs
- FrameSecurityDescriptor.cs
- CmsUtils.cs
- Semaphore.cs
- Themes.cs
- OptimisticConcurrencyException.cs
- WebCategoryAttribute.cs
- PageHandlerFactory.cs
- BinaryParser.cs
- BinaryFormatterSinks.cs
- ComplusEndpointConfigContainer.cs
- ToolStripOverflow.cs
- CatalogPartCollection.cs
- QueryExpr.cs
- AttachedPropertyBrowsableAttribute.cs
- DesignBindingPicker.cs
- InternalBufferOverflowException.cs
- TreeView.cs
- XmlUtil.cs
- BoolExpressionVisitors.cs
- ExpressionDumper.cs
- ApplicationSettingsBase.cs
- SqlUtils.cs
- RenderData.cs
- Condition.cs
- And.cs
- FileDialogCustomPlace.cs
- PublisherMembershipCondition.cs
- XmlQuerySequence.cs
- EntityConnection.cs
- DrawListViewSubItemEventArgs.cs
- ServiceOperationListItemList.cs
- NotifyCollectionChangedEventArgs.cs
- XmlIlGenerator.cs
- XmlTextReader.cs
- GeneralTransformGroup.cs
- RuleInfoComparer.cs
- AppDomain.cs
- UITypeEditor.cs
- SessionStateSection.cs
- HttpModulesSection.cs
- TextElement.cs
- HtmlTextArea.cs
- TaiwanLunisolarCalendar.cs