Subversion Repositories tpanel

Rev

Rev 222 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 222 Rev 233
Line 1010... Line 1010...
1010
    }
1010
    }
1011
 
1011
 
1012
    return cmd;
1012
    return cmd;
1013
}
1013
}
1014
 
1014
 
-
 
1015
bool isTrue(const std::string &value)
-
 
1016
{
-
 
1017
    std::string v = value;
-
 
1018
    std::string low = toLower(v);
-
 
1019
 
-
 
1020
    if (low.find("true") != std::string::npos ||
-
 
1021
        low.find("on") != std::string::npos ||
-
 
1022
        low.find("yes") != std::string::npos ||
-
 
1023
        low.find("1") != std::string::npos)
-
 
1024
        return true;
-
 
1025
 
-
 
1026
    return false;
-
 
1027
}
-
 
1028
 
-
 
1029
bool isFalse(const std::string &value)
-
 
1030
{
-
 
1031
    std::string v = value;
-
 
1032
    std::string low = toLower(v);
-
 
1033
 
-
 
1034
    if (low.find("false") != std::string::npos ||
-
 
1035
        low.find("off") != std::string::npos ||
-
 
1036
        low.find("no") != std::string::npos ||
-
 
1037
        low.find("0") != std::string::npos)
-
 
1038
        return true;
-
 
1039
 
-
 
1040
    return false;
-
 
1041
}
-
 
1042
 
-
 
1043
bool isNumeric(const std::string &str, bool blank)
-
 
1044
{
-
 
1045
    std::string::const_iterator iter;
-
 
1046
 
-
 
1047
    for (iter = str.begin(); iter != str.end(); ++iter)
-
 
1048
    {
-
 
1049
        if (*iter < '0' || *iter > '9')
-
 
1050
        {
-
 
1051
            if (blank && *iter == ' ')
-
 
1052
                continue;
-
 
1053
 
-
 
1054
            return false;
-
 
1055
        }
-
 
1056
    }
-
 
1057
 
-
 
1058
    return true;
-
 
1059
}