Hi All,

I needed a suggestion on an API I'm adding to QNetworkAccessManager and co.

I'm adding a HTTP redirect feature to QNAM. It can be enabled at a global
(QNAM) level, or can be enabled/disabled on a per request (QNetworkRequest)
basis. The per-request setting, if set, overrides the global one otherwise
uses whatever is set in the global setting.

The default value of the global setting is false, i.e don't follow
redirects.

The QNAM setting can be a simple bool which defaults to 'false' if not
explicitly set by the user. However, the request level setting needs 3
states - true (follow redirects), false (don't follow) and unset (use
global setting).

I was thinking I can have the request level setting as a 'pointer to a
bool' which is uninitialized (NULL) if a user does NOT explicitly set the
behaviour for the request or is initialized to whatever value is passed
(true/false). But this would mean allocating space for a pointer etc,
though I can manage it with a scoped pointer.

Or else I could have an enum in the request class identifying these 3
states (I don't want to add an enum for such a simple thing).

Any other suggestions on how this could be handled?

Thanks,
-mandeep
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to