[ROOT] [Carrot] Using TMap for GET / POST / COOKIE vars

From: Ashley Cambrell (ash@freaky-namuh.com)
Date: Thu Apr 25 2002 - 18:16:33 MEST


Hi Carroters,

Would there be any objects if I converted the TList's for environment,
get, post, cookie, file (and session) to TMap's?  It seems to make more
sense as you don't have to interate through to get the value.

TMap *postData = ap.GetVars("POST");

cout << "Hello " << ((TObjStirng
*)postData->GetValue("username"))->String() << endl;

Or better yet

class THTTPData : public TMap
{
    TString operator[](const char* key);
}

THTTPData *postData = ap.GetVars("POST");
cout << "Hello " << postData["username"] << endl;

As all GET, POST, COOKIE data are strings, this would work.  For FILES
and SESSION it wouldn't as you'd want to be able to store any TObject in
a session (and files already have there own data-type).

Objections?

Ashley Cambrell

BTW, should there be a Carrot list? or is there so little Carrot traffic
it doesn't matter?



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET