예제 #1
0
 void MainWindowTask::setup()
 {
     ui->setupUi(this);
     ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
     settings = new QSettings("NIISI RAS","Kumir 1.9");
     setWindowIcon(QIcon(":/taskEdit.ico"));
     settings->setIniCodec("UTF-8");
     lastFiles=settings->value("RescentFiles").toStringList();
     customMenu.hide();
     connect(ui->loadCurs,SIGNAL(activated()),this,SLOT(loadCourse()));
     connect(ui->actionSave,SIGNAL(activated()),this,SLOT(saveCourse()));
     connect(ui->treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(showText(QModelIndex)));
     connect(ui->treeView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(startEdit(QModelIndex)));
    //   connect(ui->do_task,SIGNAL(triggered()),this,SLOT(startTask()));
       qDebug()<<"Check Connect tttttttttttttttttt";
       //connect(ui->checkTask,SIGNAL(triggered()),this,SLOT(checkTask()));
      //connect(ui->actionReset,SIGNAL(triggered()),this,SLOT(resetTask()));
        connect(ui->actionClose,SIGNAL(triggered()),this,SLOT(Close()));
        //   connect(ui->actionTested,SIGNAL(triggered()),this,SLOT(returnTested()));
           connect(ui->treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenuRequested(QPoint)));

           customMenu.addAction(ui->actionAdd);
           customMenu.addAction(ui->actionRemove);
           customMenu.addAction(ui->actionEdit);
           customMenu.addAction(ui->addDeep);
       customMenu.addSeparator();
       customMenu.addAction(ui->actionup);
       customMenu.addAction(ui->actionDown);
       customMenu.addAction(ui->actionMakeSection);
       customMenu.addMenu(ui->menuMove);
        connect(ui->zadRb,SIGNAL(clicked(bool)),this,SLOT(setType()));
        connect(ui->nodeRb,SIGNAL(clicked(bool)),this,SLOT(setType()));




       connect(ui->actionup,SIGNAL(triggered()),this,SLOT(moveUp()));
       connect(ui->actionDown,SIGNAL(triggered()),this,SLOT(moveDown()));
           connect(ui->actionAdd,SIGNAL(triggered()),this,SLOT(addTask()));
            connect(ui->addDeep,SIGNAL(triggered()),this,SLOT(addDeepTask()));
           connect(ui->actionSaveK,SIGNAL(triggered()),this,SLOT(saveKurs()));
            connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveKursAs()));
           connect(ui->actionRemove,SIGNAL(triggered()),this,SLOT(deleteTask()));
           connect(ui->actionMakeSection,SIGNAL(triggered()),this,SLOT(makeSection()));
           newDialog=new newKursDialog();
           connect(ui->actionNewK,SIGNAL(triggered()),this,SLOT(newKurs()));
           editDialog = new EditDialog(this);
           connect(ui->actionEdit,SIGNAL(triggered()),this,SLOT(editTask()));
           //ui->menuKurs->menuAction()->setVisible(false);
          // ui->menuKurs->menuAction()->setEnabled(false);
           setEditTaskEnabled(false);
           ui->treeView->setSelectionMode(QAbstractItemView::SingleSelection);
           editRoot=new QLineEdit(ui->treeView);
           editRoot->hide();
           connect(editRoot,SIGNAL(editingFinished ()),this,SLOT(endRootEdit()));
           connect(ui->remIspButt,SIGNAL(pressed()),this,SLOT(remSelIsp()));
           connect(ui->addIspButt,SIGNAL(pressed()),this,SLOT(addIsp()));
           connect(ui->ispList,SIGNAL(clicked(QModelIndex)),this,SLOT(showFields()));
           connect(ui->fieldsList,SIGNAL(clicked(QModelIndex)),this,SLOT(fieldClick()));
           connect(ui->remFieldButt,SIGNAL(pressed()),this,SLOT(remField()));
           connect(ui->addFieldButt,SIGNAL(pressed()),this,SLOT(addField()));
           connect(ui->actionS,SIGNAL(triggered()),this,SLOT(saveBaseKurs()));
           connect(ui->selFileButt,SIGNAL(pressed()),this,SLOT(setPrg()));
           connect(ui->prgEdit,SIGNAL(textChanged(QString)),this,SLOT(prgLineChange()));
           connect(ui->editFButt,SIGNAL(pressed()),this,SLOT(editFile()));
           connect(ui->menuMove,SIGNAL(aboutToShow()),this,SLOT(createMoveMenu()));

         //  QMessageBox::information( 0, "", trUtf8("Setup add "), 0,0,0);
           ui->ispSel->addItem("Robot");
           ui->ispSel->addItem(trUtf8("Водолей"));
           ui->actionup->setIcon(QIcon(":/arrow_up.png"));
           ui->actionDown->setIcon(QIcon(":/arrow_down.png"));
           changed=false;
isTeacher=true;
       onTask=false;
       cursFile="";
createRescentMenu();
       //ui->textBrowser->setVisible(false);
 };
예제 #2
0
Dxf* dxfProcessDocument(FILE* dxfFile) {
    Dxf* root = makeDxf();
    StackItem stackItem = {root, Dxf_OBJ};
    stackPush(stackItem);
    
    Section* pCurrentSection = NULL;
    while (1) {
        CodeData codeData = readCodeData(dxfFile, false);   
        if ((codeData.code == 0) && (!strcmp(codeData.data, "EOF"))) {
            assert(SAFE_CAST_TO(Dxf, stackTop()));
            stackPop();
            assert(stackEmpty());
            break;
        }

        if ((codeData.code == 0) && (!strcmp(codeData.data, "SECTION"))) {
            /* Check Context */
            Dxf* pDxf = SAFE_CAST_TO(Dxf, stackTop());
            assert(pDxf); 
            
            /* Create an new section and push into stack */
            Section* newSection = makeSection(codeData.counter);
            pCurrentSection = newSection;
            
            StackItem newItem = {newSection, Section_OBJ};
            stackPush(newItem);
            
            /* Add the new section to parent */
            if (pDxf->pSectionHead) {
                pDxf->pSectionTail->next = newSection;
                pDxf->pSectionTail = newSection;
            } else {
                pDxf->pSectionHead = pDxf->pSectionTail = newSection;
            }
            continue;
        }
        
        if ((codeData.code == 0) && (!strcmp(codeData.data, "ENDSEC"))) {
            if (pCurrentSection && (!strcmp(pCurrentSection->type, "ENTITIES"))) { 
                Entity* pEntity = SAFE_CAST_TO(Entity, stackTop());
                if (pEntity) {
                    pEntity->endCounter = codeData.counter - 1;
                }
                stackPop();
            }
            Section* pSection = SAFE_CAST_TO(Section, stackTop());
            assert(pSection);
            pSection->endCounter = codeData.counter;
            
            stackPop();
            continue;
        }
        
        /* Store Section Type */
        if (isSection(&codeData)) {
            Section* pSection = SAFE_CAST_TO(Section, stackTop());
            assert(pSection);
            strcpy(pSection->type, codeData.data);
            continue;
        }
        
        /* Process Code, Data under Entities Section */
        
        if (pCurrentSection && (!strcmp(pCurrentSection->type, "ENTITIES"))) {
            dxfProcessEntities(&codeData);
            continue;            
        }
        
        /*
            TODO: process other sections
        */
    } 
    return root;   
} 
예제 #3
0
파일: rule.t.cpp 프로젝트: cawka/ndn-cxx
        sig-type rsa-sha256
        key-locator
        {
          type name
          hyper-relation
          {
            k-regex ^(<>+)$
            k-expand \\1
            h-relation equal
            p-regex ^(<>+)$
            p-expand \\1
          }
        }
      }
    )CONF";
  auto rule = Rule::create(makeSection(config), "test-config");

  BOOST_CHECK_EQUAL(rule->match(PktType::value, this->pktName), true);
  BOOST_CHECK_EQUAL(rule->match(PktType::value, "/not" + this->pktName.toUri()), false);

  auto state = make_shared<DummyValidationState>();
  BOOST_CHECK_EQUAL(rule->check(PktType::value, this->pktName, "/foo/bar", state), true);

  state = make_shared<DummyValidationState>();
  BOOST_CHECK_EQUAL(rule->check(PktType::value, this->pktName, "/not/foo/bar", state), false);
}

BOOST_AUTO_TEST_SUITE_END() // Create

BOOST_AUTO_TEST_SUITE_END() // TestRule
BOOST_AUTO_TEST_SUITE_END() // ValidatorConfig