Exemple #1
0
int main(){
	Time* time;
	Hash* hash;
	Heap* heap;
	Song* playing;

	std::string line;
	std::string filename;

	while (getline(std::cin, line)){
		if (line.substr(0, 3) == "RUN"){
			filename = line.substr(4, line.length()-4);
			if (DEBUG){
				std::cout << "\nINPUT: '" << line << "'" << std::endl;
				std::cout << "TIME: " << "NULL" << std::endl;
				std::cout << "-----SONGS-----" << std::endl;
				std::cout << "--HASH--" << std::endl;
				std::cout << "NULL" << std::endl;
				std::cout << "--HEAP--" << std::endl;
				std::cout << "NULL" << std::endl;
				std::cout << "--CLOSE SONGS--\n" << std::endl;
			}
			if (run(filename, time, hash, heap, playing)) break;
		}else{
			if (parseLine(line, time, hash, heap, playing)) break;
			if (DEBUG){
				std::cout << "\nINPUT: '" << line << "'" << std::endl;
				std::cout << "TIME: " << time->prettyCurrentTime() << std::endl;
				std::cout << "-----SONGS-----" << std::endl;
				std::cout << "--HASH--" << std::endl;
				hash->out();
				std::cout << "--HEAP--" << std::endl;
				heap->out(time->getElapsedTime());
				std::cout << "--CLOSE SONGS--\n" << std::endl;
			}
		}
	}

	delete hash;
	delete heap;
	delete time;

	return 0;
}