X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fapp%2FArguments.cpp;fp=src%2Fapp%2FArguments.cpp;h=bdfdf181579c17d934125cbc5b84c3f4c2706c12;hb=7830acc2ab78d0c82a72948c4eb87eeb6463693c;hp=0000000000000000000000000000000000000000;hpb=cddc8a96cce6117dac14248455ac70d332a4a9f8;p=l2e.git diff --git a/src/app/Arguments.cpp b/src/app/Arguments.cpp new file mode 100644 index 0000000..bdfdf18 --- /dev/null +++ b/src/app/Arguments.cpp @@ -0,0 +1,43 @@ +/* + * Arguments.cpp + * + * Created on: Sep 15, 2012 + * Author: holy + */ + +#include "Arguments.h" + +#include +#include + +namespace app { + +Arguments::Arguments() +: outfile(0) { + +} + + +void Arguments::Read(int argc, char **argv) { + for (int i(1); i < argc; ++i) { + char *arg(argv[i]); + if (arg[0] == '-') { + switch (arg[1]) { + case 'o': + if (i + 1 >= argc) { + throw std::runtime_error("missing argument to -o"); + } + ++i; + outfile = argv[i]; + break; + default: + throw std::runtime_error(std::string("unknown option ") + arg[1]); + break; + } + } else { + infiles.push_back(arg); + } + } +} + +}