fastcgipp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fastcgipp-users] check if variable has been posted


From: Axel von Bertoldi
Subject: Re: [Fastcgipp-users] check if variable has been posted
Date: Thu, 14 May 2009 14:01:55 -0600

Double actually, it would be nice to have this for get data as well. And, since get data is formatted the same way application/x-www-form-urlencoded data is, one could conceivably reuse some of that code to parse the get data.

a.

On Thu, May 14, 2009 at 1:59 PM, Axel von Bertoldi <address@hidden> wrote:


On Thu, May 14, 2009 at 1:47 PM, Axel von Bertoldi <address@hidden> wrote:
Actually Eddie, in my app I have a few methods to a) query for a post key/variable and b) retrieve the variable associated with a key and cast it (via boost::lexical_cast) to the desired type.

it looks something like:

template <class T>
bool
getValue (std::string key, T &val) const {
    StrMapConstIter it;

    if ((it = this->find(key)) == this->end()) {
        return false;
    }
    else {
        try {
            T tmp = boost::lexical_cast<T>(it->second);
            val = tmp;
            return true;
        }
        catch(boost::bad_lexical_cast &) {
            return false;
        }
    }
}

with a specialization for bool so you can specify the value as "false/true" or 0/1

Any interest in having something like this? I can implement it (once I finish the other patch).

a.


On Wed, May 13, 2009 at 8:12 AM, Axel von Bertoldi <address@hidden> wrote:
Can you not just check Http::Environment::posts? Iterate of over the key looking for your variable name?

a.


On Wed, May 13, 2009 at 7:37 AM, Goran <address@hidden> wrote:
Hi all, hi Eddie,

is there a way to check if a variable has been posted or not?

For this check the value of the variable is regardless.

I would need something like:

if("MyVar" has not been posted by the client) {do something}


Goran








reply via email to

[Prev in Thread] Current Thread [Next in Thread]