8 /** @short helper objects and functions which help reduce the
9 need for char[] and the standard library.
11 defines three @ref QTextStream instances
12 which behave like the c++ standard iostreams, bound to the
13 standard in/out/error.
15 Also provided, some helper functions for writing
16 interactive stdin/stdout applications.
21 /** @short An alias for standard input
23 extern QTextStream cin; /* declared only, defined in the .cpp file */
24 /** @short An alias for standard output
26 extern QTextStream cout;
27 /** @short An alias for standard error
29 extern QTextStream cerr;
31 interactive stdin UI - prompts user with
32 a yes/no question. Repeatedly-asks
33 until user supplies a valid answer.
35 @param yesNoQuestion the yes/no question
36 @return true/false depending on what the
39 bool yes(QString yesNoQuestion);
40 /** Convenience function that feeds a specific question
41 to the yes() function.
42 @usage do {.....} while(more ("foobar"));
43 so that user sees the question: "Another foobar (y/n)? "
44 @param name of the item being handled by the loop.
46 bool more(QString prompt);
47 /** A function for safely taking an int from the keyboard.
48 Takes data into a QString and tests to make sure it
49 can be converted to int before returning.
50 @param base allows choice of number base.
51 @return returns validated int.
53 int promptInt(int base = 10);
54 /** A function for safely taking a double from the keyboard.
55 Takes data into a QString and tests to make sure it
56 can be converted to double before returning.
57 @return returns validated int.
59 double promptDouble();
60 /** Complete dialog for opening a file for output.
61 Asks user for file name, checks to see if
62 file already exists and, if so, asks the user if
63 it is ok to overwrite.
64 @param Reference QFile parameter is set to point
65 to the (eventually) opened file.
67 /** @short Dialog for a output file prompt
69 void promptOutputFile(QFile& outfile);
71 /** @short Dialog for input file prompt */
72 void promptInputFile(QFile& infile);