[Top][All Lists]

[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 13:59:16 -0600

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>
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).


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?


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}


reply via email to

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