src/CLIParser.h
branchv_0
changeset 17 ea36eed9683f
parent 14 a7596589a5b0
equal deleted inserted replaced
16:d2e0654803c1 17:ea36eed9683f
    47 	}
    47 	}
    48 
    48 
    49 public:
    49 public:
    50 
    50 
    51 	static const relpipe::reader::string_t OPTION_WRITE_HEADER;
    51 	static const relpipe::reader::string_t OPTION_WRITE_HEADER;
       
    52 	static const relpipe::reader::string_t OPTION_WRITE_TYPES;
    52 
    53 
    53 	Configuration parse(const std::vector<relpipe::reader::string_t>& arguments) {
    54 	Configuration parse(const std::vector<relpipe::reader::string_t>& arguments) {
    54 		Configuration c;
    55 		Configuration c;
    55 
    56 
    56 		for (int i = 0; i < arguments.size();) {
    57 		for (int i = 0; i < arguments.size();) {
    57 			relpipe::reader::string_t option = readNext(arguments, i);
    58 			relpipe::reader::string_t option = readNext(arguments, i);
    58 
    59 
    59 			if (option == OPTION_WRITE_HEADER) {
    60 			if (option == OPTION_WRITE_HEADER) {
    60 				c.writeHeader = parseBoolean(readNext(arguments, i));
    61 				c.writeHeader = parseBoolean(readNext(arguments, i));
       
    62 			} else if (option == OPTION_WRITE_TYPES) {
       
    63 				c.writeTypes = parseBoolean(readNext(arguments, i));
    61 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    64 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    62 		}
    65 		}
    63 
    66 
    64 		return c;
    67 		return c;
    65 	}
    68 	}
    67 	virtual ~CLIParser() {
    70 	virtual ~CLIParser() {
    68 	}
    71 	}
    69 };
    72 };
    70 
    73 
    71 const relpipe::reader::string_t CLIParser::OPTION_WRITE_HEADER = L"--write-header";
    74 const relpipe::reader::string_t CLIParser::OPTION_WRITE_HEADER = L"--write-header";
       
    75 const relpipe::reader::string_t CLIParser::OPTION_WRITE_TYPES = L"--write-types";
    72 
    76 
    73 }
    77 }
    74 }
    78 }
    75 }
    79 }