示例#1
0
文件: string.cpp 项目: goofoo/Helium
bool endsWith(const LITESQL_String& what, const LITESQL_String& with) {
    if (what.size() < with.size())
        return false;
    if (what.substr(what.size()-with.size(), what.size()) == with)
        return true;
    return false;
}
示例#2
0
文件: string.cpp 项目: goofoo/Helium
bool startsWith(const LITESQL_String& what, const LITESQL_String& with) {
    if (what.size() < with.size())
        return false;
    if (what.substr(0, with.size()) == with)
        return true;
    return false;
}
示例#3
0
文件: string.cpp 项目: goofoo/Helium
LITESQL_String lstrip(const LITESQL_String& s) {
    unsigned int pos = 0;
    while (1) {
        if (isspace(s[pos]) && pos < s.size()-1)
            pos++;
        else
            break;
    }
    return s.substr(pos, s.size());
}
示例#4
0
文件: string.cpp 项目: goofoo/Helium
int hexToInt(const LITESQL_String& s) {
    int res = 0;
	
    for (size_t i = 0; i < s.size(); i++) {
        int multiplier = 1;
        int exp = (s.size() - 1 - i);
        while (exp-- > 0)
            multiplier *= 16;
        int ch = s[i];
        if (ch >= '0' && ch <= '9')
            res += multiplier * (ch - '0');
        else if (ch >= 'a' && ch <= 'z')
            res += multiplier * (ch - 'a');
        else if (ch >= 'A' && ch <= 'Z')
            res += multiplier * (ch - 'A');
    }
    return res;
}
示例#5
0
文件: string.cpp 项目: goofoo/Helium
LITESQL_String rstrip(const LITESQL_String& s) {
    if (s.empty())
        return s;
    int pos = s.size()-1;
    while (1) {
        if (isspace(s[pos]) && pos > 0)
            pos--;
        else
            break;
    }
    return s.substr(0, pos+1);
}
示例#6
0
ODBCBackend::ODBCBackend(const LITESQL_String& connInfo) : /*db(NULL),*/ transaction(false) {
    Split params(connInfo, LITESQL_L(";"));
    LITESQL_String database;
    for (size_t i = 0; i < params.size(); i++) {
        Split param(params[i],  LITESQL_L("="));
        if (param.size() == 1)
            continue;
        if (param[0] ==  LITESQL_L("database"))
            database = param[1];
    }
    if (database.size() == 0)
        throw DatabaseError(LITESQL_L("no database-param specified"));

/*    if (ODBCBackend_open(database.c_str(), &db)) {
        throw DatabaseError(ODBCBackend_errmsg(db));
    }
*/
}
示例#7
0
文件: string.cpp 项目: goofoo/Helium
LITESQL_String decapitalize(const LITESQL_String& s) {
    if (s.empty())
        return s;
    LITESQL_Char buf[2] = {tolower(s[0]), 0};
    return LITESQL_String(buf) + s.substr(1, s.size());
}
示例#8
0
文件: string.cpp 项目: goofoo/Helium
LITESQL_String toUpper(LITESQL_String s) {
    for (unsigned int i = 0; i < s.size(); i++)
        s[i] = toupper(s[i]);
    return s;	
}