int Functionality::searchVectorForTitle(vector<EventStorage> searchVector, string userInput, vector<EventStorage> &tempVector)
{
	unsigned i;
	int searchCount=0;
	istringstream wordExtract(userInput);
	int wordCount=0;	
	string tempString;
	while(wordExtract >> tempString)
		wordCount++;
	string searchData;
	string tempTitle;
	int tempCount;
	for(i=0;i<searchVector.size();i++)
	{
		tempTitle=searchVector[i].getTitle();
		while(tempTitle.size()!=0)
		{
			tempCount=0;
			searchData="\0";
			istringstream titleExtract(tempTitle);
			while(titleExtract >> tempString && tempCount<wordCount)
			{
				tempCount++;
				searchData+=tempString;
				searchData+=" ";
			}
			searchData = searchData.substr(0, searchData.size()-1);
			for(unsigned iterator = 0; iterator < searchData.size(); iterator++)
				searchData[iterator] = tolower(searchData[iterator]);
			if(searchData==userInput)
			{
				searchCount++;
				tempVector.push_back(searchVector[i]);
				break;
			}
			istringstream getFirstWord(tempTitle);
			getFirstWord>>searchData;
			istringstream countTitle(tempTitle);
			tempCount=0;
			while(countTitle>>tempString)
				tempCount++;
			if(tempCount==1)
				tempTitle="\0";
			else
				tempTitle=tempTitle.substr(searchData.size()+1, tempTitle.size()-(searchData.size()+1));
		}
	}
	if(searchCount>0)
		return 1;
	else
		return 0;
}
void CK_FileMerger::on_btnStart_clicked()
{
    QFile sourcefile(this);

    QFile targetfile(ui->lineTarget->text());
    targetfile.open(QIODevice::WriteOnly|QIODevice::Text);
    QTextStream out(&targetfile);
    out.setCodec("UTF-8");

    //자바스타일 이터레이터 선언
    QStringListIterator itrFiles(strlstSourcefileNames);
    while (itrFiles.hasNext())
    {
        sourcefile.setFileName(itrFiles.next().toLocal8Bit().constData());
        ui->lstSource->addItem(sourcefile.fileName());

        if(sourcefile.open(QFile::ReadOnly|QFile::Text))
        {
            //한글사용을 위해 fromLocal8Bit함수 사용
            QString text = QString::fromLocal8Bit(sourcefile.readAll());
            //엔터키 정리
            text = text.simplified();
            //title list를 뽑아내는 함수 titleExtract()
            QStringList* strlstTitles;
            strlstTitles = titleExtract(text);
            //body list를 뽑아내는 함수 bodyExtract(), 나중에 <header>...</header>는 제거한다.
            QStringList* strlstBodies;
            strlstBodies = bodyExtract(text);

            for(int i=0; i<strlstTitles->length();++i)
            {
                QString txt = strlstTitles->at(i);

                if(!txt.isEmpty()){

                    ui->txtSource->setPlainText(txt+" is being processed.");
                    out<<txt<<"\t"<<strlstBodies->at(1)<<"\n";
                    ui->txtSource->appendPlainText(txt+" is compiled over.");
                }
            }
            ui->lineSource->setText(sourcefile.fileName());
        }
        sourcefile.close();

    }
    //ui->txtSource->appendPlainText("\r\n");
    out<<"\n";
    targetfile.close();
}