The Lean Mean C++ Option Parser
src/testodr2.cc
Go to the documentation of this file.
00001 /* Written 2012 by Matthias S. Benkmann
00002  *
00003  * The author hereby waives all copyright and related rights to the contents
00004  * of this example file (testodr2.cc) to the extent possible under the law.
00005  */
00006 
00013 #include "optionparser.h"
00014 
00015 #include <cstdio>
00016 
00017 using option::Descriptor;
00018 using option::Arg;
00019 enum OptionIndex {CREATE};
00020 enum OptionType {DISABLE, ENABLE, OTHER};
00021 
00022 extern const Descriptor usage[] = {
00023    { CREATE, OTHER,
00024      "c", "create",
00025      Arg::None,
00026      "--create\t\t\tTells the program to create something."
00027    }
00028  };
00029 
00030 extern bool foo(int argc, const char* argv[])
00031 {
00032   printUsage(std::fwrite, stdout, usage);
00033   option::Stats stats(usage, argc, argv);
00034   option::Option buffer [stats.buffer_max];
00035   option::Option options[stats.options_max];
00036   option::Parser parse(usage, argc, argv, options, buffer);
00037   return parse.error();
00038 }
00039 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator