-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCatalog.h
62 lines (49 loc) · 1.07 KB
/
Catalog.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
/*
* "Drinks" RFID Terminal
* Buy sodas with your company badge!
*
* Benoit Blanchon 2014 - MIT License
* https://github.com/bblanchon/DrinksRfidTerminal
*/
#ifndef _CATALOG_H
#define _CATALOG_H
class Catalog
{
public:
Catalog()
{
productCount = 0;
}
void setProductCount(int count)
{
productCount = count;
}
int getProductCount()
{
return productCount;
}
char* getProduct(int id)
{
return products[id];
}
void setProduct(int id, const char* s)
{
strncpy(products[id], s, PRODUCT_NAME_SIZE);
}
char* getHeader()
{
return header;
}
void setHeader(const char* s)
{
strncpy(header, s, CATALOG_HEADER_SIZE);
}
static const int MAX_PRODUCT_COUNT = 5;
static const int PRODUCT_NAME_SIZE = 19;
static const int CATALOG_HEADER_SIZE = 21;
private:
int productCount;
char products[MAX_PRODUCT_COUNT][PRODUCT_NAME_SIZE];
char header[CATALOG_HEADER_SIZE];
};
#endif