Ejemplo n.º 1
0
void PrefixPogoda::on_affix_add_pressed()
{
    auto ele = std::make_pair(ui->affix_input->text(), ui->affix_des->text());
    if(ele.first == "" || ele.second =="") return;
    switch (ui->affix_type->currentIndex()) {
    case 0:
        if(!checkDup(ele.first, prefixs)) {
            QMessageBox::warning(this, "Error", "Duplicated affixes inserted",
                                 QMessageBox::Ok);
        }else {
            prefixs.push_back(ele);
            affix_add_helper(0, ele.first);
            ui->word_prefix->clear();
            ui->word_prefix->addItem("");
            ui->word_prefix->addItems(affix_lists[0].first);
        }
        break;
    case 1:
        if(!checkDup(ele.first, roots)) {
            QMessageBox::warning(this, "Error", "Duplicated affixes inserted",
                                 QMessageBox::Ok);
        }else {
            roots.push_back(ele);
            affix_add_helper(1, ele.first);
            ui->word_root->clear();
            ui->word_root->addItem("");
            ui->word_root->addItems(affix_lists[1].first);
        }
        break;
    case 2:
        if(!checkDup(ele.first, suffixs)) {
            QMessageBox::warning(this, "Error", "Duplicated affixes inserted",
                                 QMessageBox::Ok);
        }else {
            suffixs.push_back(ele);
            affix_add_helper(2, ele.first);
            ui->word_suffix->clear();
            ui->word_suffix->addItem("");
            ui->word_suffix->addItems(affix_lists[2].first);
        }
        break;
    default:
        break;
    }
}
Ejemplo n.º 2
0
void ConstantList::assimilate(ConstantList& n, ConstantList& committed, ConstantList& other, ConstantList& otherPend, bool priv, const char* cname) {
   for (cnemap_t::iterator i = n.cnemap.begin(), e = n.cnemap.end(); i != e; ++i) {
      if (!checkDup(i->first, committed, other, otherPend, priv, cname)) {
	 cnemap[i->first] = i->second;
	 i->second = 0;
      }
   }

   n.parseDeleteAll();
}
Ejemplo n.º 3
0
void ConstantList::parseAdd(const std::string& name, AbstractQoreNode* val, ConstantList& committed, ConstantList& other, ConstantList& otherPend, bool priv, const char* cname) {
   if (checkDup(name.c_str(), committed, other, otherPend, priv, cname)) {
      if (val)
	 val->deref(0);
   }
   else {
      ConstantEntry* ce = new ConstantEntry(name.c_str(), val, getTypeInfoForValue(val));
      cnemap[ce->getName()] = ce;
   }
}