SaveLoad.h 827 Bytes
Newer Older
Kyle Malaguit's avatar
Kyle Malaguit committed
1 2 3 4
#ifndef SAVELOAD_H
#define SAVELOAD_H

#include <fstream>
Kyle Malaguit's avatar
Kyle Malaguit committed
5
#include <vector>
Kyle Malaguit's avatar
Kyle Malaguit committed
6
#include <cstring>
Kyle Malaguit's avatar
Kyle Malaguit committed
7 8
#include "Scores.h"
#include <map>
Kyle Malaguit's avatar
Kyle Malaguit committed
9
#include <string>
Kyle Malaguit's avatar
Kyle Malaguit committed
10
#include <algorithm>
Kyle Malaguit's avatar
Kyle Malaguit committed
11
#include <stdexcept>
Kyle Malaguit's avatar
Kyle Malaguit committed
12 13 14 15
#include <iostream>
using namespace std;


Kyle Malaguit's avatar
Kyle Malaguit committed
16 17 18
class Scores;
class SaveLoad {
    public:
Kyle Malaguit's avatar
Kyle Malaguit committed
19 20
        
        //these functions change the files data
Kyle Malaguit's avatar
Kyle Malaguit committed
21 22 23 24 25
        virtual void LoadContainers() = 0;
        virtual void updateFile() = 0;
        
        //add new data into file
        void sortByScore();
Kyle Malaguit's avatar
Kyle Malaguit committed
26 27
        void userInputNameMakeScore(int intScore);
        
Kyle Malaguit's avatar
Kyle Malaguit committed
28 29 30
        //display scores in the bash
        void displayScores();
        
Kyle Malaguit's avatar
Kyle Malaguit committed
31 32 33
        //function for comparing
        static bool sortAscending(Scores, Scores);
        
Kyle Malaguit's avatar
Kyle Malaguit committed
34 35
    protected:
        vector<Scores> scores;
Kyle Malaguit's avatar
Kyle Malaguit committed
36
        void pushBackNewScoreAndSort(Scores Score);
Kyle Malaguit's avatar
Kyle Malaguit committed
37 38
    
};
Kyle Malaguit's avatar
Kyle Malaguit committed
39 40

#endif