void UniqueList::delFromUniqueList(int value) throw (NonexistentElemenyExeption) { if (!isFind(value)) throw NonexistentElemenyExeption("Can't delete, element dosen't find"); ListElement *tmp = this->first; while ((tmp->next->value != value) && (tmp->next->next != nullptr)) { tmp = tmp->next; } ListElement *delValue = tmp->next; tmp->next = tmp->next->next; delete(delValue); }
void UniqueList::addToUniqueList(int value) throw (DuplicateExeption) { if (isFind(value)) throw DuplicateExeption("This element is exist in tge list"); ListElement *tmp = this->first; while (tmp->next != nullptr) { tmp = tmp->next; } ListElement *addValue = new ListElement; addValue->value = value; addValue->next = tmp->next; tmp->next = addValue; }
void FindDialog::accept() { TextEditor *current = m_parent->m_activeEditor; QTextDocument *doc = current->getTextDocument(); QTextCursor start = current->textCursor(); QTextCursor result; int startPos = -1, endPos = -1; // see if we're supposed to search within a selection if (start.hasSelection() && searchSelection()) { startPos = start.selectionStart(); endPos = start.selectionEnd(); // get rid of selection if (findBackwards()) start.setPosition(endPos); else start.setPosition(startPos); } else if (!fromCursor() && !m_searching) start.movePosition(QTextCursor::Start); if (isFind()) { result = find(start, doc); // test if result was outside of selection if (!result.isNull() && ((endPos > 0 && result.selectionEnd() > endPos) || (startPos > 0 && result.selectionStart() < startPos))) result = QTextCursor(); // null cursor } else result = replace(start, doc, endPos); if (result.isNull()) { STATUS_BAR->showMessage(QString("%1 '%2' not found with the Options given").arg((regularExpression() ? QString("RegExp") : QString("String")), getSearchString())); m_searching = false; updateReplace(isReplace()); } else { current->changeTextCursor(result); STATUS_BAR->clearMessage(); m_searching = true; updateReplace(isReplace()); } }
int main(int argc, char** argv ){ //features.precision(spc_file-1); DIR *dpdf; struct dirent *epdf; dpdf = opendir("./"); vector<Mat> v_image; vector<string> v_names; int cont = 0; if (dpdf != NULL){ while (epdf = readdir(dpdf)){ string name = epdf->d_name; if( isFind(name, postfix)){ //printf("Filename: %s %s",epdf->d_name, "\n"); //Mat reader = imread( name, 1); v_names.push_back( name ); cont ++ ; } } } cout << cont << endl; sort( v_names.begin(), v_names.end(), sorter); //cout << v_image.size() << endl; // for( int i = 0 ; i < v_image.size() ; ++i){ // string s_tmp = static_cast<ostringstream*>( &(ostringstream() << i) )->str(); // imwrite( s_tmp+".jpg", v_image[i] ); // } features << cont << endl; time_t timer = time(0); for( int i = 0 ; i < cont ; ++i){ vt_borders.clear(); vm_borders.clear(); //cout << v_names[i] << endl; //cout << "."; name_images << v_names[i] << endl; function_equalization( v_names[i] ); function_borders( v_names[i] ); //function_sfilters( v_names[i] ); //function_tfilters( v_names[i] ); function_morphological( v_names[i] ); //function_segmentation( v_names[i] ); function_dominantcolor( v_names[i] ); comp_borders(); } time_t timer2 = time(0); cout <<"Tiempo total: " << difftime(timer2, timer) << endl; waitKey(0); return 0; }