/**************************************************************************** * MeshLab o o * * An extendible mesh processor o o * * _ O _ * * Copyright(C) 2005, 2009 \/)\/ * * Visual Computing Lab /\/| * * ISTI - Italian National Research Council | * * \ * * All rights reserved. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * ****************************************************************************/ #ifndef GETOPT_H #define GETOPT_H #include #include #include /* Example usage: QString file1, file2; QString o_gamma = "10"; QString o_scale = "0.7"; GetOpt opt(argc, argv); opt.addArgument("img1", "first image", &file1); opt.addArgument("img2", "second image", &file2); opt.addOption('g', "gamma", "weigth to derivatives of images (default: 10)", &o_gamma); opt.addOption('s', "scale", "scale [0.5-0.99] for multiscale approach (default: 0.7)", &o_scale); opt.parse(); */ class GetOpt { protected: struct Option { enum Type { SWITCH, OPTION, ARGUMENT, OPTIONAL }; Type type; char o; QString name; QString description; QVariant *value; bool *b; }; bool unlimitedArgs; QList