PathToUrlMapper Class

Namespace
Kampute.DocToolkit.Routing
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides a mapping between file references and their corresponding URLs.
public class PathToUrlMapper : IUrlTransformer, IReadOnlyCollection<KeyValuePair<string, Uri>>
Inheritance
Implements

Remarks

The PathToUrlMapper class implements a dictionary-based solution for mapping between file paths and their target URLs in documentation systems. This mapping is essential when documentation references need to be maintained across different output formats or when URL structures change.

This implementation uses case-insensitive key matching and supports partial URL matching, allowing it to handle URLs with query parameters and fragments. The class can be used directly for managing URL mappings or as a component in a larger documentation generation pipeline.

Thread Safety

Public static members of the type are guaranteed to be thread-safe. However, public instance members are not thread-safe.

Constructors

PathToUrlMapper()Initializes a new instance of the PathToUrlMapper class.

Properties

CountGets the number of URL mappings.
MayTransformUrlsGets a value indicating whether the URL mapper has any mappings.

Methods

Add(string, Uri)Adds a URL mapping for the specified source path.
Clear()Clears all URL mappings.
Contains(string)Determines whether the specified path has a URL mapping.
GetEnumerator()Returns an enumerator that iterates through the collection of URL mappings.
Remove(string)Removes a URL mapping for the specified source path.
TryTransformUrl(string, out Uri)Attempts to transform a URL string to its corresponding replacement URL.

Explicit Interface Implementations

IEnumerable.GetEnumerator()Returns an enumerator that iterates through the collection.