[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Benjamin Knecht <beni_at_orxonox.net> |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
[945] | 29 | /** |
---|
| 30 | @file Argreader.h |
---|
| 31 | @brief reads arguments |
---|
| 32 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | #ifndef _ArgReader_H__ |
---|
| 36 | #define _ArgReader_H__ |
---|
[1062] | 37 | |
---|
[1505] | 38 | #include "UtilPrereqs.h" |
---|
[945] | 39 | |
---|
[1505] | 40 | #include <string> |
---|
| 41 | |
---|
[945] | 42 | class _UtilExport ArgReader |
---|
| 43 | { |
---|
| 44 | public: |
---|
| 45 | ArgReader(int argc, char **argv); |
---|
| 46 | void checkArgument(std::string option, std::string& string, bool must=false); |
---|
| 47 | void checkArgument(std::string option, int& integer, bool must=false); |
---|
| 48 | void checkArgument(std::string option, float& floating, bool must=false); |
---|
| 49 | bool errorHandling(); |
---|
| 50 | private: |
---|
| 51 | int checkOption(std::string option); |
---|
| 52 | |
---|
| 53 | private: |
---|
| 54 | int counter_; |
---|
| 55 | char **arguments_; |
---|
| 56 | bool fail_; |
---|
| 57 | std::string errorStr_; |
---|
| 58 | }; |
---|
| 59 | |
---|
| 60 | #endif /* _ArgReader_H__ */ |
---|