~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-common/test/validator.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include "validator.h"
32
32
 
33
 
bool Validator::isNumber(std::string str) {
34
 
        unsigned int i = 0;
35
 
        if (!str.empty() && (str[i] == '-' || str[i] == '+'))
36
 
                i++;
37
 
        return string::npos == str.find_first_not_of(".eE0123456789", i);
38
 
}
39
 
 
40
 
bool Validator::isNotNull(std::string str) {
41
 
        if(!str.empty())
42
 
                return true;
43
 
        else
44
 
                return false;
45
 
}
46
 
 
47
 
bool Validator::isEqual(std::string str1, std::string str2) {
48
 
        return str1.compare(str2) == 0;
 
33
bool Validator::isNumber (std::string str)
 
34
{
 
35
    unsigned int i = 0;
 
36
 
 
37
    if (!str.empty() && (str[i] == '-' || str[i] == '+'))
 
38
        i++;
 
39
 
 
40
    return string::npos == str.find_first_not_of (".eE0123456789", i);
 
41
}
 
42
 
 
43
bool Validator::isNotNull (std::string str)
 
44
{
 
45
    if (!str.empty())
 
46
        return true;
 
47
    else
 
48
        return false;
 
49
}
 
50
 
 
51
bool Validator::isEqual (std::string str1, std::string str2)
 
52
{
 
53
    return str1.compare (str2) == 0;
49
54
}