include/relpipe/cli/CLI.h
branchv_0
changeset 7 95e647bf1922
parent 6 114521cca04a
child 13 b1e861523740
equal deleted inserted replaced
6:114521cca04a 7:95e647bf1922
    21 #include <string>
    21 #include <string>
    22 #include <vector>
    22 #include <vector>
    23 #include <sstream>
    23 #include <sstream>
    24 #include <locale>
    24 #include <locale>
    25 #include <codecvt>
    25 #include <codecvt>
       
    26 #include <iostream>
    26 
    27 
    27 using namespace std;
    28 using namespace std;
    28 
    29 
    29 namespace relpipe {
    30 namespace relpipe {
    30 namespace cli {
    31 namespace cli {
    67 	static const int EXIT_CODE_UNEXPECTED_ERROR = 1;
    68 	static const int EXIT_CODE_UNEXPECTED_ERROR = 1;
    68 	static const int EXIT_CODE_BAD_SYNTAX = 3;
    69 	static const int EXIT_CODE_BAD_SYNTAX = 3;
    69 	static const int EXIT_CODE_UNKNOWN_COMMAND = 4;
    70 	static const int EXIT_CODE_UNKNOWN_COMMAND = 4;
    70 	static const int EXIT_CODE_DATA_ERROR = 5;
    71 	static const int EXIT_CODE_DATA_ERROR = 5;
    71 
    72 
       
    73 	/**
       
    74 	 * std::cin and std::cout are "tied" by default i.e. reading from std::cin causes flush of the std::cout.
       
    75 	 * Call this to "untie" them and have less write() calls (better buffering).
       
    76 	 */
       
    77 	static void untieStdIO() {
       
    78 		std::cin.tie(nullptr);
       
    79 	}
       
    80 
    72 private:
    81 private:
    73 	int* argc;
    82 	int* argc;
    74 	char*** argv;
    83 	char*** argv;
    75 	wstring program;
    84 	wstring program;
    76 	vector<wstring> args;
    85 	vector<wstring> args;