summaryrefslogtreecommitdiff
path: root/music/pokeredmusicdisasm/Console.h
blob: 1de9ee558fdaf330031e6109182a0a15e8def3f7 (plain)
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
#ifndef CONSOLE_H
#define CONSOLE_H

#include <iostream>
#include <string>
#include <sstream>

// Just a Console Utility Library
class Console
{
public:
    // Basic
    static void Get(char* value);
    static void Get(std::string& value);
    static void Print(const char* value);
    static void Error(const char* value);

    // Upper-Basic
    static void PrintLn(const char* value);
    static void ErrorLn(const char* value);

    // Higher
    //static void Ask(const char* question, char* answer);
    //static void Ask(const char* question, std::string& answer);

	template<class T>
	static void Ask(const char* question, T& answer, std::ios_base::fmtflags flags = std::ios_base::dec)
	{
		std::stringstream _tmpstr;
		std::string _tmp;

		Print(question);
		Get(_tmp);

		_tmpstr << _tmp;
		_tmpstr.flags(flags);
		_tmpstr >> answer;
	}
};

#endif // CONSOLE_H