args2.h

来自「一个用MATLAB语言编写的摄像机标定工具箱,内容丰富」· C头文件 代码 · 共 59 行

H
59
字号
//
// args2.h
//
// $Id: args2.h,v 1.1.1.1 2001/02/28 00:28:35 cstolte Exp $
//

#ifndef SGL_ARGS2_H
#define SGL_ARGS2_H

#include <sgl/defs.h>

class Arg;

class ArgParser2 {
public:
  ArgParser2();
  ~ArgParser2();

  void optional(const char *sw, const char *helpstr, 
		int *i, int num);
  void optional(const char *sw, const char *helpstr, 
		double *d, int num);
  void optional(const char *sw, const char *helpstr, 
		float *f, int num);
  void optional(const char *sw, const char *helpstr, 
		char **str, int num);
  void optional(const char *sw, const char *helpstr, bool *b);
  void optional(char ***floaters, const char *helpstr, int num);
  void optional(char **floater, const char *helpstr);
 
  void required(const char *sw, const char *helpstr, 
		int *i, int num);
  void required(const char *sw, const char *helpstr,
		double *d, int num);
  void required(const char *sw, const char *helpstr,
		float *f, int num);
  void required(const char *sw, const char *helpstr,
		char **str, int num);
  void required(char ***floaters, const char *helpstr, int num);
  void required(char **floater, const char *helpstr);

  void process(const char *prog_name, int argc, char **argv);
  void print_help(const char *prog_name) const;

  friend std::ostream &operator<<(std::ostream &os, const ArgParser2 &ap);

private:
  Arg *item_list;

  bool added_floaters, floaters_required;
  int wanted_floaters, floaters_pos;
  char **floaters;
  char *floater_help;

  void add_arg(Arg *a);
};

#endif /* SGL_ARGS2_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?