-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathargparser.h
82 lines (68 loc) · 2.32 KB
/
argparser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright 2009-2012 JRuby Team (www.jruby.org).
*/
#ifndef _ARGPARSER_H_
#define _ARGPARSER_H_
#include <string>
#include <list>
#include <set>
class ArgParser {
protected:
static const char *REQ_JAVA_VERSION;
static const char *HELP_MSG;
static const char *OPT_JDK_HOME;
static const char *OPT_JRUBY_HOME;
static const char *OPT_JRUBY_COMMAND_NAME;
static const char *OPT_CMDLINE_CLASS_PATH;
static const char *OPT_CMDLINE_MODULE_PATH;
static const char *OPT_CLASS_PATH;
static const char *OPT_BOOT_CLASS_PATH;
static const char *OPT_JFFI_PATH;
static const char *OPT_JRUBY_SHELL;
static const char *OPT_JRUBY_SCRIPT;
static const char *MAIN_CLASS;
static const char *DEFAULT_EXECUTABLE;
public:
ArgParser();
virtual ~ArgParser();
bool parseArgs(int argc, char *argv[]);
void appendToHelp(const char *msg);
std::string* buildCommandLine(int argc, char* argv[]);
protected:
ArgParser(const ArgParser& orig);
bool initPlatformDir();
void prepareOptions();
void setupMaxHeapAndStack(std::list<std::string> userOptions);
void addEnvVarToOptions(std::list<std::string> & optionsList, const char * envvar);
void constructClassPath();
void constructBootClassPath();
void addFilesToClassPath(const char *dir, const char *subdir, const char *pattern);
void addToClassPath(const char *path, bool onlyIfExists = false);
void addToBootClassPath(const char *path, bool onlyIfExists = false);
void addJarsToClassPathFrom(const char *dir);
void addOptionsToCommandLine(std::list<std::string> & commandLine);
bool endsWith(const std::string &string, const std::string &end);
void useModulesIfPresent();
bool releaseFileHasModules();
protected:
bool separateProcess;
bool nailgunClient;
bool noBootClassPath;
bool printCommandLine;
bool useModulePath;
std::string platformDir;
std::string bootclass;
std::string jdkhome;
std::string cpBefore;
std::string cpExplicit;
std::string cpAfter;
std::string nextAction;
std::list<std::string> javaOptions;
std::set<std::string> addedToCP;
std::string classPath;
std::string bootClassPath;
std::set<std::string> addedToBootCP;
std::string appendHelp;
std::list<std::string> progArgs;
};
#endif // ! _ARGPARSER_H_