-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasescorechecker.h
75 lines (68 loc) · 2.39 KB
/
basescorechecker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*/////
//
// 2018
// BaseScoreChecker is an class to derive from for score checking
// It requires checkState to be implemented.
//
/////*/
#ifndef BASESCORECHECKER_H
#define BASESCORECHECKER_H
#include <boost/serialization/string.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/list.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/archive/tmpdir.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <iostream>
#include <boost/regex.hpp>
//#include <QItemDelegate>
class BaseScoreChecker
{
friend class boost::serialization::access;
friend std::ostream & operator<<(std::ostream &os, const BaseScoreChecker &gp);
//template<class Archive>
//void serialize(Archive & ar, const unsigned int /* file_version */);
template<class Archive> void serialize(Archive & ar, const unsigned int file_version )
{
ar & BOOST_SERIALIZATION_NVP(state)
& BOOST_SERIALIZATION_NVP(description)
& BOOST_SERIALIZATION_NVP(checkerType)
& BOOST_SERIALIZATION_NVP(points);
if (file_version>0){
ar & BOOST_SERIALIZATION_NVP(instructions);
}
}
protected:
bool state;
std::string description;
std::string instructions;
std::string checkerType;
int points;
public:
BaseScoreChecker();
BaseScoreChecker(std::string description);
bool getState();
std::string getDescription();
std::string getInstructions();
std::string getCheckerType();
int getPoints();
void setDescription(std::string newDescription); //description of item
void setInstructions(std::string newInstructions); //instruction or question for user
void setPoints(int newPoints); //points of item - negative for mistakes
virtual void checkState()=0; //Pure Virtual - run code to see if issue has been resolved
};
//BOOST_SERIALIZATION_ASSUME_ABSTRACT(BaseScoreChecker)
BOOST_CLASS_VERSION(BaseScoreChecker, 1)
std::string exec(const char* cmd);
#endif // BASESCORECHECKER_H