This repository has been archived by the owner on May 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputData.h
53 lines (45 loc) · 1.34 KB
/
InputData.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
#ifndef INPUTDATA_H
#define INPUTDATA_H
/**
* \file
* \brief Definicja klasy InputData, pochodnej klasy Data oraz nadrzędnej dla klas pobierających dane wejściowe.
*
* Plik ten jest częścią projektu currency_calc.
*/
#include <string>
#include <vector>
#include "Data.h"
/**
* \brief Nadrzędna klasa danych wejściowych.
*
* Klasa nadrzędna dla danych wejściowych, wykorzystywana we wzorcu <b>factory metod</b>,
* wyboru typu uzyskiwania danych.\n
*/
class InputData : public Data
{
protected:
/**
* \brief Struktura filtru, dającego tylko dane liczbowe z wejśćia.
*/
struct numeric_only: std::ctype<char>
{
numeric_only(): std::ctype<char>(get_table()) {}
static std::ctype_base::mask const* get_table()
{
static std::vector<std::ctype_base::mask>
rc(std::ctype<char>::table_size,std::ctype_base::space);
std::fill(&rc['0'], &rc[':'], std::ctype_base::digit);
return &rc[0];
}
};
public:
/**
* \brief Wirtualny destruktor.
*/
virtual ~InputData() {}
/**
* \brief Pobiera dane wejściowe. Funckja do przeciążenia dla klas pochodnych.
*/
virtual int getData(std::string param) = 0;
};
#endif // INPUTDATA_H