00001
00002
00003 #ifndef BASE_COMMANDLINE_H
00004 #define BASE_COMMANDLINE_H
00005
00006 #include "portable.h"
00007
00008 namespace base {
00010
00014 class PPBASE_EXPORT CommandLine {
00015 public:
00017
00023 CommandLine(int argc, const char **argv, const char *optstring, bool bopterr = true);
00024
00026
00029 void dump(int ret) const;
00030
00032
00035 int getopt();
00036
00038
00041 const char *optarg() const;
00042
00044
00047 int optind() const;
00048
00050
00053 int optopt() const;
00054
00055 private:
00056 int _argc;
00057 const char **_argv;
00058 bool _finished;
00059 size_t _idx;
00060 int _lastopt;
00061 const char *_optarg;
00062 bool _opterr;
00063 int _optind;
00064 int _optopt;
00065 const char *_optstring;
00066 };
00067 }
00068
00069 #endif