示例#1
0
bool
HistoryTreeStore::search_func(const Glib::RefPtr<Gtk::TreeModel>&,int,const Glib::ustring& x,const Gtk::TreeModel::iterator& iter)
{
	const Model model;

	Glib::ustring substr(x.uppercase());
	Glib::ustring name((*iter)[model.name]);
	name=name.uppercase();

	return name.find(substr)==Glib::ustring::npos;
}
示例#2
0
FunctionDeclare::FunctionDeclare(std::vector<XCubeSatToken*> *tokens, Terminal *term, std::unordered_map<std::string, Function*> *var) throw(std::bad_typeid*):Function(term, variables)
{
    if(tokens->empty() || tokens->size() < 2) throw new std::bad_typeid();

    XCubeSatToken *t = tokens->front();

    tokens->erase(tokens->begin());

    Function *f;
    Glib::ustring *type;

    switch(t->get_type()) {
        case STRING:
        case VARIABLE:
            type = t->get_value_str();
            type->uppercase();
            if(!type->compare("BOOL")) {
                f = new FunctionVariableBool(false);}
            else if(!type->compare("DATA")) {
                f = new FunctionVariableData(NULL, NULL, 0);}
            else if(!type->compare("INT")) {
                f = new FunctionVariableInt(0);}
            else if(!type->compare("STRING")) {
                f = new FunctionVariableString(NULL); }
            else {
                throw new std::bad_typeid();}
            break;
        default:
            throw new std::bad_typeid();
    }
    this->params.push_back(f);

    if(tokens->empty()) throw new std::bad_typeid();
    t = tokens->front();
    tokens->erase(tokens->begin());

    std::pair<std::string, Function*> *p;
    switch(t->get_type()) {
        case VARIABLE:
            p = new std::pair<std::string, Function*>(*t->get_value_str(), f);
            var->insert(*p);
            break;
        default:
            throw new std::bad_typeid();
    }
}
示例#3
0
    /* compressed utf-8 table */
        0x20ac, /* 80 Euro. CP1252 from here on... */
        0x81,   /* 81 NA */
        0x201a, /* 82 */
        0x192,  /* 83 */
        0x201e, /* 84 */
        0x2026, /* 85 */
        0x2020, /* 86 */
        0x2021, /* 87 */
        0x2c6,  /* 88 */
        0x2030, /* 89 */
        0x160,  /* 8a */
        0x2039, /* 8b */
        0x152,  /* 8c */
        0x8d,   /* 8d NA */
        0x17d,  /* 8e */
        0x8f,   /* 8f NA */
        0x90,   /* 90 NA */
        0x2018, /* 91 */
        0x2019, /* 92 */
        0x201c, /* 93 */
        0x201d, /* 94 */
        0x2022, /* 95 */
        0x2013, /* 96 */
        0x2014, /* 97 */
        0x2dc,  /* 98 */
        0x2122, /* 99 */
        0x161,  /* 9a */
        0x203a, /* 9b */
        0x153,  /* 9c */
        0x9d,   /* 9d NA */
        0x17e,  /* 9e */
        0x178,  /* 9f */
        0xa0,   /* a0 */
        0xa1,   /* a1 */
        0xa2,   /* a2 */
        0xa3,   /* a3 */
        0x20ac  /* a4 ISO-8859-15 Euro. */
    };

    while (len) {
        if (G_UNLIKELY(*text >= 0x80) && G_UNLIKELY(*text <= 0xa4)) {
            int idx = *text - 0x80;
            output += lowtable[idx];
        } else {
            output += (gunichar)*text;    /* ascii/iso88591 maps directly */
        }

        text++;
        len--;
    }
    return output;
}/*}}}*/
void set_charset(Glib::ustring charset) {/*{{{*/
    charset = charset.uppercase();

    if (charset.find(' ') != Glib::ustring::npos)
        charset = charset.erase(charset.find(' '));

    if (charset.empty() || !charset.compare("SYSTEM")) {
        charset.clear();
    } else {
        try {
            Glib::IConv test("UTF-8", charset);
        } catch (...) {
            fprintf(stderr, "Charset '%s' isn't supported by your system - using system locale\n", charset.c_str());
            charset.clear();
        }
    }

    serverCharset = charset;
}/*}}}*/