00001 // -*- C++ -*- 00002 /* Copyright (C) 2007-2008 Johann Rudloff 00003 * License: GNU GPLv2 or later, see file "COPYING". No warranty of any kind! */ 00004 00005 #ifndef _EXERCISE_MANAGER_H_ 00006 #define _EXERCISE_MANAGER_H_ 00007 00008 #include <list> 00009 #include <string> 00010 00011 #include "CatalogManager.h" 00012 #include "Question.h" 00013 #include "QuestionSource.h" 00014 00015 namespace Limiro 00016 { 00017 00019 00027 class ExerciseManager 00028 { 00029 public: 00030 ExerciseManager(const std::string& filename); 00031 ExerciseManager(const std::vector<std::string>& filenames); 00032 ExerciseManager(const CatalogList& catalogs); 00033 ExerciseManager(QuestionSource& qsource); 00034 00035 ~ExerciseManager(); 00036 00037 const Question *getQuestion() const; 00038 Result setAnswer(const std::string& answer); 00039 00041 bool finished(){return (m_questions.size() == 0);}; 00042 00043 protected: 00044 void commonConstructor(); 00045 void loadQuestions(QuestionSource& qsource); 00046 00047 std::list<Question *> m_questions; 00048 }; 00049 00050 } 00051 00052 #endif // _EXERCISE_MANAGER_H_