FMI Table
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 2 | Project Topic 7 |
Toolbox.hpp
Go to the documentation of this file.
1#ifndef HEADER_CONSOLEINTERFACE_TOOLBOX
2#define HEADER_CONSOLEINTERFACE_TOOLBOX
3
4#include <iostream>
5#include "../List/List.hpp"
6#include "../String/String.h"
7
16#define MAX_LINE_WIDTH 1024
17
19void inputLineBox(char* output, unsigned maxWidth, bool ignore = true);
20
22void printTable(const List<String>& items, unsigned columns);
23
25template <typename T>
26void read(T* storage) {
27 std::cin >> storage;
28}
29
31template <typename T>
32void read(T& storage) {
33 std::cin >> storage;
34}
35
37template <typename T>
38void print(const T* item) {
39 std::cout << item;
40}
41
43template <typename T>
44void print(const T& item) {
45 std::cout << item;
46}
47
49template <typename T>
50void printLine(const T* item) {
51 std::cout << item << std::endl;
52}
53
55template <typename T>
56void printLine(const T& item) {
57 std::cout << item << std::endl;
58}
59
60#endif
void printTable(const List< String > &items, unsigned columns)
Prints a string list as a table.
Definition: Toolbox.cpp:66
void printLine(const T *item)
Prints given item and an endline character.
Definition: Toolbox.hpp:50
void read(T *storage)
Reads user input and stores it.
Definition: Toolbox.hpp:26
void print(const T *item)
Prints given item.
Definition: Toolbox.hpp:38
void inputLineBox(char *output, unsigned maxWidth, bool ignore=true)
Prints label, gets a whole line of input and stores it to output.
Definition: Toolbox.cpp:19
Templated class that stores an array of elements in dynamic memory.
Definition: List.hpp:22