src/tool-msearch.cpp
void Tool_msearch::doTextSearch(HumdrumFile& infile, NoteGrid& grid,
		vector<MSearchTextQuery>& query) {

	vector<TextInfo*> words;
	words.reserve(10000);
	fillWords(infile, words);
	int tcount = 0;

	HumRegex hre;
	for (int i=0; i<(int)query.size(); i++) {
		for (int j=0; j<(int)words.size(); j++) {
			if (hre.search(words.at(j)->fullword, query.at(i).word, "i")) {
				tcount++;
				markTextMatch(infile, *words[j]);
			}
		}
	}

	string textinterp = "**text";
	vector<HTp> interps;
	infile.getSpineStartList(interps);
	//int textcount = 0;
	int silbecount = 0;
	for (int i=0; i<(int)interps.size(); i++) {
		//if (interps[i]->getText() == "**text") {
		//	textcount++;
		//}
		if (interps[i]->getText() == "**silbe") {
			silbecount++;
		}
	}
	if (silbecount > 0) {
		// giving priority to **silbe content
		textinterp = "**silbe";
	}

	if (tcount && m_markQ) {
		string content = "!!!RDF";
		content += textinterp;
		content += ": ";
		content += m_marker;
		content += " = marked text";
		if (getBoolean("color")) {
			content += ", color=\"" + getString("color") + "\"";
		}
		infile.appendLine(content);
		infile.createLinesFromTokens();
	}

	for (int i=0; i<(int)words.size(); i++) {
		delete words[i];
		words[i] = NULL;
	}

	if (!m_quietQ) {
		addTextSearchSummary(infile, tcount, m_marker);
	}
}
//////////////////////////////
//
// Tool_msearch::doTextSearch -- do a basic text search of all parts.
//
:doTextSearch -- do a basic text search of all parts.
: doTextSearch -- do a basic text search of all parts .
void Tool_msearch::doTextSearch(HumdrumFile& infile, NoteGrid& grid,
		vector<MSearchTextQuery>& query) {
	vector<TextInfo*> words;
	words.reserve(10000);
	fillWords(infile, words);
	int tcount = 0;
	HumRegex hre;
	for (int i=0; i<(int)query.size(); i++) {
		for (int j=0; j<(int)words.size(); j++) {
			if (hre.search(words.at(j)->fullword, query.at(i).word, "i")) {
				tcount++;
				markTextMatch(infile, *words[j]);
			}
		}
	}
	string textinterp = "**text";
	vector<HTp> interps;
	infile.getSpineStartList(interps);
	int silbecount = 0;
	for (int i=0; i<(int)interps.size(); i++) {
		if (interps[i]->getText() == "**silbe") {
			silbecount++;
		}
	}
	if (silbecount > 0) {
		textinterp = "**silbe";
	}
	if (tcount && m_markQ) {
		string content = "!!!RDF";
		content += textinterp;
		content += ": ";
		content += m_marker;
		content += " = marked text";
		if (getBoolean("color")) {
			content += ", color=\"" + getString("color") + "\"";
		}
		infile.appendLine(content);
		infile.createLinesFromTokens();
	}
	for (int i=0; i<(int)words.size(); i++) {
		delete words[i];
		words[i] = NULL;
	}
	if (!m_quietQ) {
		addTextSearchSummary(infile, tcount, m_marker);
	}
}
void Tool_msearch :: doTextSearch ( HumdrumFile & infile , NoteGrid & grid , vector < MSearchTextQuery > & query ) { vector < TextInfo * > words ; words . reserve ( 10000 ) ; fillWords ( infile , words ) ; int tcount = 0 ; HumRegex hre ; for ( int i = 0 ; i < ( int ) query . size ( ) ; i ++ ) { for ( int j = 0 ; j < ( int ) words . size ( ) ; j ++ ) { if ( hre . search ( words . at ( j ) -> fullword , query . at ( i ) . word , " " ) ) { tcount ++ ; markTextMatch ( infile , * words [ j ] ) ; } } } string textinterp = " " ; vector < HTp > interps ; infile . getSpineStartList ( interps ) ; int silbecount = 0 ; for ( int i = 0 ; i < ( int ) interps . size ( ) ; i ++ ) { if ( interps [ i ] -> getText ( ) == " " ) { silbecount ++ ; } } if ( silbecount > 0 ) { textinterp = " " ; } if ( tcount && m_markQ ) { string content = " " ; content += textinterp ; content += " " ; content += m_marker ; content += " " ; if ( getBoolean ( " " ) ) { content += " \" " + getString ( " " ) + " \" " ; } infile . appendLine ( content ) ; infile . createLinesFromTokens ( ) ; } for ( int i = 0 ; i < ( int ) words . size ( ) ; i ++ ) { delete words [ i ] ; words [ i ] = NULL ; } if ( ! m_quietQ ) { addTextSearchSummary ( infile , tcount , m_marker ) ; } }
Tool_msearch::doTextSearch -- do a basic text search of all parts.
Tool_msearch :: doTextSearch -- do a basic text search of all parts .
//int textcount = 0; //if (interps[i]->getText() == "**text") { //	textcount++; //} // giving priority to **silbe content