| 1 | /* |
| 2 | * File: Arguments.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Oct 6, 2009 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This program is free software: you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation, either version 3 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 26 | #include "Arguments.h"cxx . . $ `<file>/HercStudio/Arguments.h`/ |
| 27 | |
| 28 | #include <string> |
| 29 | |
| 30 | Argumentscxx . . $ Arguments# Argumentscxx . . $ Arguments#::instancecxx . . $ Arguments#instance.; |
| 31 | |
| 32 | Argumentscxx . . $ Arguments#::Argumentscxx . . $ Arguments#Arguments(49f6e7a06ebc5aa8).() : |
| 33 | mHelpcxx . . $ Arguments#mHelp.(false) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | Argumentscxx . . $ Arguments#::~cxx . . $ Arguments#`~Arguments`(49f6e7a06ebc5aa8).Argumentscxx . . $ Arguments#() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | Argumentscxx . . $ Arguments#& Argumentscxx . . $ Arguments#::getInstancecxx . . $ Arguments#getInstance(86e8a5b8d0f95c3c).() |
| 42 | { |
| 43 | return instancecxx . . $ Arguments#instance.; |
| 44 | } |
| 45 | |
| 46 | bool Argumentscxx . . $ Arguments#::helpRequestedcxx . . $ Arguments#helpRequested(50ce9a9e25b4a850).() const |
| 47 | { |
| 48 | return mHelpcxx . . $ Arguments#mHelp.; |
| 49 | } |
| 50 | |
| 51 | const stdcxx . . $ std/::stringcxx . . $ std/string#& Argumentscxx . . $ Arguments#::configFileNamecxx . . $ Arguments#configFileName(f4fff0029955a25f).() const |
| 52 | { |
| 53 | return mConfigFilecxx . . $ Arguments#mConfigFile.; |
| 54 | } |
| 55 | |
| 56 | const stdcxx . . $ std/::stringcxx . . $ std/string#& Argumentscxx . . $ Arguments#::resourceFileNamecxx . . $ Arguments#resourceFileName(f4fff0029955a25f).() const |
| 57 | { |
| 58 | return mResourceFilecxx . . $ Arguments#mResourceFile.; |
| 59 | } |
| 60 | |
| 61 | int Argumentscxx . . $ Arguments#::parsecxx . . $ Arguments#parse(afcd3168fc1188a4).(int argc, char * argv[]) |
| 62 | { |
| 63 | while(--argc) |
| 64 | { |
| 65 | argv++; |
| 66 | if (argv[0][0] != '-') return(-1); |
| 67 | |
| 68 | switch(argv[0][1]) |
| 69 | { |
| 70 | case('h'): |
| 71 | mHelpcxx . . $ Arguments#mHelp. = true; |
| 72 | break; |
| 73 | |
| 74 | case('f'): |
| 75 | --argc; |
| 76 | ++argv; |
| 77 | if (argc > 0) mConfigFilecxx . . $ Arguments#mConfigFile. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[0]; |
| 78 | break; |
| 79 | |
| 80 | case('r'): |
| 81 | --argc; |
| 82 | ++argv; |
| 83 | if (argc > 0) mResourceFilecxx . . $ Arguments#mResourceFile. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). argv[0]; |
| 84 | break; |
| 85 | |
| 86 | default: |
| 87 | break; |
| 88 | } |
| 89 | |
| 90 | } |
| 91 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(1,"resource file:'" << mResourceFile << "'"); |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | void Argumentscxx . . $ Arguments#::printUsagecxx . . $ Arguments#printUsage(49f6e7a06ebc5aa8).() |
| 96 | { |
| 97 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(0, "Usage:" << "\n\n" |
| 98 | << "\tHerculesStudio [ -f <hercules-config-file> ] [ -r <hercules-run-commands-file> ] [ -h ]"); |
| 99 | } |
| 100 |