[Mono-dev] Uri.cs and UriParser.cs - .NET 2.0 changes
Alan McGovern
alan.mcgovern at gmail.com
Fri Oct 31 14:05:34 EDT 2008
Hey,
In .NET 2.0, Uri parsing has been moved to designated classes all derived
from UriParser. This makes it possible to have custom parsers for new Uri
schemes. Currently mono doesn't support this properly.
What I think would be the best thing to do would be to change parsing under
all profiles to use this new API. In the .NET 1.1 profile, we'd just mark
these classes as internal, so this gives one codepath to maintain.
In .NET 1.1 Uri.Parse () would would be replaced by calls to the new parser
classes so that existing behaviour isn't changed. Under .NET 2.0, I believe
an approach similar to what I've prototyped in the attached patch should be
what is implemented. Basically each of the properties of Uri will call into
the parser to get the required component. The results of this call could be
cached locally for increased performance.
The other benefit is that it should also reduce the shotgun approach to
parsing, i.e. the special casing in the parse logic for different schemes.
This might make things more maintainable.
An example parser is also attached in Test.cs and is implemented as a
console app. If you apply the above patch to mono, you can parse the "pack"
schema. Note, the patch *will* break all other Uri parsing as i hardcoded a
"pack" parser.
Does anyone have any thoughts on this?
Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081031/6b5fcd38/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UriParserChanges.cs
Type: text/x-csharp
Size: 4237 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081031/6b5fcd38/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.cs
Type: text/x-csharp
Size: 3725 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081031/6b5fcd38/attachment-0001.bin
More information about the Mono-devel-list
mailing list