On Friday, January 31, 2014, Mandeep Sandhu <[email protected]> wrote:
> 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 > > sounds to me like the most "Qt" way of handling it is the enum route. specifically qnam havin something like setHttpRedirectPolicy(policy) or the like. Matt
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
