コード例 #1
0
ファイル: xbe_string.cpp プロジェクト: diorahman/opensplice
DDS_StdString be_string::StructStreamIn
(
   const DDS_StdString & arg,
   const DDS_StdString & in
) const
{
   DDS_StdString tmpvar("_");
   tmpvar += arg;
   DDS_StdString lines;

   if (m_typecode->kind == DDS::tk_string)
   {
      lines = ("{DDS::String tmp; is.get (tmp);");
   }
   else
   {
      lines = ("{DDS::WString tmp; is.get (tmp);");
   }

   lines += " tmp.set_release((DDS::Boolean) FALSE); " + arg + " = tmp; }";

   return lines;
}
コード例 #2
0
ファイル: bilet.cpp プロジェクト: popai/LotoTicket
QVector<short int*>Bilet::GenVarBilet()
{
    QVector<short int*> tmpvar(0);
    short int *tmp = 0;
    QString charnr;
    Variante varA = Variante(nrA,setStop(codA));
    Variante varB = Variante(nrB,setStop(codB));
    Variante varC = Variante(nrC,setStop(codC));

    if((nrA.count() < setStop(codA).k) && nrA.count() > 0){
        msgBox = new QMessageBox;
        msgBox->setText("Pleas select more number on fild A");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }
    if(setStop(codA).cod != "complet" && nrA.count() < setStop(codA).n){
        msgBox = new QMessageBox;
        charnr.sprintf("%d",setStop(codA).n);
        msgBox->setText("Fild A mast have "+charnr+" numbers");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }

    if(nrB.count() < setStop(codB).k && nrB.count() > 0){
        msgBox = new QMessageBox;
        msgBox->setText("Pleas select more number on fild B");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }
    if(setStop(codB).cod != "complet" && nrB.count() < setStop(codB).n){
        msgBox = new QMessageBox;
        charnr.sprintf("%d",setStop(codB).n);
        msgBox->setText("Fild B mast have "+charnr+" numbers");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }


    if(nrC.count() < setStop(codC).k && nrC.count() > 0)
    {
        msgBox = new QMessageBox;
        msgBox->setText("Pleas select more number on fild C");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }
    if(setStop(codC).cod != "complet" && nrC.count() < setStop(codC).n){
        msgBox = new QMessageBox;
        charnr.sprintf("%d",setStop(codC).n);
        msgBox->setText("Fild C mast have "+charnr+" numbers");
        msgBox->exec();
        delete msgBox;
        return tmpvar;
    }

    //if(nrA.count() < )

    if(setStop(codA).k == 6){
        tmpvar<<varA.variante;
        if(setStop(codB).k == 6){
            tmpvar<<varB.variante;
        if(setStop(codC).k == 6)
            tmpvar<<varC.variante;
        else {
            msgBox = new QMessageBox;
            msgBox->setText("Campul C este completat gresit");
            msgBox->exec();
            delete msgBox;
            return tmpvar;
            }
        }
        //schema compusa C+B
        else if((setStop(codC).k + setStop(codB).k) == 6)
            if(Diff(nrC, nrB)){
             for(int vb = 0; vb < varB.variante.count(); vb++ )
                for(int vc = 0; vc < varC.variante.count(); vc++ ){
                    tmp = new short int[6];
                    for(int i = 0; i < setStop(codB).k; i++ )
                        tmp[i] = varB.variante.at(vb)[i];
                    for(int j = 0; j < setStop(codC).k; j++ )
                        tmp[setStop(codB).k + j] = varC.variante.at(vc)[j];
                    tmpvar<<tmp;
                    }
                }
             else{
                msgBox = new QMessageBox;
                msgBox->setText("Numerele din campurile B si C trebui sa fie diferite");
                msgBox->exec();
                delete msgBox;
                return tmpvar;
                }

            else {// prelucrare bilet camp B
                msgBox = new QMessageBox;
                msgBox->setText("Campul B este completat gresit");
                msgBox->exec();
                delete msgBox;
                return tmpvar;
                }

    }
    else if((setStop(codA).k + setStop(codB).k) == 6){ //A+B = 6
        if(Diff(nrA, nrB))
        for(int va = 0; va < varA.variante.count(); va++ )
            for(int vb = 0; vb < varB.variante.count(); vb++ ){
                tmp = new short int[6];
                for(int i = 0; i < setStop(codA).k; i++ )
                    tmp[i] = varA.variante.at(va)[i];
                for(int j = 0; j < setStop(codB).k; j++ )
                    tmp[setStop(codA).k + j] = varB.variante.at(vb)[j];
                tmpvar<<tmp;
            }
        else{
            msgBox = new QMessageBox;
            msgBox->setText("Numerele din campurile A si B trebui sa fie diferite");
            msgBox->exec();
            delete msgBox;
            return tmpvar;
        }

        if(setStop(codC).k == 6) tmpvar<<varC.variante;
        else{
            msgBox = new QMessageBox;
            msgBox->setText("Campul C este completat gresit");
            msgBox->exec();
            delete msgBox;
            return tmpvar;
        }
    }
        else if((setStop(codA).k + setStop(codB).k) + setStop(codC).k == 6)
            if(Diff(nrA, nrB, nrC))
            for(int va = 0; va < varA.variante.count(); va++ )
                for(int vb = 0; vb < varB.variante.count(); vb++ )
                    for(int vc = 0; vc < varC.variante.count(); vc++ ){
                        tmp = new short int[6];
                        for(int i = 0; i < setStop(codA).k; i++ )
                            tmp[i] = varA.variante.at(va)[i];
                        for(int j = 0; j < setStop(codB).k; j++ )
                            tmp[setStop(codA).k + j] = varB.variante.at(vb)[j];
                        for(int k = 0; k < setStop(codC).k; k++ )
                            tmp[setStop(codA).k + setStop(codB).k + k] = varC.variante.at(vc)[k];
                        tmpvar<<tmp;
                    }
            else { // prelucrare bilet camp A
                 msgBox = new QMessageBox;
                 msgBox->setText("Numerele din campurile A, B si C trebui sa fie diferite");
                 msgBox->exec();
                 delete msgBox;
                 return tmpvar;
                 }

            else { // prelucrare bilet camp A
                msgBox = new QMessageBox;
                msgBox->setText("Campul A este completat gresit");
                msgBox->exec();
                delete msgBox;
                return tmpvar;
                }
    biletOK = true;
    return tmpvar;
}