2009/11/6 Glyn Matthews <[email protected]>
>
> 2009/11/6 Dean Michael Berris <[email protected]>
>
>>
>> I've made some changes to the urllib-dean branch and have changed the
>> parsers to better follow the RFCs -- although I've only parsed the
>> HTTP URIs.
>>
>> Please take a look and see if you find anything glaring that I should
>> address.
>>
>> I will take some time this weekend to take a look.
>
>
You've defined new tags and traits classes in boost/network/uri/tags.hpp and
boost/network/uri/traits/* Why is this? These are identical to those found
in boost/network/message/tags.hpp and boost/network/message/traits/*.
Surely they don't need to be repeated?
Having said that though, I think the traits systems need to be extended,
because your HTTP URI can't be specialized for std::wstring (or for any
string which doesn't have an 8 bit character length).
I would suggest something along the lines of:
namespace boost {
namespace network {
template <
class Tag
>
struct uri_traits {
typedef typename string<Tag>::type string_type;
typedef boost::uint32_t port_type;
static const string_type &colon() {
static const string_type colon = ":";
return colon;
}
static const string_type &qmark() {
static const string_type qmark = "?";
return qmark;
}
static const string_type £() {
static const string_type pound = "#";
return pound;
}
};
template <>
struct uri_traits<tags::wdefault> {
typedef string<tags::wdefault>::type string_type;
typedef boost::uint32_t port_type;
static const string_type &colon() {
static const string_type colon = L":";
return colon;
}
static const string_type &qmark() {
static const string_type qmark = L"?";
return qmark;
}
static const string_type £() {
static const string_type pound = L"#";
return pound;
}
};
} // namespace network
} // namespace boost
Do you agree with this? Unless I'm missing something, your spirit parser
only needs to know a small number of special delimiting characters and the
rest is generic because you then don't need to specify the string type
internally. I don't think this would easily extend to John's implementation
though, but his code suffers from the same problem (it uses std::string a
lot internally and isn't generic).
Consequently, I'd like to see all your unit tests repeated for
std::wstring. I think this is important to do because it will really
justify the approach we are taking.
Is there a reason why you're providing the HTTP URI under
boost/network/uri/http and not boost/network/protocols/http ?
Otherwise I like the progress you're making, it is taking good shape.
On another note, I'd like to get more involved with the development of the
URI but I'm finding it difficult to know exactly where to join, since there
are two completely different branches. For one, I'd like to add the wstring
unit tests I mentioned above (and actually some more for basic_message) but
I don't know in what branch I should because your's and John's have diverged
to a large extent. I could do this either in trunk, or in integration_0_4
but they might just end up being ignored. In fact, this is a more general
problem with the way we develop, I think, because it prevents other people
from contributing code or tests or docs. Any thoughts?
Glyn
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Cpp-netlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel