-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.h
More file actions
44 lines (38 loc) · 1.36 KB
/
utility.h
File metadata and controls
44 lines (38 loc) · 1.36 KB
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
/*
* utility.h
*
* Created on: Dec 31, 2012
* Author: cyberwizzard
*/
#ifndef UTILITY_H_
#define UTILITY_H_
#include <curses.h>
#include <assert.h>
#include <stdlib.h>
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
/**
* Ask for an integer input.
* @param wnd The curses window to print the question in.
* @param q String holding the question to ask.
* @param ans A pointer to put the answer in.
* @param def The default value for the question, can be an illegal value to force the user to make a choice.
* @param min The minimum value to accept.
* @param max The maximum value to accept.
* @param step A step size to apply from the minimum value, for example increments of 10.
* @return False if the user pressed escape to abort the question.
*/
bool utility_ask_int(WINDOW *wnd, string q, int *ans, int def, int min = 0, int max = 999, int step = 1);
/**
* Ask for an yes or no answer.
* @param wnd The curses window to print the question in.
* @param q String holding the question to ask.
* @param ans A pointer to put the answer in, True for yes, False for no.
* @param def The default value for the question, 0 for yes, any other value for no
* @return False if the user pressed escape to abort the question.
*/
bool utility_ask_bool(WINDOW *wnd, string q, bool *ans, int def);
#endif /* UTILITY_H_ */