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 _TEST_MANAGER_H_ 00006 #define _TEST_MANAGER_H_ 00007 00008 #include "Question.h" 00009 #include "QuestionSource.h" 00010 00011 #include <vector> 00012 00013 namespace Limiro 00014 { 00015 00017 class TestManager 00018 { 00019 public: 00020 TestManager(const std::string& filename, int num); 00021 TestManager(const std::vector<std::string>& filenames, int num); 00022 TestManager(const CatalogList& catalogs, int num); 00023 TestManager(QuestionSource& qsource, int num); 00024 00025 ~TestManager(); 00026 00027 const std::vector<const Question *>getQuestions() const; 00028 const std::vector<Result> setAnswers(const std::vector<std::string>& answers); 00029 00031 int numQuestions() const {return m_questions.size();}; 00033 const Question* operator[](int n) const {return m_questions[n];}; 00034 00035 void exportODT(const std::string& filename); 00036 00037 protected: 00038 void commonConstructor(); 00039 void loadQuestions(QuestionSource& qsource, int num); 00040 00041 static std::string metaXml(); 00042 std::string contentXml(); 00043 std::string stylesXml(); 00044 00045 std::vector<Question *> m_questions; 00046 00047 static const std::string manifest_xml; 00048 }; 00049 00050 } 00051 00052 #endif // _TEST_MANAGER_H_