[10345] | 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 | * Reto Grieder |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | @defgroup CmdArgs Commandline arguments |
---|
| 31 | @ingroup Config |
---|
| 32 | @brief For a reference of all commandline arguments see @ref cmdargspage |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | @file |
---|
| 37 | @ingroup Config CmdArgs |
---|
| 38 | @brief Declaration of CommandLineParser and CommandLineArgument, definition of the SetCommandLineArgument() macros. |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | #ifndef _CommandLineIncludes_H__ |
---|
| 42 | #define _CommandLineIncludes_H__ |
---|
| 43 | |
---|
| 44 | #include "core/CorePrereqs.h" |
---|
| 45 | |
---|
| 46 | #include "CommandLineParser.h" |
---|
| 47 | #include "core/module/StaticallyInitializedInstance.h" |
---|
| 48 | |
---|
| 49 | #define SetCommandLineArgument(name, defaultValue) \ |
---|
| 50 | orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \ |
---|
[10353] | 51 | = (new orxonox::SI_CLA(new orxonox::CommandLineArgument(#name, defaultValue)))->getArgument() |
---|
[10345] | 52 | #define SetCommandLineSwitch(name) \ |
---|
| 53 | SetCommandLineArgument(name, false) |
---|
| 54 | |
---|
| 55 | namespace orxonox |
---|
| 56 | { |
---|
| 57 | class _CoreExport StaticallyInitializedCommandLineArgument : public StaticallyInitializedInstance |
---|
| 58 | { |
---|
| 59 | public: |
---|
| 60 | StaticallyInitializedCommandLineArgument(CommandLineArgument* argument) : argument_(argument) {} |
---|
| 61 | |
---|
| 62 | virtual void load() |
---|
| 63 | { CommandLineParser::addArgument(this->argument_); } |
---|
| 64 | |
---|
| 65 | inline CommandLineArgument& getArgument() |
---|
| 66 | { return *this->argument_; } |
---|
| 67 | |
---|
| 68 | private: |
---|
| 69 | CommandLineArgument* argument_; |
---|
| 70 | }; |
---|
[10353] | 71 | |
---|
| 72 | typedef StaticallyInitializedCommandLineArgument SI_CLA; |
---|
[10345] | 73 | } |
---|
| 74 | |
---|
| 75 | #endif /* _CommandLineIncludes_H__ */ |
---|